diff options
| author | chrislu <chris.lu@gmail.com> | 2022-11-15 06:33:36 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-11-15 06:33:36 -0800 |
| commit | 70a4c98b00d811c01289f26d3602992a0d3f45e1 (patch) | |
| tree | 8d650eb24623e503ec03ccf45a73f3e61afdbe65 /weed/server/filer_grpc_server.go | |
| parent | 371972a1c212205b51391c17c064e9ea452fee17 (diff) | |
| download | seaweedfs-70a4c98b00d811c01289f26d3602992a0d3f45e1.tar.xz seaweedfs-70a4c98b00d811c01289f26d3602992a0d3f45e1.zip | |
refactor filer_pb.Entry and filer.Entry to use GetChunks()
for later locking on reading chunks
Diffstat (limited to 'weed/server/filer_grpc_server.go')
| -rw-r--r-- | weed/server/filer_grpc_server.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go index 5b07ace07..05ebb31a8 100644 --- a/weed/server/filer_grpc_server.go +++ b/weed/server/filer_grpc_server.go @@ -203,14 +203,14 @@ func (fs *FilerServer) cleanupChunks(fullpath string, existingEntry *filer.Entry // remove old chunks if not included in the new ones if existingEntry != nil { - garbage, err = filer.MinusChunks(fs.lookupFileId, existingEntry.Chunks, newEntry.Chunks) + garbage, err = filer.MinusChunks(fs.lookupFileId, existingEntry.GetChunks(), newEntry.GetChunks()) if err != nil { - return newEntry.Chunks, nil, fmt.Errorf("MinusChunks: %v", err) + return newEntry.GetChunks(), nil, fmt.Errorf("MinusChunks: %v", err) } } // files with manifest chunks are usually large and append only, skip calculating covered chunks - manifestChunks, nonManifestChunks := filer.SeparateManifestChunks(newEntry.Chunks) + manifestChunks, nonManifestChunks := filer.SeparateManifestChunks(newEntry.GetChunks()) chunks, coveredChunks := filer.CompactFileChunks(fs.lookupFileId, nonManifestChunks) garbage = append(garbage, coveredChunks...) @@ -256,7 +256,7 @@ func (fs *FilerServer) AppendToEntry(ctx context.Context, req *filer_pb.AppendTo }, } } else { - offset = int64(filer.TotalSize(entry.Chunks)) + offset = int64(filer.TotalSize(entry.GetChunks())) } for _, chunk := range req.Chunks { @@ -264,13 +264,13 @@ func (fs *FilerServer) AppendToEntry(ctx context.Context, req *filer_pb.AppendTo offset += int64(chunk.Size) } - entry.Chunks = append(entry.Chunks, req.Chunks...) + entry.Chunks = append(entry.GetChunks(), req.Chunks...) so, err := fs.detectStorageOption(string(fullpath), "", "", entry.TtlSec, "", "", "", "") if err != nil { glog.Warningf("detectStorageOption: %v", err) return &filer_pb.AppendToEntryResponse{}, err } - entry.Chunks, err = filer.MaybeManifestize(fs.saveAsChunk(so), entry.Chunks) + entry.Chunks, err = filer.MaybeManifestize(fs.saveAsChunk(so), entry.GetChunks()) if err != nil { // not good, but should be ok glog.V(0).Infof("MaybeManifestize: %v", err) |
