diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2012-11-05 11:33:10 -0600 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2012-11-05 16:00:29 -0600 |
commit | 09cc0b92dc60c726180cda36643e263c32d9a812 (patch) | |
tree | 8b07bb41b327e75c6c92616ec891809b11552ed7 /include/git2/odb_backend.h | |
parent | a5e85d86b7e13352c553b0a43bc36fee5880b5c7 (diff) | |
download | libgit2-09cc0b92dc60c726180cda36643e263c32d9a812.tar.gz |
create callback to handle packs from fetch, move the indexer to odb_pack
Diffstat (limited to 'include/git2/odb_backend.h')
-rw-r--r-- | include/git2/odb_backend.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h index cb8069787..4df48d77e 100644 --- a/include/git2/odb_backend.h +++ b/include/git2/odb_backend.h @@ -10,6 +10,7 @@ #include "common.h" #include "types.h" #include "oid.h" +#include "indexer.h" /** * @file git2/backend.h @@ -21,6 +22,7 @@ GIT_BEGIN_DECL struct git_odb_stream; +struct git_odb_writepack; /** An instance for a custom backend */ struct git_odb_backend { @@ -75,11 +77,16 @@ struct git_odb_backend { struct git_odb_backend *, const git_oid *); - int (*foreach)( - struct git_odb_backend *, - int (*cb)(git_oid *oid, void *data), - void *data - ); + int (* foreach)( + struct git_odb_backend *, + int (*cb)(git_oid *oid, void *data), + void *data); + + int (* writepack)( + struct git_odb_writepack **, + struct git_odb_backend *, + git_transfer_progress_callback progress_cb, + void *progress_payload); void (* free)(struct git_odb_backend *); }; @@ -102,6 +109,15 @@ struct git_odb_stream { void (*free)(struct git_odb_stream *stream); }; +/** A stream to write a pack file to the ODB */ +struct git_odb_writepack { + struct git_odb_backend *backend; + + int (*add)(struct git_odb_writepack *writepack, const void *data, size_t size, git_transfer_progress *stats); + int (*commit)(struct git_odb_writepack *writepack, git_transfer_progress *stats); + void (*free)(struct git_odb_writepack *writepack); +}; + GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir); GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir, int compression_level, int do_fsync); GIT_EXTERN(int) git_odb_backend_one_pack(git_odb_backend **backend_out, const char *index_file); |