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