aboutsummaryrefslogtreecommitdiff
path: root/streaming.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-11-23 19:59:42 +0100
committerJunio C Hamano <gitster@pobox.com>2025-11-23 12:56:45 -0800
commit378ec56beba161abbef6e2c87d9bc2ac43c355f3 (patch)
treedce5e9307fa32997c991da8e1f7040e3cc6e3287 /streaming.h
parent8c1b84bc977bf1e4515efe0386de87257ec28689 (diff)
downloadgit-378ec56beba161abbef6e2c87d9bc2ac43c355f3.tar.xz
streaming: refactor interface to be object-database-centric
Refactor the streaming interface to be centered around object databases instead of centered around the repository. Rename the functions accordingly. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'streaming.h')
-rw-r--r--streaming.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/streaming.h b/streaming.h
index acfdef1598..7cb55213b7 100644
--- a/streaming.h
+++ b/streaming.h
@@ -24,11 +24,31 @@ struct odb_read_stream {
unsigned long size; /* inflated size of full object */
};
-struct odb_read_stream *open_istream(struct repository *, const struct object_id *,
- enum object_type *, unsigned long *,
- struct stream_filter *);
-int close_istream(struct odb_read_stream *);
-ssize_t read_istream(struct odb_read_stream *, void *, size_t);
+/*
+ * Create a new object stream for the given object database. Populates the type
+ * and size pointers with the object's info. An optional filter can be used to
+ * transform the object's content.
+ *
+ * Returns the stream on success, a `NULL` pointer otherwise.
+ */
+struct odb_read_stream *odb_read_stream_open(struct object_database *odb,
+ const struct object_id *oid,
+ enum object_type *type,
+ unsigned long *size,
+ struct stream_filter *filter);
+
+/*
+ * Close the given read stream and release all resources associated with it.
+ * Returns 0 on success, a negative error code otherwise.
+ */
+int odb_read_stream_close(struct odb_read_stream *stream);
+
+/*
+ * Read data from the stream into the buffer. Returns 0 on EOF and the number
+ * of bytes read on success. Returns a negative error code in case reading from
+ * the stream fails.
+ */
+ssize_t odb_read_stream_read(struct odb_read_stream *stream, void *buf, size_t len);
/*
* Look up the object by its ID and write the full contents to the file