mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-04 02:57:44 +01:00
compare chunks by timestamp
This commit is contained in:
1 parent
569bc7b54d
commit
d68b59ab4c
23 files changed
+138
-92
No files matched your search
@@ -381,7 +381,7 @@ func (fs *WebDavFileSystem) Stat(ctx context.Context, name string) (os.FileInfo,
|
||||
return fs.stat(ctx, name)
|
||||
}
|
||||
|
||||
func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64) (chunk *filer_pb.FileChunk, err error) {
|
||||
func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64, tsNs int64) (chunk *filer_pb.FileChunk, err error) {
|
||||
|
||||
fileId, uploadResult, flushErr, _ := operation.UploadWithRetry(
|
||||
f.fs,
|
||||
@@ -413,7 +413,7 @@ func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64
|
||||
glog.V(0).Infof("upload failure %v: %v", f.name, flushErr)
|
||||
return nil, fmt.Errorf("upload result: %v", uploadResult.Error)
|
||||
}
|
||||
return uploadResult.ToPbFileChunk(fileId, offset), nil
|
||||
return uploadResult.ToPbFileChunk(fileId, offset, tsNs), nil
|
||||
}
|
||||
|
||||
func (f *WebDavFile) Write(buf []byte) (int, error) {
|
||||
@@ -439,7 +439,7 @@ func (f *WebDavFile) Write(buf []byte) (int, error) {
|
||||
f.bufWriter.FlushFunc = func(data []byte, offset int64) (flushErr error) {
|
||||
|
||||
var chunk *filer_pb.FileChunk
|
||||
chunk, flushErr = f.saveDataAsChunk(util.NewBytesReader(data), f.name, offset)
|
||||
chunk, flushErr = f.saveDataAsChunk(util.NewBytesReader(data), f.name, offset, time.Now().UnixNano())
|
||||
|
||||
if flushErr != nil {
|
||||
return fmt.Errorf("%s upload result: %v", f.name, flushErr)
|
||||
|
||||
Reference in new issue
Block a user