Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schubert <schu@schu.io>2012-08-20 00:26:32 +0400
committerMichael Schubert <schu@schu.io>2012-10-09 23:28:31 +0400
commit0a32dca5ecbd4c56b02ba78af4174ac7f65a786c (patch)
tree733f2d3113d96524c1e4c05d7e98c03baf07614f /src/pack-objects.h
parentec1d42b7d5eb5a25b504277bee5b0cc97931e1a7 (diff)
gsoc-pack-objects WIP
Diffstat (limited to 'src/pack-objects.h')
-rw-r--r--src/pack-objects.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/pack-objects.h b/src/pack-objects.h
new file mode 100644
index 000000000..971b30217
--- /dev/null
+++ b/src/pack-objects.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2009-2012 the libgit2 contributors
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#ifndef INCLUDE_pack_objects_h__
+#define INCLUDE_pack_objects_h__
+
+#include "common.h"
+
+#include "buffer.h"
+#include "hash.h"
+
+#include "git2/oid.h"
+
+#define GIT_PACK_WINDOW 10 /* number of objects to possibly delta against */
+#define GIT_PACK_DEPTH 50 /* max delta depth */
+#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; /* name hint hash */
+
+ struct git_pobject *delta; /* delta base object */
+ struct git_pobject *delta_child; /* deltified objects who bases me */
+ struct git_pobject *delta_sibling; /* other deltified objects
+ * who uses the same base as
+ * me */
+
+ void *delta_data;
+ unsigned long delta_size;
+ unsigned long z_delta_size;
+
+ int written:1,
+ recursing:1,
+ no_try_delta:1,
+ tagged:1,
+ filled:1;
+} git_pobject;
+
+struct git_packbuilder {
+ git_repository *repo; /* associated repository */
+ git_odb *odb; /* associated object database */
+
+ git_hash_ctx *ctx;
+
+ uint32_t nr_objects,
+ nr_alloc,
+ nr_written,
+ nr_remaining;
+
+ git_pobject *object_list;
+
+ int *object_ix;
+ int object_ix_hashsz;
+
+
+ git_oid pack_oid; /* hash of written pack */
+
+ /* configs */
+ unsigned long delta_cache_size;
+ unsigned long max_delta_cache_size;
+ unsigned long cache_max_small_delta_size;
+ unsigned long big_file_threshold;
+ unsigned long window_memory_limit;
+
+ int nr_threads; /* nr of threads to use */
+
+ bool done;
+};
+
+
+int git_packbuilder_send(git_packbuilder *pb, git_transport *t);
+int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb);
+
+#endif