summaryrefslogtreecommitdiff
path: root/src/pack.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2012-11-19 22:22:33 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2012-11-30 15:55:23 +0100
commit46635339e935ce59e5a3525e18228f259d141aa3 (patch)
tree663c88e144983eb84f2a5ea4b875060d4767a4ce /src/pack.h
parentda820437368aae2088e992e7ce8944253693aa16 (diff)
downloadlibgit2-46635339e935ce59e5a3525e18228f259d141aa3.tar.gz
pack: introduce a streaming API for raw objects
This allows us to take objects from the packfile as a stream instead of having to keep it all in memory.
Diffstat (limited to 'src/pack.h')
-rw-r--r--src/pack.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h
index 9fb26b6a9..3355cd21f 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -8,6 +8,8 @@
#ifndef INCLUDE_pack_h__
#define INCLUDE_pack_h__
+#include <zlib.h>
+
#include "git2/oid.h"
#include "common.h"
@@ -76,6 +78,14 @@ struct git_pack_entry {
struct git_pack_file *p;
};
+typedef struct git_packfile_stream {
+ git_off_t curpos;
+ int done;
+ z_stream zstream;
+ struct git_pack_file *p;
+ git_mwindow *mw;
+} git_packfile_stream;
+
int git_packfile_unpack_header(
size_t *size_p,
git_otype *type_p,
@@ -92,6 +102,10 @@ int packfile_unpack_compressed(
size_t size,
git_otype type);
+int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, git_off_t curpos);
+ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t len);
+void git_packfile_stream_free(git_packfile_stream *obj);
+
git_off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs,
git_off_t *curpos, git_otype type,
git_off_t delta_obj_offset);