2016-08-13 07:16:09 +03:00
|
|
|
// Copyright 2016 The etcd Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package clientv3
|
|
|
|
|
|
|
|
import (
|
2017-09-07 00:57:25 +03:00
|
|
|
"context"
|
|
|
|
|
2016-08-24 02:07:03 +03:00
|
|
|
"github.com/coreos/etcd/etcdserver/api/v3rpc/rpctypes"
|
2016-08-13 07:16:09 +03:00
|
|
|
pb "github.com/coreos/etcd/etcdserver/etcdserverpb"
|
2017-09-07 00:57:25 +03:00
|
|
|
|
2016-08-13 07:16:09 +03:00
|
|
|
"google.golang.org/grpc"
|
2016-08-24 02:07:03 +03:00
|
|
|
"google.golang.org/grpc/codes"
|
2017-09-08 21:50:57 +03:00
|
|
|
"google.golang.org/grpc/status"
|
2016-08-13 07:16:09 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
type rpcFunc func(ctx context.Context) error
|
2017-10-19 21:26:28 +03:00
|
|
|
type retryRPCFunc func(context.Context, rpcFunc) error
|
2017-07-31 07:35:38 +03:00
|
|
|
type retryStopErrFunc func(error) bool
|
2016-08-13 07:16:09 +03:00
|
|
|
|
2017-07-31 07:35:38 +03:00
|
|
|
func isReadStopError(err error) bool {
|
|
|
|
eErr := rpctypes.Error(err)
|
|
|
|
// always stop retry on etcd errors
|
|
|
|
if _, ok := eErr.(rpctypes.EtcdError); ok {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
// only retry if unavailable
|
2017-09-08 21:50:57 +03:00
|
|
|
ev, _ := status.FromError(err)
|
|
|
|
return ev.Code() != codes.Unavailable
|
2017-07-31 07:35:38 +03:00
|
|
|
}
|
2016-10-23 07:40:10 +03:00
|
|
|
|
2017-07-31 07:35:38 +03:00
|
|
|
func isWriteStopError(err error) bool {
|
2017-09-08 21:50:57 +03:00
|
|
|
ev, _ := status.FromError(err)
|
|
|
|
if ev.Code() != codes.Unavailable {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return rpctypes.ErrorDesc(err) != "there is no address available"
|
2017-07-31 07:35:38 +03:00
|
|
|
}
|
2016-10-23 07:40:10 +03:00
|
|
|
|
2017-10-19 21:26:28 +03:00
|
|
|
func (c *Client) newRetryWrapper(isStop retryStopErrFunc) retryRPCFunc {
|
2017-07-31 07:35:38 +03:00
|
|
|
return func(rpcCtx context.Context, f rpcFunc) error {
|
|
|
|
for {
|
2017-10-19 22:52:10 +03:00
|
|
|
if err := readyWait(rpcCtx, c.ctx, c.balancer.ConnectNotify()); err != nil {
|
|
|
|
return err
|
2017-09-25 08:14:51 +03:00
|
|
|
}
|
2017-10-06 22:58:52 +03:00
|
|
|
pinned := c.balancer.pinned()
|
2017-09-12 07:05:53 +03:00
|
|
|
err := f(rpcCtx)
|
|
|
|
if err == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2017-10-06 19:50:36 +03:00
|
|
|
if logger.V(4) {
|
2017-10-19 21:26:28 +03:00
|
|
|
logger.Infof("clientv3/retry: error %q on pinned endpoint %q", err.Error(), pinned)
|
2017-10-06 19:50:36 +03:00
|
|
|
}
|
2017-10-07 16:22:56 +03:00
|
|
|
// mark this before endpoint switch is triggered
|
2017-10-19 21:26:28 +03:00
|
|
|
c.balancer.hostPortError(pinned, err)
|
2017-09-12 07:05:53 +03:00
|
|
|
if s, ok := status.FromError(err); ok && s.Code() == codes.Unavailable {
|
|
|
|
c.balancer.next()
|
|
|
|
}
|
|
|
|
if isStop(err) {
|
2017-01-04 18:59:10 +03:00
|
|
|
return err
|
|
|
|
}
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-19 21:26:28 +03:00
|
|
|
func (c *Client) newAuthRetryWrapper() retryRPCFunc {
|
2017-01-04 18:59:10 +03:00
|
|
|
return func(rpcCtx context.Context, f rpcFunc) error {
|
|
|
|
for {
|
2017-10-06 22:58:52 +03:00
|
|
|
pinned := c.balancer.pinned()
|
2017-01-04 18:59:10 +03:00
|
|
|
err := f(rpcCtx)
|
|
|
|
if err == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2017-10-06 19:50:36 +03:00
|
|
|
if logger.V(4) {
|
2017-10-19 21:26:28 +03:00
|
|
|
logger.Infof("clientv3/auth-retry: error %q on pinned endpoint %q", err.Error(), pinned)
|
2017-10-06 19:50:36 +03:00
|
|
|
}
|
2017-01-04 18:59:10 +03:00
|
|
|
// always stop retry on etcd errors other than invalid auth token
|
|
|
|
if rpctypes.Error(err) == rpctypes.ErrInvalidAuthToken {
|
|
|
|
gterr := c.getToken(rpcCtx)
|
|
|
|
if gterr != nil {
|
2017-10-19 21:26:28 +03:00
|
|
|
if logger.V(4) {
|
|
|
|
logger.Infof("clientv3/auth-retry: cannot retry due to error %q(%q) on pinned endpoint %q", err.Error(), gterr.Error(), pinned)
|
|
|
|
}
|
2017-01-04 18:59:10 +03:00
|
|
|
return err // return the original error for simplicity
|
|
|
|
}
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
2017-10-18 22:43:01 +03:00
|
|
|
// RetryKVClient implements a KVClient.
|
2016-08-13 07:16:09 +03:00
|
|
|
func RetryKVClient(c *Client) pb.KVClient {
|
2017-10-18 22:43:01 +03:00
|
|
|
repeatableRetry := c.newRetryWrapper(isReadStopError)
|
|
|
|
nonRepeatableRetry := c.newRetryWrapper(isWriteStopError)
|
2017-07-31 07:35:38 +03:00
|
|
|
conn := pb.NewKVClient(c.conn)
|
2017-10-18 22:43:01 +03:00
|
|
|
retryBasic := &retryKVClient{&nonRepeatableKVClient{conn, nonRepeatableRetry}, repeatableRetry}
|
2017-07-31 07:35:38 +03:00
|
|
|
retryAuthWrapper := c.newAuthRetryWrapper()
|
|
|
|
return &retryKVClient{
|
2017-10-18 22:43:01 +03:00
|
|
|
&nonRepeatableKVClient{retryBasic, retryAuthWrapper},
|
2017-07-31 07:35:38 +03:00
|
|
|
retryAuthWrapper}
|
2017-01-04 18:59:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
type retryKVClient struct {
|
2017-10-18 22:43:01 +03:00
|
|
|
*nonRepeatableKVClient
|
|
|
|
repeatableRetry retryRPCFunc
|
2017-01-04 18:59:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (rkv *retryKVClient) Range(ctx context.Context, in *pb.RangeRequest, opts ...grpc.CallOption) (resp *pb.RangeResponse, err error) {
|
2017-10-18 22:43:01 +03:00
|
|
|
err = rkv.repeatableRetry(ctx, func(rctx context.Context) error {
|
|
|
|
resp, err = rkv.kc.Range(rctx, in, opts...)
|
2017-01-04 18:59:10 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
2017-10-18 22:43:01 +03:00
|
|
|
type nonRepeatableKVClient struct {
|
|
|
|
kc pb.KVClient
|
|
|
|
nonRepeatableRetry retryRPCFunc
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
2017-10-18 22:43:01 +03:00
|
|
|
func (rkv *nonRepeatableKVClient) Put(ctx context.Context, in *pb.PutRequest, opts ...grpc.CallOption) (resp *pb.PutResponse, err error) {
|
|
|
|
err = rkv.nonRepeatableRetry(ctx, func(rctx context.Context) error {
|
|
|
|
resp, err = rkv.kc.Put(rctx, in, opts...)
|
2016-08-13 07:16:09 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
2017-10-18 22:43:01 +03:00
|
|
|
func (rkv *nonRepeatableKVClient) DeleteRange(ctx context.Context, in *pb.DeleteRangeRequest, opts ...grpc.CallOption) (resp *pb.DeleteRangeResponse, err error) {
|
|
|
|
err = rkv.nonRepeatableRetry(ctx, func(rctx context.Context) error {
|
|
|
|
resp, err = rkv.kc.DeleteRange(rctx, in, opts...)
|
2016-08-13 07:16:09 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
2017-10-18 22:43:01 +03:00
|
|
|
func (rkv *nonRepeatableKVClient) Txn(ctx context.Context, in *pb.TxnRequest, opts ...grpc.CallOption) (resp *pb.TxnResponse, err error) {
|
|
|
|
// TODO: repeatableRetry if read-only txn
|
|
|
|
err = rkv.nonRepeatableRetry(ctx, func(rctx context.Context) error {
|
|
|
|
resp, err = rkv.kc.Txn(rctx, in, opts...)
|
2016-08-13 07:16:09 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
2017-10-18 22:43:01 +03:00
|
|
|
func (rkv *nonRepeatableKVClient) Compact(ctx context.Context, in *pb.CompactionRequest, opts ...grpc.CallOption) (resp *pb.CompactionResponse, err error) {
|
|
|
|
err = rkv.nonRepeatableRetry(ctx, func(rctx context.Context) error {
|
|
|
|
resp, err = rkv.kc.Compact(rctx, in, opts...)
|
2016-08-13 07:16:09 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
type retryLeaseClient struct {
|
2017-10-20 01:02:19 +03:00
|
|
|
lc pb.LeaseClient
|
2017-10-20 00:58:54 +03:00
|
|
|
repeatableRetry retryRPCFunc
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
2017-10-18 23:11:16 +03:00
|
|
|
// RetryLeaseClient implements a LeaseClient.
|
2016-08-13 07:16:09 +03:00
|
|
|
func RetryLeaseClient(c *Client) pb.LeaseClient {
|
2017-07-31 07:35:38 +03:00
|
|
|
retry := &retryLeaseClient{
|
|
|
|
pb.NewLeaseClient(c.conn),
|
|
|
|
c.newRetryWrapper(isReadStopError),
|
|
|
|
}
|
|
|
|
return &retryLeaseClient{retry, c.newAuthRetryWrapper()}
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
2017-10-18 23:11:16 +03:00
|
|
|
func (rlc *retryLeaseClient) LeaseTimeToLive(ctx context.Context, in *pb.LeaseTimeToLiveRequest, opts ...grpc.CallOption) (resp *pb.LeaseTimeToLiveResponse, err error) {
|
2017-10-20 00:58:54 +03:00
|
|
|
err = rlc.repeatableRetry(ctx, func(rctx context.Context) error {
|
2017-10-20 01:02:19 +03:00
|
|
|
resp, err = rlc.lc.LeaseTimeToLive(rctx, in, opts...)
|
2017-10-18 23:11:16 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rlc *retryLeaseClient) LeaseLeases(ctx context.Context, in *pb.LeaseLeasesRequest, opts ...grpc.CallOption) (resp *pb.LeaseLeasesResponse, err error) {
|
2017-10-20 00:58:54 +03:00
|
|
|
err = rlc.repeatableRetry(ctx, func(rctx context.Context) error {
|
2017-10-20 01:02:19 +03:00
|
|
|
resp, err = rlc.lc.LeaseLeases(rctx, in, opts...)
|
2017-10-18 23:11:16 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
2016-08-13 07:16:09 +03:00
|
|
|
func (rlc *retryLeaseClient) LeaseGrant(ctx context.Context, in *pb.LeaseGrantRequest, opts ...grpc.CallOption) (resp *pb.LeaseGrantResponse, err error) {
|
2017-10-20 00:58:54 +03:00
|
|
|
err = rlc.repeatableRetry(ctx, func(rctx context.Context) error {
|
2017-10-20 01:02:19 +03:00
|
|
|
resp, err = rlc.lc.LeaseGrant(rctx, in, opts...)
|
2016-08-13 07:16:09 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rlc *retryLeaseClient) LeaseRevoke(ctx context.Context, in *pb.LeaseRevokeRequest, opts ...grpc.CallOption) (resp *pb.LeaseRevokeResponse, err error) {
|
2017-10-20 00:58:54 +03:00
|
|
|
err = rlc.repeatableRetry(ctx, func(rctx context.Context) error {
|
2017-10-20 01:02:19 +03:00
|
|
|
resp, err = rlc.lc.LeaseRevoke(rctx, in, opts...)
|
2016-08-13 07:16:09 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
2017-10-18 23:11:16 +03:00
|
|
|
func (rlc *retryLeaseClient) LeaseKeepAlive(ctx context.Context, opts ...grpc.CallOption) (stream pb.Lease_LeaseKeepAliveClient, err error) {
|
2017-10-20 00:58:54 +03:00
|
|
|
err = rlc.repeatableRetry(ctx, func(rctx context.Context) error {
|
2017-10-20 01:02:19 +03:00
|
|
|
stream, err = rlc.lc.LeaseKeepAlive(rctx, opts...)
|
2017-10-18 23:11:16 +03:00
|
|
|
return err
|
|
|
|
})
|
|
|
|
return stream, err
|
|
|
|
}
|
|
|
|
|
2016-08-13 07:16:09 +03:00
|
|
|
type retryClusterClient struct {
|
|
|
|
pb.ClusterClient
|
2017-10-19 21:26:28 +03:00
|
|
|
writeRetry retryRPCFunc
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// RetryClusterClient implements a ClusterClient that uses the client's FailFast retry policy.
|
|
|
|
func RetryClusterClient(c *Client) pb.ClusterClient {
|
2017-07-31 07:35:38 +03:00
|
|
|
return &retryClusterClient{pb.NewClusterClient(c.conn), c.newRetryWrapper(isWriteStopError)}
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (rcc *retryClusterClient) MemberAdd(ctx context.Context, in *pb.MemberAddRequest, opts ...grpc.CallOption) (resp *pb.MemberAddResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rcc.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rcc.ClusterClient.MemberAdd(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rcc *retryClusterClient) MemberRemove(ctx context.Context, in *pb.MemberRemoveRequest, opts ...grpc.CallOption) (resp *pb.MemberRemoveResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rcc.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rcc.ClusterClient.MemberRemove(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rcc *retryClusterClient) MemberUpdate(ctx context.Context, in *pb.MemberUpdateRequest, opts ...grpc.CallOption) (resp *pb.MemberUpdateResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rcc.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rcc.ClusterClient.MemberUpdate(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
type retryAuthClient struct {
|
|
|
|
pb.AuthClient
|
2017-10-19 21:26:28 +03:00
|
|
|
writeRetry retryRPCFunc
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// RetryAuthClient implements a AuthClient that uses the client's FailFast retry policy.
|
|
|
|
func RetryAuthClient(c *Client) pb.AuthClient {
|
2017-07-31 07:35:38 +03:00
|
|
|
return &retryAuthClient{pb.NewAuthClient(c.conn), c.newRetryWrapper(isWriteStopError)}
|
2016-08-13 07:16:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) AuthEnable(ctx context.Context, in *pb.AuthEnableRequest, opts ...grpc.CallOption) (resp *pb.AuthEnableResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.AuthEnable(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) AuthDisable(ctx context.Context, in *pb.AuthDisableRequest, opts ...grpc.CallOption) (resp *pb.AuthDisableResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.AuthDisable(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) UserAdd(ctx context.Context, in *pb.AuthUserAddRequest, opts ...grpc.CallOption) (resp *pb.AuthUserAddResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.UserAdd(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) UserDelete(ctx context.Context, in *pb.AuthUserDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthUserDeleteResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.UserDelete(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) UserChangePassword(ctx context.Context, in *pb.AuthUserChangePasswordRequest, opts ...grpc.CallOption) (resp *pb.AuthUserChangePasswordResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.UserChangePassword(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) UserGrantRole(ctx context.Context, in *pb.AuthUserGrantRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserGrantRoleResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.UserGrantRole(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) UserRevokeRole(ctx context.Context, in *pb.AuthUserRevokeRoleRequest, opts ...grpc.CallOption) (resp *pb.AuthUserRevokeRoleResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.UserRevokeRole(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) RoleAdd(ctx context.Context, in *pb.AuthRoleAddRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleAddResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.RoleAdd(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) RoleDelete(ctx context.Context, in *pb.AuthRoleDeleteRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleDeleteResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.RoleDelete(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) RoleGrantPermission(ctx context.Context, in *pb.AuthRoleGrantPermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleGrantPermissionResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.RoleGrantPermission(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rac *retryAuthClient) RoleRevokePermission(ctx context.Context, in *pb.AuthRoleRevokePermissionRequest, opts ...grpc.CallOption) (resp *pb.AuthRoleRevokePermissionResponse, err error) {
|
2017-10-19 21:26:28 +03:00
|
|
|
err = rac.writeRetry(ctx, func(rctx context.Context) error {
|
2016-08-13 07:16:09 +03:00
|
|
|
resp, err = rac.AuthClient.RoleRevokePermission(rctx, in, opts...)
|
|
|
|
return err
|
|
|
|
})
|
|
|
|
return resp, err
|
|
|
|
}
|