aboutsummaryrefslogtreecommitdiff
path: root/object/store/dual/quarantine_begin.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-30 18:06:05 +0000
committerGravatar Runxi Yu2026-03-30 18:06:05 +0000
commitc3fe7af6cf267e6fafe5ab24cd2cc238e3ba3029 (patch)
tree41f241cb36f286b470e7db1164039aa76b4e6fd3 /object/store/dual/quarantine_begin.go
parentref/store: Remove ReadWriteStore (diff)
signatureNo signature
object/store/dual: Add a basic dual composr
Diffstat (limited to 'object/store/dual/quarantine_begin.go')
-rw-r--r--object/store/dual/quarantine_begin.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/object/store/dual/quarantine_begin.go b/object/store/dual/quarantine_begin.go
new file mode 100644
index 00000000..bca688b7
--- /dev/null
+++ b/object/store/dual/quarantine_begin.go
@@ -0,0 +1,47 @@
+package dual
+
+import objectstore "codeberg.org/lindenii/furgit/object/store"
+
+// TODO: This doesn't actually make sense. We need a combined quarantine.
+
+// BeginObjectQuarantine creates one coordinated dual quarantine spanning both
+// stores and returns it as an object-wise quarantine.
+//
+// Labels: Deps-Borrowed, Life-Parent, Close-No.
+func (dual *Dual) BeginObjectQuarantine(_ objectstore.ObjectQuarantineOptions) (objectstore.ObjectQuarantine, error) {
+ quarantine, err := dual.beginQuarantine()
+ if err != nil {
+ return nil, err
+ }
+
+ return quarantine, nil
+}
+
+// BeginPackQuarantine creates one coordinated dual quarantine spanning both
+// stores and returns it as a pack-wise quarantine.
+//
+// Labels: Deps-Borrowed, Life-Parent, Close-No.
+func (dual *Dual) BeginPackQuarantine(_ objectstore.PackQuarantineOptions) (objectstore.PackQuarantine, error) {
+ quarantine, err := dual.beginQuarantine()
+ if err != nil {
+ return nil, err
+ }
+
+ return quarantine, nil
+}
+
+func (dual *Dual) beginQuarantine() (*quarantine, error) {
+ objectQ, err := dual.object.BeginObjectQuarantine(objectstore.ObjectQuarantineOptions{})
+ if err != nil {
+ return nil, err
+ }
+
+ packQ, err := dual.pack.BeginPackQuarantine(objectstore.PackQuarantineOptions{})
+ if err != nil {
+ _ = objectQ.Discard()
+
+ return nil, err
+ }
+
+ return newQuarantine(objectQ, packQ), nil
+}