]> git.proxmox.com Git - libgit2.git/blame - src/pack-objects.h
New upstream version 0.28.4+dfsg.1
[libgit2.git] / src / pack-objects.h
CommitLineData
0a32dca5 1/*
359fc2d2 2 * Copyright (C) the libgit2 contributors. All rights reserved.
0a32dca5
MS
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7
8#ifndef INCLUDE_pack_objects_h__
9#define INCLUDE_pack_objects_h__
10
11#include "common.h"
12
13#include "buffer.h"
14#include "hash.h"
0cf49e10 15#include "oidmap.h"
41fb1ca0 16#include "netops.h"
52a8a130 17#include "zstream.h"
04a36fef 18#include "pool.h"
1c04a96b 19#include "indexer.h"
0a32dca5
MS
20
21#include "git2/oid.h"
b176eded 22#include "git2/pack.h"
0a32dca5
MS
23
24#define GIT_PACK_WINDOW 10 /* number of objects to possibly delta against */
25#define GIT_PACK_DEPTH 50 /* max delta depth */
26#define GIT_PACK_DELTA_CACHE_SIZE (256 * 1024 * 1024)
27#define GIT_PACK_DELTA_CACHE_LIMIT 1000
28#define GIT_PACK_BIG_FILE_THRESHOLD (512 * 1024 * 1024)
29
30typedef struct git_pobject {
31 git_oid id;
ac3d33df 32 git_object_t type;
0a32dca5
MS
33 git_off_t offset;
34
35 size_t size;
36
37 unsigned int hash; /* name hint hash */
38
39 struct git_pobject *delta; /* delta base object */
40 struct git_pobject *delta_child; /* deltified objects who bases me */
41 struct git_pobject *delta_sibling; /* other deltified objects
42 * who uses the same base as
43 * me */
44
45 void *delta_data;
60e15ecd
ET
46 size_t delta_size;
47 size_t z_delta_size;
0a32dca5
MS
48
49 int written:1,
50 recursing:1,
0a32dca5
MS
51 tagged:1,
52 filled:1;
53} git_pobject;
54
55struct git_packbuilder {
56 git_repository *repo; /* associated repository */
57 git_odb *odb; /* associated object database */
58
603bee07 59 git_hash_ctx ctx;
52a8a130 60 git_zstream zstream;
0a32dca5
MS
61
62 uint32_t nr_objects,
60e15ecd
ET
63 nr_deltified,
64 nr_written,
65 nr_remaining;
66
67 size_t nr_alloc;
0a32dca5
MS
68
69 git_pobject *object_list;
70
0cf49e10 71 git_oidmap *object_ix;
0a32dca5 72
04a36fef
CMN
73 git_oidmap *walk_objects;
74 git_pool object_pool;
75
0a32dca5
MS
76 git_oid pack_oid; /* hash of written pack */
77
b4491b99
PK
78 /* synchronization objects */
79 git_mutex cache_mutex;
80 git_mutex progress_mutex;
81 git_cond progress_cond;
82
0a32dca5 83 /* configs */
60e15ecd
ET
84 size_t delta_cache_size;
85 size_t max_delta_cache_size;
86 size_t cache_max_small_delta_size;
87 size_t big_file_threshold;
88 size_t window_memory_limit;
0a32dca5 89
60e15ecd 90 unsigned int nr_threads; /* nr of threads to use */
0a32dca5 91
b176eded
JM
92 git_packbuilder_progress progress_cb;
93 void *progress_cb_payload;
94 double last_progress_report_time; /* the time progress was last reported */
95
0a32dca5
MS
96 bool done;
97};
98
0a32dca5
MS
99int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb);
100
eae0bfdc 101#endif