-
Notifications
You must be signed in to change notification settings - Fork 342
/
wrappers.go
53 lines (42 loc) · 1.03 KB
/
wrappers.go
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
package committed
import "github.com/treeverse/lakefs/pkg/graveler"
func NewIteratorWrapper(iter graveler.ValueIterator) Iterator {
return &IteratorWrapper{ValueIterator: iter}
}
type IteratorWrapper struct {
graveler.ValueIterator
err error
}
func (i *IteratorWrapper) NextRange() bool {
i.err = ErrNoRange
return false
}
func (i *IteratorWrapper) Err() error {
if i.err != nil {
return i.err
}
return i.ValueIterator.Err()
}
func (i *IteratorWrapper) Value() (*graveler.ValueRecord, *Range) {
return i.ValueIterator.Value(), nil
}
func NewDiffIteratorWrapper(iter graveler.DiffIterator) DiffIterator {
return &DiffIteratorWrapper{DiffIterator: iter}
}
type DiffIteratorWrapper struct {
graveler.DiffIterator
err error
}
func (d *DiffIteratorWrapper) NextRange() bool {
d.err = ErrNoRange
return false
}
func (d *DiffIteratorWrapper) Value() (*graveler.Diff, *RangeDiff) {
return d.DiffIterator.Value(), nil
}
func (d *DiffIteratorWrapper) Err() error {
if d.err != nil {
return d.err
}
return d.DiffIterator.Err()
}