From b25adcf0dee726cadc7c41695b3fc2b69a025882 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 7 Jun 2026 18:17:40 +0000 Subject: object/store: Add coordinated quarantiner --- object/store/quarantiner.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'object') diff --git a/object/store/quarantiner.go b/object/store/quarantiner.go index 45c3a1c8..19fbdc0c 100644 --- a/object/store/quarantiner.go +++ b/object/store/quarantiner.go @@ -8,6 +8,12 @@ type QuarantineBase interface { // Promote publishes quarantined writes into their final destination. // + // Promote is not atomic. + // Because objects are content-addressed and immutable, + // a partial promotion is safe: + // it only makes some objects visible early, + // which is harmless until a ref references them. + // // Promote invalidates the receiver. Promote() error @@ -48,3 +54,23 @@ type PackQuarantineOptions struct{} type PackQuarantiner interface { BeginPackQuarantine(opts PackQuarantineOptions) (PackQuarantine, error) } + +// CoordinatedQuarantineOptions controls the options +// for one coordinated quarantine creation. +type CoordinatedQuarantineOptions struct { + Object ObjectQuarantineOptions + Pack PackQuarantineOptions +} + +// CoordinatedQuarantiner creates coordinated quarantines +// that accept both object-wise and pack-wise writes +// behind a single Promote/Discard. +// +// The returned quarantine is usable +// anywhere either split quarantine is expected. +type CoordinatedQuarantiner interface { + BeginCoordinatedQuarantine(opts CoordinatedQuarantineOptions) (interface { + ObjectQuarantine + PackQuarantine + }, error) +} -- cgit v1.3.1-10-gc9f91