-
Notifications
You must be signed in to change notification settings - Fork 342
/
diff_values.go
48 lines (39 loc) · 963 Bytes
/
diff_values.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
package committed
import (
"context"
"github.com/treeverse/lakefs/pkg/graveler"
)
// diffValuesIterator wraps a diffIterator in order to return only values
type diffValuesIterator struct {
rangeDiffIter DiffIterator
}
func NewDiffValueIterator(ctx context.Context, left Iterator, right Iterator) graveler.DiffIterator {
return &diffValuesIterator{
rangeDiffIter: NewDiffIterator(ctx, left, right),
}
}
func (d diffValuesIterator) Next() bool {
for d.rangeDiffIter.Next() {
if d.rangeDiffIter.Err() != nil {
return false
}
val, _ := d.rangeDiffIter.Value()
if val != nil {
return true
}
}
return false
}
func (d diffValuesIterator) SeekGE(id graveler.Key) {
d.rangeDiffIter.SeekGE(id)
}
func (d diffValuesIterator) Value() *graveler.Diff {
val, _ := d.rangeDiffIter.Value()
return val
}
func (d diffValuesIterator) Err() error {
return d.rangeDiffIter.Err()
}
func (d diffValuesIterator) Close() {
d.rangeDiffIter.Close()
}