sdk

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnectorRunner

func NewConnectorRunner(ctx context.Context, c types.ConnectorServer, dbPath string, opts ...Option) (*connectorRunner, error)

NewConnectorRunner creates a new connector runner.

func NewEmptyConnector

func NewEmptyConnector() (*emptyConnector, error)

NewEmptyConnector returns a new emptyConnector.

Types

type Option

type Option func(ctx context.Context, cfg *runnerConfig) error

func WithExternalLimiter

func WithExternalLimiter(address string, opts map[string]string) Option

WithExternalLimiter configures the connector to use an external rate limiter. The `opts` map is injected into the environment in order for the service to be configured.

func WithFixedMemoryLimiter

func WithFixedMemoryLimiter(rate int64, period time.Duration) Option

WithFixedMemoryLimiter configures to use a fixed-memory limiter. `rate` is a number on how many times it should be in the given period executed. `period` represents the elapsed time between two instants as an int64 nanosecond count.

func WithRateLimitDescriptor

func WithRateLimitDescriptor(entry *ratelimitV1.RateLimitDescriptors_Entry) Option

WithRateLimitDescriptor takes a rate limit descriptor and adds it to the list of rate limit descriptors.

func WithRateLimiterConfig

func WithRateLimiterConfig(cfg *ratelimitV1.RateLimiterConfig) Option

WithRateLimiterConfig sets the RateLimiterConfig for a runner.

func WithSlidingMemoryLimiter

func WithSlidingMemoryLimiter(usePercent int64) Option

WithSlidingMemoryLimiter configures the connector to use an in-memory rate limiter that adjusts to maintain fairness based on request headers. `usePercent` is value between 0 and 100.

Jump to

Keyboard shortcuts

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