diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-27 23:49:46 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-28 00:05:57 -0700 |
| commit | 5c57297bd1baf6ddfe94db87a426c2bd9e88ab4b (patch) | |
| tree | cce07973a7d99c77bb336f20df7bf66364f69b30 /weed/command | |
| parent | 47c4a62c5db8564d036cc96c2f4a097494a2567a (diff) | |
| download | seaweedfs-5c57297bd1baf6ddfe94db87a426c2bd9e88ab4b.tar.xz seaweedfs-5c57297bd1baf6ddfe94db87a426c2bd9e88ab4b.zip | |
metadata log: read from any timestamp
Diffstat (limited to 'weed/command')
| -rw-r--r-- | weed/command/watch.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/command/watch.go b/weed/command/watch.go index 966040fbb..b46707a62 100644 --- a/weed/command/watch.go +++ b/weed/command/watch.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io" + "time" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" @@ -26,6 +27,7 @@ var cmdWatch = &Command{ var ( watchFiler = cmdWatch.Flag.String("filer", "localhost:8888", "filer hostname:port") watchTarget = cmdWatch.Flag.String("pathPrefix", "/", "path to a folder or file, or common prefix for the folders or files on filer") + watchStart = cmdWatch.Flag.Duration("timeAgo", 0, "start time before now. \"300ms\", \"1.5h\" or \"2h45m\". Valid time units are \"ns\", \"us\" (or \"µs\"), \"ms\", \"s\", \"m\", \"h\"") ) func runWatch(cmd *Command, args []string) bool { @@ -37,7 +39,7 @@ func runWatch(cmd *Command, args []string) bool { stream, err := client.SubscribeMetadata(context.Background(), &filer_pb.SubscribeMetadataRequest{ ClientName: "watch", PathPrefix: *watchTarget, - SinceNs: 0, + SinceNs: time.Now().Add(-*watchStart).UnixNano(), }) if err != nil { return fmt.Errorf("listen: %v", err) |
