1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
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.WriterQuarantine, error) {
return dual.beginQuarantine(opts)
}
// 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(opts objectstore.ObjectQuarantineOptions) (objectstore.ObjectQuarantine, error) {
quarantine, err := dual.beginQuarantine(objectstore.QuarantineOptions{
Object: opts,
})
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(opts objectstore.PackQuarantineOptions) (objectstore.PackQuarantine, error) {
quarantine, err := dual.beginQuarantine(objectstore.QuarantineOptions{
Pack: opts,
})
if err != nil {
return nil, err
}
return quarantine, nil
}
func (dual *Dual) beginQuarantine(opts objectstore.QuarantineOptions) (*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
}
|