Skip to content

Commit

Permalink
delete ttl and container node in multi command
Browse files Browse the repository at this point in the history
  • Loading branch information
einxie authored and pmazzini committed Jun 11, 2020
1 parent 74fff30 commit bee6a1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
8 changes: 2 additions & 6 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ func (c *Conn) CreateContainer(path string, data []byte, flags int32, acl []ACL)
return "", err
}
if flags&FlagTTL != FlagTTL {
return "", errors.New("flags not support container node")
return "", ErrInvalidFlags
}

res := &createResponse{}
Expand All @@ -1074,7 +1074,7 @@ func (c *Conn) CreateTTL(path string, data []byte, flags int32, acl []ACL, ttl i
return "", err
}
if flags&FlagTTL != FlagTTL {
return "", errors.New("flags not support ttl node")
return "", ErrInvalidFlags
}

res := &createResponse{}
Expand Down Expand Up @@ -1240,10 +1240,6 @@ func (c *Conn) Multi(ops ...interface{}) ([]MultiResponse, error) {
switch op.(type) {
case *CreateRequest:
opCode = opCreate
case *CreateContainerRequest:
opCode = opCreateContainer
case *CreateTTLRequest:
opCode = opCreateTTL
case *SetDataRequest:
opCode = opSetData
case *DeleteRequest:
Expand Down
1 change: 1 addition & 0 deletions constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ var (
ErrNotEmpty = errors.New("zk: node has children")
ErrSessionExpired = errors.New("zk: session has been expired by the server")
ErrInvalidACL = errors.New("zk: invalid ACL specified")
ErrInvalidFlags = errors.New("zk: invalid flags specified")
ErrAuthFailed = errors.New("zk: client authentication failed")
ErrClosing = errors.New("zk: zookeeper is closing")
ErrNothing = errors.New("zk: no server responsees to process")
Expand Down
6 changes: 1 addition & 5 deletions structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func (r *multiResponse) Decode(buf []byte) (int, error) {
return total, ErrAPIError
case opError:
w = reflect.ValueOf(&res.Err)
case opCreate, opCreateContainer, opCreateTTL:
case opCreate:
w = reflect.ValueOf(&res.String)
case opSetData:
res.Stat = new(Stat)
Expand Down Expand Up @@ -599,10 +599,6 @@ func requestStructForOp(op int32) interface{} {
return &closeRequest{}
case opCreate:
return &CreateRequest{}
case opCreateContainer:
return &CreateContainerRequest{}
case opCreateTTL:
return &CreateTTLRequest{}
case opDelete:
return &DeleteRequest{}
case opExists:
Expand Down

0 comments on commit bee6a1d

Please sign in to comment.