diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-01-05 15:16:39 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-01-05 15:16:39 -0800 |
| commit | d9f9aca453018c8decc1ab4882f0a6dd62bc2288 (patch) | |
| tree | cc4f155c243dd2dacebbdf7217f18aa50cadbdd9 /weed/filesys/file.go | |
| parent | 251b596bc535b2e6361c698c44960cdb0fbe017f (diff) | |
| download | seaweedfs-d9f9aca453018c8decc1ab4882f0a6dd62bc2288.tar.xz seaweedfs-d9f9aca453018c8decc1ab4882f0a6dd62bc2288.zip | |
refactoring
Diffstat (limited to 'weed/filesys/file.go')
| -rw-r--r-- | weed/filesys/file.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go index ce9ef3a80..e27cdd42e 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -173,3 +173,18 @@ func (file *File) maybeLoadAttributes(ctx context.Context) error { } return nil } + +func (file *File) addChunk(chunk *filer_pb.FileChunk) { + if chunk != nil { + file.addChunks([]*filer_pb.FileChunk{chunk}) + } +} + +func (file *File) addChunks(chunks []*filer_pb.FileChunk) { + for _, chunk := range chunks { + file.entry.Chunks = append(file.entry.Chunks, chunk) + file.entryViewCache = nil + glog.V(4).Infof("uploaded %s/%s to %s [%d,%d)", file.dir.Path, file.Name, chunk.FileId, chunk.Offset, chunk.Offset+int64(chunk.Size)) + } + file.entryViewCache = filer2.NonOverlappingVisibleIntervals(file.entry.Chunks) +} |
