aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/entry_codec.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filer/entry_codec.go')
-rw-r--r--weed/filer/entry_codec.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/weed/filer/entry_codec.go b/weed/filer/entry_codec.go
index fb6448b30..21531ad7a 100644
--- a/weed/filer/entry_codec.go
+++ b/weed/filer/entry_codec.go
@@ -13,9 +13,11 @@ import (
func (entry *Entry) EncodeAttributesAndChunks() ([]byte, error) {
message := &filer_pb.Entry{
- Attributes: EntryAttributeToPb(entry),
- Chunks: entry.Chunks,
- Extended: entry.Extended,
+ Attributes: EntryAttributeToPb(entry),
+ Chunks: entry.Chunks,
+ Extended: entry.Extended,
+ HardLinkId: int64(entry.HardLinkId),
+ HardLinkCounter: entry.HardLinkCounter,
}
return proto.Marshal(message)
}
@@ -34,6 +36,9 @@ func (entry *Entry) DecodeAttributesAndChunks(blob []byte) error {
entry.Chunks = message.Chunks
+ entry.HardLinkId = HardLinkId(message.HardLinkId)
+ entry.HardLinkCounter = message.HardLinkCounter
+
return nil
}
@@ -61,6 +66,10 @@ func PbToEntryAttribute(attr *filer_pb.FuseAttributes) Attr {
t := Attr{}
+ if attr == nil {
+ return t
+ }
+
t.Crtime = time.Unix(attr.Crtime, 0)
t.Mtime = time.Unix(attr.Mtime, 0)
t.Mode = os.FileMode(attr.FileMode)
@@ -106,6 +115,13 @@ func EqualEntry(a, b *Entry) bool {
return false
}
}
+
+ if a.HardLinkId != b.HardLinkId {
+ return false
+ }
+ if a.HardLinkCounter != b.HardLinkCounter {
+ return false
+ }
return true
}