Log partial file writes
This commit is contained in:
parent
0f4b92b01d
commit
c8ab86ee3e
|
@ -43,14 +43,20 @@ func (s *DataStore) WriteFileChunk(id string, start int64, end int64, src io.Rea
|
||||||
}
|
}
|
||||||
|
|
||||||
size := end - start + 1
|
size := end - start + 1
|
||||||
if n, err := io.CopyN(file, src, size); err != nil {
|
n, err := io.CopyN(file, src, size)
|
||||||
|
if n > 0 {
|
||||||
|
entry := logEntry{Chunk: &chunkEntry{Start: start, End: n - 1}}
|
||||||
|
if err := s.appendFileLog(id, entry); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if n != size {
|
} else if n != size {
|
||||||
return errors.New("WriteFileChunk: partial copy")
|
return errors.New("WriteFileChunk: partial copy")
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
entry := logEntry{Chunk: &chunkEntry{Start: start, End: end}}
|
|
||||||
return s.appendFileLog(id, entry)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *DataStore) GetFileMeta(id string) (*fileMeta, error) {
|
func (s *DataStore) GetFileMeta(id string) (*fileMeta, error) {
|
||||||
|
|
Loading…
Reference in New Issue