diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-23 02:31:04 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-23 02:31:04 -0700 |
| commit | 30ee4f3291d5f94d6d41f54915b8c3860bf0c05e (patch) | |
| tree | 6f07a558d4ea0ac6eced2c1653399a979d175970 /weed/shell/commands.go | |
| parent | 77873b832be692a791c3b17b079a0d14bd317bcd (diff) | |
| download | seaweedfs-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.go | 5 |
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) { |
