aboutsummaryrefslogtreecommitdiff
path: root/object/store/dual/quarantine_begin.go
blob: 5c6bc934452e69c9233d9d095f0dec5cf1fd1cfe (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package dual

import objectstore "codeberg.org/lindenii/furgit/object/store"

// BeginQuarantine creates one coordinated dual quarantine spanning both stores.
//
// Labels: Deps-Borrowed, Life-Parent, Close-No.
func (dual *Dual) BeginQuarantine(opts objectstore.QuarantineOptions) (objectstore.Quarantine, error) {
	objectQ, err := dual.object.BeginObjectQuarantine(opts.Object)
	if err != nil {
		return nil, err
	}

	packQ, err := dual.pack.BeginPackQuarantine(opts.Pack)
	if err != nil {
		_ = objectQ.Discard()

		return nil, err
	}

	return newQuarantine(objectQ, packQ), nil
}