]> git.ipfire.org Git - thirdparty/git.git/commitdiff
streaming: make the `odb_read_stream` definition public
authorPatrick Steinhardt <ps@pks.im>
Sun, 23 Nov 2025 18:59:39 +0000 (19:59 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 23 Nov 2025 20:56:45 +0000 (12:56 -0800)
Subsequent commits will move the backend-specific logic of setting up an
object read stream into the specific subsystems. As the backends are now
the ones that are responsible for allocating the stream they'll need to
have the stream definition available to them.

Make the stream definition public to prepare for this.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
streaming.c
streaming.h

index 807a6e03a85b49fcdaf47f522ae6ee94d2ed8e0b..0635b7c12e223325b8ebb01702bc00f96d593022 100644 (file)
 #include "replace-object.h"
 #include "packfile.h"
 
-typedef int (*close_istream_fn)(struct odb_read_stream *);
-typedef ssize_t (*read_istream_fn)(struct odb_read_stream *, char *, size_t);
-
 #define FILTER_BUFFER (1024*16)
 
-struct odb_read_stream {
-       close_istream_fn close;
-       read_istream_fn read;
-
-       enum object_type type;
-       unsigned long size; /* inflated size of full object */
-};
-
 /*****************************************************************
  *
  * Filtered stream
index 148f6b30697ab758d4277d0f87ec5e9b48589605..acfdef1598db523be32ee473432e9ca98596b7eb 100644 (file)
@@ -7,10 +7,23 @@
 #include "object.h"
 
 struct object_database;
-/* opaque */
 struct odb_read_stream;
 struct stream_filter;
 
+typedef int (*odb_read_stream_close_fn)(struct odb_read_stream *);
+typedef ssize_t (*odb_read_stream_read_fn)(struct odb_read_stream *, char *, size_t);
+
+/*
+ * A stream that can be used to read an object from the object database without
+ * loading all of it into memory.
+ */
+struct odb_read_stream {
+       odb_read_stream_close_fn close;
+       odb_read_stream_read_fn read;
+       enum object_type type;
+       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 *);