2 * Copyright (C) 2009-2012 the libgit2 contributors
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__
20 #define GIT_PACK_WINDOW 10 /* number of objects to possibly delta against */
21 #define GIT_PACK_DEPTH 50 /* max delta depth */
22 #define GIT_PACK_DELTA_CACHE_SIZE (256 * 1024 * 1024)
23 #define GIT_PACK_DELTA_CACHE_LIMIT 1000
24 #define GIT_PACK_BIG_FILE_THRESHOLD (512 * 1024 * 1024)
26 typedef struct git_pobject
{
33 unsigned int hash
; /* name hint hash */
35 struct git_pobject
*delta
; /* delta base object */
36 struct git_pobject
*delta_child
; /* deltified objects who bases me */
37 struct git_pobject
*delta_sibling
; /* other deltified objects
38 * who uses the same base as
42 unsigned long delta_size
;
43 unsigned long z_delta_size
;
51 struct git_packbuilder
{
52 git_repository
*repo
; /* associated repository */
53 git_odb
*odb
; /* associated object database */
62 git_pobject
*object_list
;
64 git_oidmap
*object_ix
;
66 git_oid pack_oid
; /* hash of written pack */
68 /* synchronization objects */
69 git_mutex cache_mutex
;
70 git_mutex progress_mutex
;
71 git_cond progress_cond
;
74 unsigned long delta_cache_size
;
75 unsigned long max_delta_cache_size
;
76 unsigned long cache_max_small_delta_size
;
77 unsigned long big_file_threshold
;
78 unsigned long window_memory_limit
;
80 int nr_threads
; /* nr of threads to use */
85 int git_packbuilder_send(git_packbuilder
*pb
, gitno_socket
*s
);
86 int git_packbuilder_write_buf(git_buf
*buf
, git_packbuilder
*pb
);
88 #endif /* INCLUDE_pack_objects_h__ */