Re: [PATCH 5/6] object-file: generalize packfile writes to use odb_write_stream
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 31, 2026, 22:59 UTC
- Message-ID
- <acxRwaUk4XNJiDx9@pks.im>
- In-Reply-To
- <acvX8wdg39xTy-Am@denethor>
On Tue, Mar 31, 2026 at 09:31:25AM -0500, Justin Tobler wrote:
Show 20 quoted lines
> On 26/03/31 09:48AM, Patrick Steinhardt wrote:
> > On Mon, Mar 30, 2026 at 10:38:34PM -0500, Justin Tobler wrote:
> > > @@ -1543,6 +1542,40 @@ static void flush_packfile_transaction(struct odb_transaction_files *transaction
> > > odb_reprepare(repo->objects);
> > > }
> > >
> > > +struct read_object_fd_data {
> > > + int fd;
> > > + size_t size;
> > > + unsigned char buf[16384];
> > > +};
> >
> > This interface feels generally useful to me, not just in this subsystem
> > here. Would it make sense to instead expose it in "odb/transaction.h"
> > as a new `odb_write_stream_from_fd()` function? No need to expose the
> > structure itself, I guess.
>
> Hmmm, exposing an `odb_write_stream_from_fd()` function could probably
> be useful. Would it be better for it to be put in "odb/streaming.h"
> though? Maybe the its use case would always be related to transactions?For now it's certainly always related to writing objects, but you're right in that it is not necessarily related to a transaction. After all, we also have `odb_write_object_stream()`.
Putting it into "odb.h" would feel off I think, so maybe "odb/streaming.h" is a good alternative.
Patrick