Write chunk log
This commit is contained in:
parent
b6a277ddd1
commit
a5a78c786a
|
@ -4,6 +4,7 @@ package main
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -67,5 +68,17 @@ func putFileChunk(fileId string, start int64, end int64, r io.Reader) error {
|
|||
return errors.New("putFileChunk: partial copy")
|
||||
}
|
||||
|
||||
l := logPath(fileId)
|
||||
logFile, err := os.OpenFile(l, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer logFile.Close()
|
||||
|
||||
entry := fmt.Sprintf("%d,%d\n", start, end)
|
||||
if _, err := logFile.WriteString(entry); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue