aboutsummaryrefslogtreecommitdiff
path: root/object/store/quarantiner.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-04-02 08:16:04 +0000
committerGravatar Runxi Yu2026-04-02 08:16:04 +0000
commit510a6a3d09d6fc010fecc0d87e6d838fecc3a6df (patch)
treede753fab31de495f682e46f4f10d71518a63c6cf /object/store/quarantiner.go
parentfurgit: Fix doc whitespace (diff)
signatureNo signature
object/store: Add interfaces
Diffstat (limited to 'object/store/quarantiner.go')
-rw-r--r--object/store/quarantiner.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/object/store/quarantiner.go b/object/store/quarantiner.go
new file mode 100644
index 00000000..4a2b7e02
--- /dev/null
+++ b/object/store/quarantiner.go
@@ -0,0 +1,70 @@
+package store
+
+// QuarantineBase is one quarantined write.
+// It is intended to be embedded.
+type QuarantineBase 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
+}
+
+// Quarantine represents one quarantined write
+// that accepts both object-wise and pack-wise writes.
+type Quarantine interface {
+ QuarantineBase
+ Writer
+}
+
+// QuarantineOptions controls the options
+// for one coordinated quarantine creation.
+type QuarantineOptions struct {
+ Object ObjectQuarantineOptions
+ Pack PackQuarantineOptions
+}
+
+// Quarantiner creates coordinated quarantines
+// that accept both object-wise and pack-wise writes.
+type Quarantiner interface {
+ BeginQuarantine(opts QuarantineOptions) (Quarantine, error)
+}
+
+// ObjectQuarantine represents one quarantined object-wise write.
+type ObjectQuarantine interface {
+ QuarantineBase
+ ObjectWriter
+}
+
+// ObjectQuarantineOptions controls the options
+// for one object quarantine creation.
+type ObjectQuarantineOptions struct{}
+
+// ObjectQuarantiner creates quarantines
+// for object-wise writes.
+type ObjectQuarantiner interface {
+ BeginObjectQuarantine(opts ObjectQuarantineOptions) (ObjectQuarantine, error)
+}
+
+// PackQuarantine represents one quarantined pack-wise write.
+type PackQuarantine interface {
+ QuarantineBase
+ PackWriter
+}
+
+// PackQuarantineOptions controls the options
+// for one pack quarantine creation.
+type PackQuarantineOptions struct{}
+
+// PackQuarantiner creates quarantines
+// for pack-wise writes.
+type PackQuarantiner interface {
+ BeginPackQuarantine(opts PackQuarantineOptions) (PackQuarantine, error)
+}