summaryrefslogtreecommitdiff
path: root/include/git2/odb_backend.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-09-09 10:17:54 -0700
committerRussell Belfer <rb@github.com>2013-09-09 10:17:54 -0700
commit5fb1f9f2040df47ace275ab974b41d00883aef75 (patch)
treef1464b2553df04c9860bfb9404c41a74b4509c0f /include/git2/odb_backend.h
parentef6389ad504037e7a4311adbf14f1fa5a5aa4190 (diff)
parent031f3f8028835c935d1e75ebd136aaaefffea821 (diff)
downloadlibgit2-5fb1f9f2040df47ace275ab974b41d00883aef75.tar.gz
Merge pull request #1837 from libgit2/ntk/topic/control_stream_write_size
odb: Error when streaming in less|more bytes than declared
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);