diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-08 23:58:41 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-08 23:58:41 +0200 |
commit | 3b1baea2dd9353f42b3a9d93f6bc92ecbe9f4f01 (patch) | |
tree | d255b7e6edbcbaba1f98cf0c666a82c0f9750019 /formats/idxfile/idxfile.go | |
parent | 2293a3dbda0a96f5cbac851bb73e1e675417e4f3 (diff) | |
download | go-git-3b1baea2dd9353f42b3a9d93f6bc92ecbe9f4f01.tar.gz |
format: packfile based on ObjectStorage and CRC32 calculation
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 { |