aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/commands.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-04-23 02:31:04 -0700
committerChris Lu <chris.lu@gmail.com>2020-04-23 02:31:04 -0700
commit30ee4f3291d5f94d6d41f54915b8c3860bf0c05e (patch)
tree6f07a558d4ea0ac6eced2c1653399a979d175970 /weed/shell/commands.go
parent77873b832be692a791c3b17b079a0d14bd317bcd (diff)
downloadseaweedfs-30ee4f3291d5f94d6d41f54915b8c3860bf0c05e.tar.xz
seaweedfs-30ee4f3291d5f94d6d41f54915b8c3860bf0c05e.zip
add exclusive lock library on shell
Diffstat (limited to 'weed/shell/commands.go')
-rw-r--r--weed/shell/commands.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/shell/commands.go b/weed/shell/commands.go
index 96343971a..2faba4280 100644
--- a/weed/shell/commands.go
+++ b/weed/shell/commands.go
@@ -28,6 +28,7 @@ type CommandEnv struct {
env map[string]string
MasterClient *wdclient.MasterClient
option ShellOptions
+ locker *ExclusiveLocker
}
type command interface {
@@ -41,11 +42,13 @@ var (
)
func NewCommandEnv(options ShellOptions) *CommandEnv {
- return &CommandEnv{
+ ce := &CommandEnv{
env: make(map[string]string),
MasterClient: wdclient.NewMasterClient(options.GrpcDialOption, pb.AdminShellClient, "", 0, strings.Split(*options.Masters, ",")),
option: options,
}
+ ce.locker = NewExclusiveLocker(ce.MasterClient)
+ return ce
}
func (ce *CommandEnv) parseUrl(input string) (path string, err error) {