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/filer/entry.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/filer/entry.go')
| -rw-r--r-- | weed/filer/entry.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/filer/entry.go b/weed/filer/entry.go index 8c28c8513..2062401f7 100644 --- a/weed/filer/entry.go +++ b/weed/filer/entry.go @@ -46,7 +46,7 @@ type Entry struct { } func (entry *Entry) Size() uint64 { - return maxUint64(maxUint64(TotalSize(entry.Chunks), entry.FileSize), uint64(len(entry.Content))) + return maxUint64(maxUint64(TotalSize(entry.GetChunks()), entry.FileSize), uint64(len(entry.Content))) } func (entry *Entry) Timestamp() time.Time { @@ -91,7 +91,7 @@ func (entry *Entry) ToExistingProtoEntry(message *filer_pb.Entry) { } message.IsDirectory = entry.IsDirectory() message.Attributes = EntryAttributeToPb(entry) - message.Chunks = entry.Chunks + message.Chunks = entry.GetChunks() message.Extended = entry.Extended message.HardLinkId = entry.HardLinkId message.HardLinkCounter = entry.HardLinkCounter @@ -123,6 +123,10 @@ func (entry *Entry) ToProtoFullEntry() *filer_pb.FullEntry { } } +func (entry *Entry) GetChunks() []*filer_pb.FileChunk { + return entry.Chunks +} + func FromPbEntry(dir string, entry *filer_pb.Entry) *Entry { t := &Entry{} t.FullPath = util.NewFullPath(dir, entry.Name) |
