@@ -20,49 +20,9 @@ import (
2020 "math/bits"
2121
2222 "github.com/RoaringBitmap/roaring"
23- )
24-
25- // Bitmap defines the methods to store and iterate the CBT bitmap
26- type Bitmap interface {
27- // Set sets bits within the provided range
28- Set (uint64 , uint64 )
29-
30- // SetFull sets all bits to the bitmap
31- SetFull ()
32-
33- // Snapshot returns snapshot of the bitmap
34- Snapshot () string
35-
36- // ChangeID returns the changeID of the bitmap
37- ChangeID () string
38-
39- // VolumeID return ID of the volume from which the snapshot is taken
40- VolumeID () string
41-
42- // Iterator returns the iterator for the CBT Bitmap
43- Iterator () Iterator
44- }
4523
46- // Iterator defines the methods to iterate the CBT bitmap and query the associated information
47- type Iterator interface {
48- // ChangeID returns the changeID of the bitmap
49- ChangeID () string
50-
51- // Snapshot returns snapshot of the bitmap
52- Snapshot () string
53-
54- // VolumeID return ID of the volume from which the snapshot is taken
55- VolumeID () string
56-
57- // BlockSize returns the granularity of the bitmap
58- BlockSize () uint
59-
60- // Count returns the toal number of count in the bitmap
61- Count () uint64
62-
63- // Next returns the offset of the next set block and whether it comes to the end of the iteration
64- Next () (uint64 , bool )
65- }
24+ "github.com/vmware-tanzu/velero/pkg/uploader/cbt/types"
25+ )
6626
6727const (
6828 InvalidOffset64 = ^ uint64 (0 )
@@ -83,7 +43,7 @@ type bitmapIterator struct {
8343 iterator roaring.IntPeekable
8444}
8545
86- func NewBitmap (blockSize uint , length uint64 , snapshot string , changeID string , volumeID string ) Bitmap {
46+ func NewBitmap (blockSize uint , length uint64 , snapshot string , changeID string , volumeID string ) types. Bitmap {
8747 return & bitmapImpl {
8848 bitmap : roaring .New (),
8949 blockSize : blockSize ,
@@ -105,14 +65,14 @@ func (c *bitmapImpl) Set(offset, length uint64) {
10565 }
10666
10767 start := offset >> c .blockSizeLog
108- end := uint64 (( offset + length + uint64 (c .blockSize ) - 1 ) >> c .blockSizeLog )
68+ end := ( offset + length + uint64 (c .blockSize ) - 1 ) >> c .blockSizeLog
10969
11070 c .bitmap .AddRange (start , end )
11171}
11272
11373func (c * bitmapImpl ) SetFull () {
11474 start := uint64 (0 )
115- end := uint64 (( c .length + uint64 (c .blockSize ) - 1 ) >> c .blockSizeLog )
75+ end := ( c .length + uint64 (c .blockSize ) - 1 ) >> c .blockSizeLog
11676
11777 c .bitmap .AddRange (start , end )
11878}
@@ -129,7 +89,7 @@ func (c *bitmapImpl) VolumeID() string {
12989 return c .volumeID
13090}
13191
132- func (c * bitmapImpl ) Iterator () Iterator {
92+ func (c * bitmapImpl ) Iterator () types. Iterator {
13393 if c .bitmap == nil {
13494 return nil
13595 }
0 commit comments