Re: [PATCH v2 17/19] streaming: refactor interface to be object-database-centric
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 23, 2025, 18:59 UTC
- Message-ID
- <aSNZiaa9tRQgKbm5@pks.im>
- In-Reply-To
- <xmqqv7j32ahh.fsf@gitster.g>
On Fri, Nov 21, 2025 at 04:10:18PM -0800, Junio C Hamano wrote:
Show 26 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
>
> > Refactor the streaming interface to be centered around object databases
> > instead of centered around the repository. Rename the functions
> > accordingly.
>
> Good idea.
>
> > - st = open_istream(r, oid, &type, &sz, NULL);
> > + st = odb_read_object_stream(r->objects, oid, &type, &sz, NULL);
>
> Calling the thing that is returned a "read stream" is a lot more
> trivially obvious than the original name "i(nput) stream", and I
> like that aspect of the new name a lot better, and the structure is
> also named appropriately ("struct odb_read_stream").
>
> At least the old naming was consistent with the usual file I/O API.
> you "open" istream, then "read" from that istream, and finally
> "close" that istream. If you insist on having the noun first before
> the verb, call them
>
> odb_read_stream_open()
> odb_read_stream_read()
> odb_read_stream_close()
>
> perhaps? I think _read and _close are already named appropriately.Ah, right, that makes sense. `odb_read_stream_open()` is also shorter compared to `odb_read_object_stream()`. Will adapt.
Patrick