2 * Copyright (C) the libgit2 contributors. All rights reserved.
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.
8 #ifndef INCLUDE_pack_objects_h__
9 #define INCLUDE_pack_objects_h__
19 #include "git2/pack.h"
21 #define GIT_PACK_WINDOW 10 /* number of objects to possibly delta against */
22 #define GIT_PACK_DEPTH 50 /* max delta depth */
23 #define GIT_PACK_DELTA_CACHE_SIZE (256 * 1024 * 1024)
24 #define GIT_PACK_DELTA_CACHE_LIMIT 1000
25 #define GIT_PACK_BIG_FILE_THRESHOLD (512 * 1024 * 1024)
27 typedef struct git_pobject
{
34 unsigned int hash
; /* name hint hash */
36 struct git_pobject
*delta
; /* delta base object */
37 struct git_pobject
*delta_child
; /* deltified objects who bases me */
38 struct git_pobject
*delta_sibling
; /* other deltified objects
39 * who uses the same base as
43 unsigned long delta_size
;
44 unsigned long z_delta_size
;
52 struct git_packbuilder
{
53 git_repository
*repo
; /* associated repository */
54 git_odb
*odb
; /* associated object database */
63 git_pobject
*object_list
;
65 git_oidmap
*object_ix
;
67 git_oid pack_oid
; /* hash of written pack */
69 /* synchronization objects */
70 git_mutex cache_mutex
;
71 git_mutex progress_mutex
;
72 git_cond progress_cond
;
75 uint64_t delta_cache_size
;
76 uint64_t max_delta_cache_size
;
77 uint64_t cache_max_small_delta_size
;
78 uint64_t big_file_threshold
;
79 uint64_t window_memory_limit
;
81 int nr_threads
; /* nr of threads to use */
83 git_packbuilder_progress progress_cb
;
84 void *progress_cb_payload
;
85 double last_progress_report_time
; /* the time progress was last reported */
90 int git_packbuilder_write_buf(git_buf
*buf
, git_packbuilder
*pb
);
92 #endif /* INCLUDE_pack_objects_h__ */