diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-01 19:07:49 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-01 19:07:49 +0200 |
commit | 1dec2cdc84a6497c893d84485c6f94589f997215 (patch) | |
tree | 690a3a1601c54ea77878a9fae8429beac46c5919 /chunk.go | |
parent | db40818ef79ccb3f5f9232623f57ad284a4af7d0 (diff) | |
download | dna-backup-1dec2cdc84a6497c893d84485c6f94589f997215.tar.gz dna-backup-1dec2cdc84a6497c893d84485c6f94589f997215.zip |
Prepare for delta encoding
Diffstat (limited to 'chunk.go')
-rw-r--r-- | chunk.go | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -115,3 +115,20 @@ func (c *TempChunk) AppendFrom(r io.Reader) { } c.value = append(c.value, buff...) } + +type DeltaChunk struct { + repo *Repo + source *ChunkId + patch []byte + size int +} + +func (c *DeltaChunk) Reader() ChunkReader { + var buff bytes.Buffer + c.repo.Patcher().Patch(c.source.Reader(c.repo), &buff, bytes.NewReader(c.patch)) + return &buff +} + +func (c *DeltaChunk) Len() int { + return c.size +} |