do not expose internal offset
This commit is contained in:
chrislu
2022-01-22 06:34:29 -08:00
parent 02d0c12cdd
commit 1ee828b768
2 changed files with 4 additions and 4 deletions

View File

@@ -57,14 +57,13 @@ func (cw *UploadPipeline) SaveDataAt(p []byte, off int64) (n int) {
defer cw.writableChunksLock.Unlock()
logicChunkIndex := LogicChunkIndex(off / cw.ChunkSize)
offsetRemainder := off % cw.ChunkSize
memChunk, found := cw.writableChunks[logicChunkIndex]
if !found {
memChunk = NewMemChunk(logicChunkIndex, cw.ChunkSize)
cw.writableChunks[logicChunkIndex] = memChunk
}
n = memChunk.WriteDataAt(p, offsetRemainder)
n = memChunk.WriteDataAt(p, off)
cw.maybeMoveToSealed(memChunk, logicChunkIndex)
return