client

package
v0.0.0-...-3a65784 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Read = iota
	Write
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(rateLimit *RateLimit, tracer trace.Tracer, routerRPCClients RouterClients, requests []Request) *client

func WriteOutputToFile

func WriteOutputToFile(outputFilePath string, responseCount []ResponseStatus) error

Types

type RateLimit

type RateLimit struct {
	// contains filtered or unexported fields
}

RateLimit is a simple rate limiter that allows a maximum of tokensLimit requests at a time.

func NewRateLimit

func NewRateLimit(tokensLimit int) *RateLimit

func (*RateLimit) Acquire

func (r *RateLimit) Acquire()

Aquire blocks until a token is available.

func (*RateLimit) Release

func (r *RateLimit) Release()

Release releases a token.

type ReadResponse

type ReadResponse struct {
	// contains filtered or unexported fields
}

type Request

type Request struct {
	Block         string
	OperationType int
	NewValue      string
}

func ReadTraceFile

func ReadTraceFile(traceFilePath string, blockSizeBytes int) ([]Request, error)

type ResponseStatus

type ResponseStatus struct {
	// contains filtered or unexported fields
}

type RouterClients

type RouterClients map[int]RouterRPCClient

func StartRouterRPCClients

func StartRouterRPCClients(endpoints []config.RouterEndpoint) (RouterClients, error)

func (RouterClients) GetRandomRouter

func (r RouterClients) GetRandomRouter() RouterRPCClient

type RouterRPCClient

type RouterRPCClient struct {
	ClientAPI routerpb.RouterClient
	Conn      *grpc.ClientConn
}

func (*RouterRPCClient) Read

func (c *RouterRPCClient) Read(ctx context.Context, block string) (value string, err error)

func (*RouterRPCClient) Write

func (c *RouterRPCClient) Write(ctx context.Context, block string, value string) (success bool, err error)

type WriteResponse

type WriteResponse struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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