hardlink works now

This commit is contained in:
Chris Lu
2020-09-24 03:06:44 -07:00
parent c7d7b1a0f6
commit 5e239afdfc
16 changed files with 882 additions and 461 deletions

View File

@@ -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
}