aboutsummaryrefslogtreecommitdiff
path: root/weed/filer2/entry_codec.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-08-13 01:20:49 -0700
committerChris Lu <chris.lu@gmail.com>2018-08-13 01:20:49 -0700
commitf036ef8a3c50af3c933dcd96026ca70dc5fd0da3 (patch)
treec4bc38f75396b44476d8cdaad28b6180af3c6291 /weed/filer2/entry_codec.go
parent75d63db60d1677f2e3350c3ee2b9dbecf931ec1a (diff)
downloadseaweedfs-f036ef8a3c50af3c933dcd96026ca70dc5fd0da3.tar.xz
seaweedfs-f036ef8a3c50af3c933dcd96026ca70dc5fd0da3.zip
add filer notification
Diffstat (limited to 'weed/filer2/entry_codec.go')
-rw-r--r--weed/filer2/entry_codec.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/weed/filer2/entry_codec.go b/weed/filer2/entry_codec.go
index 671568b75..baa6a9440 100644
--- a/weed/filer2/entry_codec.go
+++ b/weed/filer2/entry_codec.go
@@ -63,3 +63,25 @@ func PbToEntryAttribute(attr *filer_pb.FuseAttributes) Attr {
return t
}
+
+func EqualEntry(a, b *Entry) bool {
+ if a == b {
+ return true
+ }
+ if a == nil && b != nil || a != nil && b == nil {
+ return false
+ }
+ if !proto.Equal(EntryAttributeToPb(a), EntryAttributeToPb(b)) {
+ return false
+ }
+ if len(a.Chunks) != len(b.Chunks) {
+ return false
+ }
+
+ for i := 0; i < len(a.Chunks); i++ {
+ if !proto.Equal(a.Chunks[i], b.Chunks[i]) {
+ return false
+ }
+ }
+ return true
+}