From: Justin Tobler Date: Tue, 31 Mar 2026 23:21:11 GMT Subject: Re: [PATCH 5/6] object-file: generalize packfile writes to use odb_write_stream Message-ID: In-Reply-To: On 26/04/01 12:59AM, Patrick Steinhardt wrote: > On Tue, Mar 31, 2026 at 09:31:25AM -0500, Justin Tobler wrote: > > 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. Ok, I'll put it in "odb/streaming.h" for now. Out of curiousity, is there any reason `struct odb_write_stream` isn't currently in "odb/streaming.h" already? I was thinking it may make sense to move that interface over as well. Thanks, -Justin