Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

refactoring

Chris Lu6e12a3a490fe
diff --git a/weed/command/watch.go b/weed/command/watch.go
index 431a326d70..8aad220192 100644
--- a/weed/command/watch.go
+++ b/weed/command/watch.go
@@ -76,8 +76,9 @@ func runWatch(cmd *Command, args []string) bool {
return false
}
- eachEntryFunc := func(resp *filer_pb.SubscribeMetadataResponse) {
+ eachEntryFunc := func(resp *filer_pb.SubscribeMetadataResponse) error {
fmt.Printf("dir:%s %+v\n", resp.Directory, resp.EventNotification)
+ return nil
}
watchErr := pb.WithFilerClient(*watchFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
@@ -105,7 +106,9 @@ func runWatch(cmd *Command, args []string) bool {
if !shouldPrint(resp) {
continue
}
- eachEntryFunc(resp)
+ if err = eachEntryFunc(resp); err != nil {
+ return err
+ }
}
})