This commit is contained in:
Chris Lu
2020-08-29 22:28:33 -07:00
parent ef75ce8a34
commit 99ecf63276
16 changed files with 64 additions and 68 deletions

View File

@@ -24,7 +24,7 @@ const (
type Needle struct {
Cookie Cookie `comment:"random number to mitigate brute force lookups"`
Id NeedleId `comment:"needle id"`
Size Size `comment:"sum of DataSize,Data,NameSize,Name,MimeSize,Mime"`
Size Size `comment:"sum of DataSize,Data,NameSize,Name,MimeSize,Mime"`
DataSize uint32 `comment:"Data size"` //version2
Data []byte `comment:"The actual file data"`

View File

@@ -18,7 +18,7 @@ const SectionalNeedleIdLimit = 1<<32 - 1
type SectionalNeedleValue struct {
Key SectionalNeedleId
OffsetLower OffsetLower `comment:"Volume offset"` //since aligned to 8 bytes, range is 4G*8=32G
Size Size `comment:"Size of the data portion"`
Size Size `comment:"Size of the data portion"`
}
type SectionalNeedleValueExtra struct {
@@ -116,7 +116,7 @@ func (cs *CompactSection) deleteOverflowEntry(key SectionalNeedleId) {
})
if deleteCandidate != length && cs.overflow[deleteCandidate].Key == key {
if cs.overflow[deleteCandidate].Size.IsValid() {
cs.overflow[deleteCandidate].Size = - cs.overflow[deleteCandidate].Size
cs.overflow[deleteCandidate].Size = -cs.overflow[deleteCandidate].Size
}
}
}

View File

@@ -9,7 +9,7 @@ import (
type NeedleValue struct {
Key NeedleId
Offset Offset `comment:"Volume offset"` //since aligned to 8 bytes, range is 4G*8=32G
Size Size `comment:"Size of the data portion"`
Size Size `comment:"Size of the data portion"`
}
func (this NeedleValue) Less(than btree.Item) bool {

View File

@@ -18,7 +18,7 @@ func (s Size) IsDeleted() bool {
return s < 0 || s == TombstoneFileSize
}
func (s Size) IsValid() bool {
return s >0 && s != TombstoneFileSize
return s > 0 && s != TombstoneFileSize
}
type OffsetLower struct {