aboutsummaryrefslogtreecommitdiff
path: root/object/store
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-30 15:19:18 +0000
committerGravatar Runxi Yu2026-03-30 15:19:18 +0000
commit07eba7b54d3836e76996c0b06714b6e505bead5e (patch)
tree76625a389bff289567525f7e4bb457f32ebfd0df /object/store
parentobject,store/packed{,/internal/ingest}: Move from format/packfile/ingest (diff)
signatureNo signature
object/store: Expose pack writing options
Diffstat (limited to 'object/store')
-rw-r--r--object/store/packed/options.go1
-rw-r--r--object/store/packed/writer.go9
-rw-r--r--object/store/writer_pack.go36
3 files changed, 42 insertions, 4 deletions
diff --git a/object/store/packed/options.go b/object/store/packed/options.go
index 72c153a1..718efc29 100644
--- a/object/store/packed/options.go
+++ b/object/store/packed/options.go
@@ -3,4 +3,5 @@ package packed
// Options configures a packed object store.
type Options struct {
RefreshPolicy RefreshPolicy
+ WriteRev bool
}
diff --git a/object/store/packed/writer.go b/object/store/packed/writer.go
index 28867291..20314e7d 100644
--- a/object/store/packed/writer.go
+++ b/object/store/packed/writer.go
@@ -10,8 +10,13 @@ import (
var _ objectstore.PackWriter = (*Store)(nil)
// WritePack ingests one pack stream into the packed store.
-func (store *Store) WritePack(src io.Reader, _ objectstore.PackWriteOptions) error {
- _, err := ingest.WritePack(store.root, store.algo, src, ingest.Options{})
+func (store *Store) WritePack(src io.Reader, opts objectstore.PackWriteOptions) error {
+ _, err := ingest.WritePack(store.root, store.algo, src, ingest.Options{
+ WriteRev: store.opts.WriteRev,
+ Base: opts.ThinBase,
+ Progress: opts.Progress,
+ RequireTrailingEOF: opts.RequireTrailingEOF,
+ })
return err
}
diff --git a/object/store/writer_pack.go b/object/store/writer_pack.go
index 25c1e8d9..85ce676e 100644
--- a/object/store/writer_pack.go
+++ b/object/store/writer_pack.go
@@ -1,9 +1,41 @@
package objectstore
-import "io"
+import (
+ "io"
+
+ "codeberg.org/lindenii/furgit/common/iowrap"
+)
// PackWriteOptions controls one pack write operation.
-type PackWriteOptions struct{}
+type PackWriteOptions struct {
+ // ThinBase supplies the wider object reader used to complete thin packs
+ // during ingestion.
+ //
+ // This is an option for the write operation rather than on a particular
+ // pack-backed store because any pack-accepting store is not generally
+ // expected to know the entire repository object universe around it.
+ // In a normal repository, thin bases usually come from a broader view
+ // such as mix(loose, packed), and should not be treated as a property of
+ // the destination pack-accepting store. Thus, in almost all pack-ingesting
+ // operations, a thin base reader would be required, and hence it is
+ // included here.
+ //
+ // When nil, external thin-base repair is disabled and unresolved thin deltas
+ // fail ingestion.
+ ThinBase Reader
+
+ // Progress receives human-readable progress messages.
+ //
+ // When nil, no progress output is emitted.
+ Progress iowrap.WriteFlusher
+
+ // RequireTrailingEOF requires the source to hit EOF after the pack trailer.
+ //
+ // This is suitable for exact pack-file readers, but should be disabled for
+ // full-duplex transport streams like receive-pack where the peer keeps the
+ // connection open to read the server response.
+ RequireTrailingEOF bool
+}
// PackWriter writes Git pack streams.
type PackWriter interface {