ref: 3ba67c27db0cf52b120e4f15c09047aa96d3bcb4
parent: 3bc59debb5436d6d3ffce5aa643da021aaf533ef
author: Runxi Yu <runxiyu@umich.edu>
date: Mon Mar 30 14:18:06 EDT 2026
object/store: Unify writers and fix naming
--- /dev/null
+++ b/object/store/base_quarantine.go
@@ -1,0 +1,17 @@
+package objectstore
+
+// BaseQuarantine is one quarantined write. It is intended to be embedded.
+type BaseQuarantine interface {+ // Reader exposes the objects written into this quarantine.
+ Reader
+
+ // Promote publishes quarantined writes into their final destination.
+ //
+ // Promote invalidates the receiver.
+ Promote() error
+
+ // Discard abandons quarantined writes.
+ //
+ // Discard invalidates the receiver.
+ Discard() error
+}
--- a/object/store/dual/dual.go
+++ b/object/store/dual/dual.go
@@ -27,8 +27,7 @@
}
var (
- _ objectstore.Reader = (*Dual)(nil)
- _ objectstore.ObjectWriter = (*Dual)(nil)
- _ objectstore.PackWriter = (*Dual)(nil)
- _ objectstore.WriterQuarantiner = (*Dual)(nil)
+ _ objectstore.Reader = (*Dual)(nil)
+ _ objectstore.Writer = (*Dual)(nil)
+ _ objectstore.Quarantiner = (*Dual)(nil)
)
--- a/object/store/dual/dual_test.go
+++ b/object/store/dual/dual_test.go
@@ -117,9 +117,9 @@
repo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})store := newDualStore(t, repo, algo)
- quarantiner, ok := any(store).(objectstore.WriterQuarantiner)
+ quarantiner, ok := any(store).(objectstore.Quarantiner)
if !ok {- t.Fatal("dual does not implement WriterQuarantiner")+ t.Fatal("dual does not implement Quarantiner")}
quarantine, err := quarantiner.BeginQuarantine(objectstore.QuarantineOptions{})@@ -219,7 +219,7 @@
repo := testgit.NewRepo(t, testgit.RepoOptions{ObjectFormat: algo, Bare: true})store := newDualStore(t, repo, algo)
- quarantiner := any(store).(objectstore.WriterQuarantiner)
+ quarantiner := any(store).(objectstore.Quarantiner)
quarantine, err := quarantiner.BeginQuarantine(objectstore.QuarantineOptions{}) if err != nil { t.Fatalf("BeginQuarantine: %v", err)--- a/object/store/dual/quarantine.go
+++ b/object/store/dual/quarantine.go
@@ -19,7 +19,7 @@
var (
_ objectstore.ObjectQuarantine = (*quarantine)(nil)
_ objectstore.PackQuarantine = (*quarantine)(nil)
- _ objectstore.WriterQuarantine = (*quarantine)(nil)
+ _ objectstore.Quarantine = (*quarantine)(nil)
)
func newQuarantine(
--- a/object/store/dual/quarantine_begin.go
+++ b/object/store/dual/quarantine_begin.go
@@ -5,7 +5,7 @@
// BeginQuarantine creates one coordinated dual quarantine spanning both stores.
//
// Labels: Deps-Borrowed, Life-Parent, Close-No.
-func (dual *Dual) BeginQuarantine(opts objectstore.QuarantineOptions) (objectstore.WriterQuarantine, error) {+func (dual *Dual) BeginQuarantine(opts objectstore.QuarantineOptions) (objectstore.Quarantine, error) {objectQ, err := dual.object.BeginObjectQuarantine(opts.Object)
if err != nil {return nil, err
--- a/object/store/quarantine.go
+++ b/object/store/quarantine.go
@@ -1,17 +1,20 @@
package objectstore
-// Quarantine is one quarantined write. It is intended to be embedded.
+// WriterQuarantine represents one quarantined write that accepts both object-
+// wise and pack-wise writes.
type Quarantine interface {- // Reader exposes the objects written into this quarantine.
- Reader
+ BaseQuarantine
+ Writer
+}
- // Promote publishes quarantined writes into their final destination.
- //
- // Promote invalidates the receiver.
- Promote() error
+// QuarantineOptions controls the options for one coordinated quarantine creation.
+type QuarantineOptions struct {+ Object ObjectQuarantineOptions
+ Pack PackQuarantineOptions
+}
- // Discard abandons quarantined writes.
- //
- // Discard invalidates the receiver.
- Discard() error
+// WriterQuarantiner creates coordinated quarantines that support both object-
+// wise and pack-wise writes.
+type Quarantiner interface {+ BeginQuarantine(opts QuarantineOptions) (Quarantine, error)
}
--- a/object/store/quarantine_writer.go
+++ /dev/null
@@ -1,21 +1,0 @@
-package objectstore
-
-// WriterQuarantine represents one quarantined write that accepts both object-
-// wise and pack-wise writes.
-type WriterQuarantine interface {- Quarantine
- ObjectWriter
- PackWriter
-}
-
-// QuarantineOptions controls the options for one coordinated quarantine creation.
-type QuarantineOptions struct {- Object ObjectQuarantineOptions
- Pack PackQuarantineOptions
-}
-
-// WriterQuarantiner creates coordinated quarantines that support both object-
-// wise and pack-wise writes.
-type WriterQuarantiner interface {- BeginQuarantine(opts QuarantineOptions) (WriterQuarantine, error)
-}
--- /dev/null
+++ b/object/store/writer.go
@@ -1,0 +1,8 @@
+package objectstore
+
+// Writer represents a store that could perform both pack ingestions
+// and individual object writes.
+type Writer interface {+ PackWriter
+ ObjectWriter
+}
--- a/object/store/writer_object.go
+++ b/object/store/writer_object.go
@@ -24,7 +24,7 @@
// ObjectQuarantine represents one quarantined object-wise write.
type ObjectQuarantine interface {- Quarantine
+ BaseQuarantine
ObjectWriter
}
--- a/object/store/writer_pack.go
+++ b/object/store/writer_pack.go
@@ -45,7 +45,7 @@
// PackQuarantine represents one quarantined pack-wise write.
type PackQuarantine interface {- Quarantine
+ BaseQuarantine
PackWriter
}
--
⑨