summaryrefslogtreecommitdiff
path: root/include/git2/odb_backend.h
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2013-09-07 22:39:05 +0200
committernulltoken <emeric.fermas@gmail.com>2013-09-07 23:00:20 +0200
commit031f3f8028835c935d1e75ebd136aaaefffea821 (patch)
treef1464b2553df04c9860bfb9404c41a74b4509c0f /include/git2/odb_backend.h
parentef6389ad504037e7a4311adbf14f1fa5a5aa4190 (diff)
downloadlibgit2-031f3f8028835c935d1e75ebd136aaaefffea821.tar.gz
odb: Error when streaming in too [few|many] bytes
Diffstat (limited to 'include/git2/odb_backend.h')
-rw-r--r--include/git2/odb_backend.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h
index bafeec047..e558bbb1c 100644
--- a/include/git2/odb_backend.h
+++ b/include/git2/odb_backend.h
@@ -78,6 +78,9 @@ struct git_odb_stream {
unsigned int mode;
void *hash_ctx;
+ size_t declared_size;
+ size_t received_bytes;
+
/**
* Write at most `len` bytes into `buffer` and advance the
* stream.
@@ -93,9 +96,13 @@ struct git_odb_stream {
* Store the contents of the stream as an object with the id
* specified in `oid`.
*
- * This method will *not* be invoked by libgit2 if the object pointed at
- * by `oid` already exists in any backend. Libgit2 will however take care
- * of properly disposing the stream through a call to `free()`.
+ * This method will *not* be invoked by libgit2 when:
+ * - the object pointed at by `oid` already exists in any backend.
+ * - the total number of received bytes differs from the size declared
+ * with `git_odb_open_wstream()`
+ *
+ * Libgit2 will however take care of properly disposing the stream through
+ * a call to `free()`.
*/
int (*finalize_write)(git_odb_stream *stream, const git_oid *oid);