tbdClient

package module
v0.0.0-...-7e9f7ec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2019 License: MIT Imports: 7 Imported by: 0

README

tbd-client

Client for a networked token bucket implementation

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

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.

Directories

Path Synopsis
bin

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL