mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
change from 'weed tail' to 'weed watch'
This commit is contained in:
parent
b10679fcf0
commit
af1f64d244
|
@ -24,7 +24,7 @@ var Commands = []*Command{
|
||||||
cmdScaffold,
|
cmdScaffold,
|
||||||
cmdServer,
|
cmdServer,
|
||||||
cmdShell,
|
cmdShell,
|
||||||
cmdTail,
|
cmdWatch,
|
||||||
cmdUpload,
|
cmdUpload,
|
||||||
cmdVersion,
|
cmdVersion,
|
||||||
cmdVolume,
|
cmdVolume,
|
||||||
|
|
|
@ -12,11 +12,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
cmdTail.Run = runTail // break init cycle
|
cmdWatch.Run = runWatch // break init cycle
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdTail = &Command{
|
var cmdWatch = &Command{
|
||||||
UsageLine: "tail <wip> [-filer=localhost:8888]",
|
UsageLine: "watch <wip> [-filer=localhost:8888] [-target=/]",
|
||||||
Short: "see recent changes on a filer",
|
Short: "see recent changes on a filer",
|
||||||
Long: `See recent changes on a filer.
|
Long: `See recent changes on a filer.
|
||||||
|
|
||||||
|
@ -24,19 +24,19 @@ var cmdTail = &Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
tailFiler = cmdTail.Flag.String("filer", "localhost:8888", "filer hostname:port")
|
watchFiler = cmdWatch.Flag.String("filer", "localhost:8888", "filer hostname:port")
|
||||||
tailTarget = cmdTail.Flag.String("target", "/", "a folder or file on filer")
|
watchTarget = cmdWatch.Flag.String("target", "/", "a folder or file on filer")
|
||||||
)
|
)
|
||||||
|
|
||||||
func runTail(cmd *Command, args []string) bool {
|
func runWatch(cmd *Command, args []string) bool {
|
||||||
|
|
||||||
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
|
||||||
|
|
||||||
tailErr := pb.WithFilerClient(*tailFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
watchErr := pb.WithFilerClient(*watchFiler, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
|
||||||
|
|
||||||
stream, err := client.ListenForEvents(context.Background(), &filer_pb.ListenForEventsRequest{
|
stream, err := client.ListenForEvents(context.Background(), &filer_pb.ListenForEventsRequest{
|
||||||
ClientName: "tail",
|
ClientName: "watch",
|
||||||
Directory: *tailTarget,
|
Directory: *watchTarget,
|
||||||
SinceNs: 0,
|
SinceNs: 0,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -55,8 +55,8 @@ func runTail(cmd *Command, args []string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
if tailErr != nil {
|
if watchErr != nil {
|
||||||
fmt.Printf("tail %s: %v\n", *tailFiler, tailErr)
|
fmt.Printf("watch %s: %v\n", *watchFiler, watchErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
Loading…
Reference in a new issue