From: Justin Tobler <jltobler@gmail.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/7] odb/streaming: track write stream size in the structure
Date: Tue, 4 Aug 2026 11:47:48 -0500 [thread overview]
Message-ID: <anIWUKV8iBFkT7g9@denethor> (raw)
In-Reply-To: <20260804-pks-odb-stream-unification-v1-1-86d70e82345e@pks.im>
On 26/08/04 09:25AM, Patrick Steinhardt wrote:
> 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.
Storing the object size in the stream directly makes complete sense.
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> builtin/unpack-objects.c | 3 ++-
> object-file.c | 25 +++++++++++--------------
> odb.c | 4 ++--
> odb.h | 2 +-
> odb/source-files.c | 3 +--
> odb/source-inmemory.c | 11 +++++------
> odb/source-loose.c | 7 +++----
> odb/source-packed.c | 1 -
> odb/source.h | 5 ++---
> odb/streaming.c | 1 +
> odb/streaming.h | 1 +
> odb/transaction.c | 4 ++--
> odb/transaction.h | 4 ++--
> t/unit-tests/u-odb-inmemory.c | 11 +++++------
> 14 files changed, 38 insertions(+), 44 deletions(-)
>
[snip]
> 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;
> };
The size is now stored directly in the stream, the rest of this patch is
adjusting callers to use the embedded size information instead of
passing it. Looks good.
-Justin
next prev parent reply other threads:[~2026-08-04 16:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 7:25 [PATCH 0/7] odb: unify read and write streams Patrick Steinhardt
2026-08-04 7:25 ` [PATCH 1/7] odb/streaming: track write stream size in the structure Patrick Steinhardt
2026-08-04 16:47 ` Justin Tobler [this message]
2026-08-04 7:25 ` [PATCH 2/7] odb/streaming: drop `is_finished` field Patrick Steinhardt
2026-08-04 17:46 ` Justin Tobler
2026-08-04 7:25 ` [PATCH 3/7] odb/streaming: support streaming arbitrary object types Patrick Steinhardt
2026-08-04 18:03 ` Justin Tobler
2026-08-05 6:06 ` Patrick Steinhardt
2026-08-04 18:54 ` Junio C Hamano
2026-08-05 6:06 ` Patrick Steinhardt
2026-08-04 7:25 ` [PATCH 4/7] odb/streaming: rename `struct odb_read_stream` Patrick Steinhardt
2026-08-04 7:25 ` [PATCH 5/7] odb/streaming: consolidate read and write streams Patrick Steinhardt
2026-08-04 18:23 ` Justin Tobler
2026-08-05 6:06 ` Patrick Steinhardt
2026-08-04 7:25 ` [PATCH 6/7] odb/streaming: rename `struct read_object_fd_data` Patrick Steinhardt
2026-08-04 18:25 ` Justin Tobler
2026-08-04 7:25 ` [PATCH 7/7] odb/streaming: unify function names to create new streams Patrick Steinhardt
2026-08-04 18:30 ` Justin Tobler
2026-08-05 7:44 ` [PATCH v2 0/8] odb: unify read and write streams Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 1/8] odb/streaming: track write stream size in the structure Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 2/8] odb/streaming: drop `is_finished` field Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 3/8] odb/streaming: support streaming arbitrary object types Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 4/8] odb/streaming: rename `struct odb_read_stream` Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 5/8] odb/streaming: consolidate read and write streams Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 6/8] odb/streaming: rename `struct read_object_fd_data` Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 7/8] odb/streaming: rename `struct input_zstream_data` Patrick Steinhardt
2026-08-05 7:44 ` [PATCH v2 8/8] odb/streaming: unify function names to create new streams Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anIWUKV8iBFkT7g9@denethor \
--to=jltobler@gmail.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox