diff options
Diffstat (limited to 'formats/idxfile/idxfile.go')
-rw-r--r-- | formats/idxfile/idxfile.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/formats/idxfile/idxfile.go b/formats/idxfile/idxfile.go index 217027d..ce4c976 100644 --- a/formats/idxfile/idxfile.go +++ b/formats/idxfile/idxfile.go @@ -25,10 +25,18 @@ type Idxfile struct { // offset and CRC32 checksum. type Entry struct { Hash core.Hash - CRC32 [4]byte + CRC32 uint32 Offset uint64 } +func (idx *Idxfile) Add(h core.Hash, offset uint64, crc32 uint32) { + idx.Entries = append(idx.Entries, Entry{ + Hash: h, + Offset: offset, + CRC32: crc32, + }) +} + func (idx *Idxfile) isValid() bool { fanout := idx.calculateFanout() for k, c := range idx.Fanout { |