#ifndef INCLUDE_pack_objects_h__
#define INCLUDE_pack_objects_h__
#include "common.h"
#include "buffer.h"
#include "hash.h"
#include "oidmap.h"
#include "netops.h"
#include "zstream.h"
#include "pool.h"
#include "git2/oid.h"
#include "git2/pack.h"
#define GIT_PACK_WINDOW 10
#define GIT_PACK_DEPTH 50
#define GIT_PACK_DELTA_CACHE_SIZE (256 * 1024 * 1024)
#define GIT_PACK_DELTA_CACHE_LIMIT 1000
#define GIT_PACK_BIG_FILE_THRESHOLD (512 * 1024 * 1024)
typedef struct git_pobject {
git_oid id;
git_otype type;
git_off_t offset;
size_t size;
unsigned int hash;
struct git_pobject *delta;
struct git_pobject *delta_child;
struct git_pobject *delta_sibling;
void *delta_data;
unsigned long delta_size;
unsigned long z_delta_size;
int written:1,
recursing:1,
tagged:1,
filled:1;
} git_pobject;
typedef struct {
git_oid id;
unsigned int uninteresting:1,
seen:1;
} git_walk_object;
struct git_packbuilder {
git_repository *repo;
git_odb *odb;
git_hash_ctx ctx;
git_zstream zstream;
uint32_t nr_objects,
nr_deltified,
nr_alloc,
nr_written,
nr_remaining;
git_pobject *object_list;
git_oidmap *object_ix;
git_oidmap *walk_objects;
git_pool object_pool;
git_oid pack_oid;
git_mutex cache_mutex;
git_mutex progress_mutex;
git_cond progress_cond;
uint64_t delta_cache_size;
uint64_t max_delta_cache_size;
uint64_t cache_max_small_delta_size;
uint64_t big_file_threshold;
uint64_t window_memory_limit;
int nr_threads;
git_packbuilder_progress progress_cb;
void *progress_cb_payload;
double last_progress_report_time;
bool done;
};
int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb);
#endif