diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-09-01 19:07:35 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-09-01 19:07:35 +0200 |
commit | db40818ef79ccb3f5f9232623f57ad284a4af7d0 (patch) | |
tree | 6b1b1a7b6169eb19f6ca17ff87f1075b41bd513f /chunk.go | |
parent | 34a84a44b4dfa513d8ceb1cfeec50ac78fb311e0 (diff) | |
download | dna-backup-db40818ef79ccb3f5f9232623f57ad284a4af7d0.tar.gz dna-backup-db40818ef79ccb3f5f9232623f57ad284a4af7d0.zip |
move some consts into repo
Diffstat (limited to 'chunk.go')
-rw-r--r-- | chunk.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -34,13 +34,13 @@ func (i *ChunkId) Path(repo string) string { return path.Join(repo, fmt.Sprintf(versionFmt, i.Ver), chunksName, fmt.Sprintf(chunkIdFmt, i.Idx)) } -func (i *ChunkId) Reader(repo string) ChunkReader { - path := i.Path(repo) +func (i *ChunkId) Reader(repo *Repo) ChunkReader { + path := i.Path(repo.path) f, err := os.Open(path) if err != nil { log.Println("Cannot open chunk: ", path) } - return bufio.NewReaderSize(f, chunkSize) + return bufio.NewReaderSize(f, repo.chunkSize) } func NewLoadedChunk(id *ChunkId, value []byte) *LoadedChunk { @@ -80,7 +80,7 @@ func (c *ChunkFile) Id() *ChunkId { func (c *ChunkFile) Reader() ChunkReader { // log.Printf("Chunk %d: Reading from file\n", c.id) - return c.id.Reader(c.repo.path) + return c.id.Reader(c.repo) } func (c *ChunkFile) Len() int { |