Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TokenBucketClient ¶
type TokenBucketClient interface { MultiTokenRequest(ctx context.Context, in *proto.MultiTokenBucketRequest, opts ...grpc.CallOption) (*proto.MultiTokenBucketResponse, error) TokenRequest(ctx context.Context, family, bucket string, amount int64) ( bool, error) }
func NewTokenBucketClient ¶
func NewTokenBucketClient( remoteAddr string, tlsConfig *tls.Config, opts ...grpc.DialOption) ( TokenBucketClient, error)
NewTokenBucketClient creates a new TokenBucketClientImpl for the specified remote address. If a tlsConfig is passed, then TLS is enabled, otherwise the client will be run in insecure mode.
type TokenBucketClientImpl ¶
type TokenBucketClientImpl struct {
// contains filtered or unexported fields
}
TokenBucketClientImpl is a client for a networked token bucket implementation.
func (*TokenBucketClientImpl) MultiTokenRequest ¶
func (tbc *TokenBucketClientImpl) MultiTokenRequest( ctx context.Context, in *proto.MultiTokenBucketRequest, opts ...grpc.CallOption) (*proto.MultiTokenBucketResponse, error)
MultiTokenRequest sends a MultiTokenBucketRequest to the server and just returns the response.
func (*TokenBucketClientImpl) TokenRequest ¶
func (tbc *TokenBucketClientImpl) TokenRequest( ctx context.Context, family, bucket string, amount int64) (bool, error)
TokenRequest creates a MultiTokenBucketRequest for the parameters passed in and sends it to the server; the result of whether the request passed or failed is being returned as a boolean. In any case, the result returned fails open.
Click to show internal directories.
Click to hide internal directories.