add exclusive lock library on shell

This commit is contained in:
Chris Lu
2020-04-23 02:31:04 -07:00
parent 77873b832b
commit 30ee4f3291
5 changed files with 257 additions and 179 deletions

View File

@@ -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) {