From: Karthik Nayak Date: Tue, 11 Aug 2026 09:51:38 GMT Subject: Re: [PATCH v2 1/8] odb/streaming: track write stream size in the structure Message-ID: In-Reply-To: <20260805-pks-odb-stream-unification-v2-1-b8c369564641@pks.im> Patrick Steinhardt writes: > When passing around a `struct odb_write_stream` we typically also have > to pass the number of bytes that the stream will yield. This is required > because the object header itself contains that size, and consequently we > cannot write the header without that information. > > Move this information into the stream itself so that it becomes self- > describing. In addition to that, this also brings the `struct > odb_write_stream` a bit closer to the `struct odb_read_stream` so that > we can eventually merge both stream types. > Okay, so this will be similar to `odb_read_stream.size`. Makes sense. [snip] > diff --git a/odb/streaming.c b/odb/streaming.c > index 20531e864c..38c2f6687c 100644 > --- a/odb/streaming.c > +++ b/odb/streaming.c > @@ -336,5 +336,6 @@ void odb_write_stream_from_fd(struct odb_write_stream *stream, int fd, > > stream->data = data; > stream->read = read_object_fd; > + stream->size = size; > stream->is_finished = 0; > } > diff --git a/odb/streaming.h b/odb/streaming.h > index c023671780..4d7d31b5aa 100644 > --- a/odb/streaming.h > +++ b/odb/streaming.h > @@ -55,6 +55,7 @@ ssize_t odb_read_stream_read(struct odb_read_stream *stream, void *buf, size_t l > struct odb_write_stream { > ssize_t (*read)(struct odb_write_stream *, unsigned char *, size_t); > void *data; > + size_t size; > int is_finished; > }; > Okay so this is the main change. Looks good. [snip]