Add CompressedSize method to ToChunker

This commit is contained in:
Neil Macneale IV
2025-08-25 17:27:48 -07:00
parent 75c0622ffd
commit 0c99218bcf
2 changed files with 9 additions and 3 deletions
+5
View File
@@ -99,3 +99,8 @@ func (a ArchiveToChunker) IsGhost() bool {
// archives are never ghosts. They are only instantiated when the chunk is found.
return false
}
// CompressedSize returns the size of the compressed chunk data, but does not include the size of the dictionary.
func (a ArchiveToChunker) CompressedSize() uint32 {
return uint32(len(a.chunkData))
}
+4 -3
View File
@@ -42,6 +42,7 @@ type ToChunker interface {
Hash() hash.Hash
ToChunk() (chunks.Chunk, error)
IsEmpty() bool
CompressedSize() uint32
IsGhost() bool
}
@@ -118,9 +119,9 @@ func (cmp CompressedChunk) IsGhost() bool {
return cmp.ghost
}
// CompressedSize returns the size of this CompressedChunk.
func (cmp CompressedChunk) CompressedSize() int {
return len(cmp.CompressedData)
// CompressedSize returns on disk size of the compressed chunk. Includes crc.
func (cmp CompressedChunk) CompressedSize() uint32 {
return uint32(len(cmp.FullCompressedChunk))
}
var EmptyCompressedChunk CompressedChunk