diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-01-11 00:03:13 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-01-11 00:03:13 -0800 |
| commit | 62ee484d12c2753402e67a4a8ba8490324e4731b (patch) | |
| tree | 3c611ed1d3d90a4945d5b43a53860aa8e50335db | |
| parent | 1efb51ba843d809df5617cf9c1c288b7af5d10d4 (diff) | |
| download | seaweedfs-62ee484d12c2753402e67a4a8ba8490324e4731b.tar.xz seaweedfs-62ee484d12c2753402e67a4a8ba8490324e4731b.zip | |
refactoring
| -rw-r--r-- | weed/command/watch.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/command/watch.go b/weed/command/watch.go index fd7dd6fb2..431a326d7 100644 --- a/weed/command/watch.go +++ b/weed/command/watch.go @@ -76,6 +76,10 @@ func runWatch(cmd *Command, args []string) bool { return false } + eachEntryFunc := func(resp *filer_pb.SubscribeMetadataResponse) { + fmt.Printf("dir:%s %+v\n", resp.Directory, resp.EventNotification) + } + watchErr := pb.WithFilerClient(*watchFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { ctx, cancel := context.WithCancel(context.Background()) @@ -101,7 +105,7 @@ func runWatch(cmd *Command, args []string) bool { if !shouldPrint(resp) { continue } - fmt.Printf("dir:%s %+v\n", resp.Directory, resp.EventNotification) + eachEntryFunc(resp) } }) |
