aboutsummaryrefslogtreecommitdiff
path: root/chunk.go
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-13 15:23:32 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-13 15:25:11 +0200
commit3e0123b9d8a1097e74fcd500b72cbdaa00c7a49a (patch)
treee88736021d21463717011ab0771a3637697c0217 /chunk.go
parent7f65509f10704a0fbe2ad7e227eee1d0babc9c93 (diff)
downloaddna-backup-3e0123b9d8a1097e74fcd500b72cbdaa00c7a49a.tar.gz
dna-backup-3e0123b9d8a1097e74fcd500b72cbdaa00c7a49a.zip
fix loadChunks by using cache instead of reading file
This way there is only one place where we read chunks and where the read/write wrapper is used. This also allows to remove LoadedChunk as it is not used anymore.
Diffstat (limited to 'chunk.go')
-rw-r--r--chunk.go26
1 files changed, 0 insertions, 26 deletions
diff --git a/chunk.go b/chunk.go
index 0d84040..3efaf4a 100644
--- a/chunk.go
+++ b/chunk.go
@@ -36,32 +36,6 @@ func (i *ChunkId) Path(repo string) string {
return filepath.Join(repo, fmt.Sprintf(versionFmt, i.Ver), chunksName, fmt.Sprintf(chunkIdFmt, i.Idx))
}
-func NewLoadedChunk(id *ChunkId, value []byte) *LoadedChunk {
- return &LoadedChunk{Id: id, value: value}
-}
-
-type LoadedChunk struct {
- Id *ChunkId
- value []byte
-}
-
-func (c *LoadedChunk) GetId() *ChunkId {
- return c.Id
-}
-
-func (c *LoadedChunk) Reader() io.ReadSeeker {
- // log.Printf("Chunk %d: Reading from in-memory value\n", c.id)
- return bytes.NewReader(c.value)
-}
-
-func (c *LoadedChunk) Len() int {
- return len(c.value)
-}
-
-func (c *LoadedChunk) Bytes() []byte {
- return c.value
-}
-
func NewStoredChunk(repo *Repo, id *ChunkId) *StoredChunk {
return &StoredChunk{repo: repo, Id: id}
}