Subject: Re: [PATCH v2 17/19] streaming: refactor interface to be object-database-centric

From: Patrick Steinhardt <[email-masked]>
Date: Sun, 23 Nov 2025 19:59:21 +0100

On Fri, Nov 21, 2025 at 04:10:18PM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <[email-masked]> 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