From 57d99b9aa4f346d8a6796bacaf41286a2678b4b7 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 13 Nov 2020 12:59:59 -0800 Subject: [PATCH] Created File Change Data Capture (markdown) --- File-Change-Data-Capture.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 File-Change-Data-Capture.md diff --git a/File-Change-Data-Capture.md b/File-Change-Data-Capture.md new file mode 100644 index 0000000..bb83ab0 --- /dev/null +++ b/File-Change-Data-Capture.md @@ -0,0 +1,19 @@ +Is it too much a dream to have something similar to [inotify](https://man7.org/linux/man-pages/man7/inotify.7.html) in a distributed file system? Not really! + +Actually SeaweedFS can give you more! + +Here is an example, in Java: + +https://github.com/chrislusf/seaweedfs/blob/master/other/java/examples/src/main/java/com/seaweedfs/examples/WatchFiles.java + +Basically there are four types of events to handle: +| Type | Directory | NewEntry | OldEntry | NewParentPath | +| -------| -------| -------| -------| -------| +| Create | exists | exists | null | equal to Directory | +| Update | exists | exists | exists | equal to Directory | +| Delete | exists | null | exists | equal to Directory | +| Rename | exists | exists | exists | not equal to Directory | + +This is based on Filer gRPC API. You should be able to easily implement it in your own language. + +https://github.com/chrislusf/seaweedfs/blob/master/weed/pb/filer.proto#L52 \ No newline at end of file