throttlerclient

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2017 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package throttlerclient defines the generic RPC client interface for the throttler service. It has to be implemented for the different RPC frameworks e.g. gRPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFactory

func RegisterFactory(name string, factory Factory)

RegisterFactory allows a client implementation to register itself.

Types

type Client

type Client interface {
	// MaxRates returns the current max rate for each throttler of the process.
	MaxRates(ctx context.Context) (map[string]int64, error)

	// SetMaxRate allows to change the current max rate for all throttlers
	// of the process.
	// It returns the names of the updated throttlers.
	SetMaxRate(ctx context.Context, rate int64) ([]string, error)

	// GetConfiguration returns the configuration of the MaxReplicationlag module
	// for the given throttler or all throttlers if "throttlerName" is empty.
	GetConfiguration(ctx context.Context, throttlerName string) (map[string]*throttlerdata.Configuration, error)

	// UpdateConfiguration (partially) updates the configuration of the
	// MaxReplicationlag module for the given throttler or all throttlers if
	// "throttlerName" is empty.
	// If "copyZeroValues" is true, fields with zero values will be copied
	// as well.
	// The function returns the names of the updated throttlers.
	UpdateConfiguration(ctx context.Context, throttlerName string, configuration *throttlerdata.Configuration, copyZeroValues bool) ([]string, error)

	// ResetConfiguration resets the configuration of the MaxReplicationlag module
	// to the initial configuration for the given throttler or all throttlers if
	// "throttlerName" is empty.
	// The function returns the names of the updated throttlers.
	ResetConfiguration(ctx context.Context, throttlerName string) ([]string, error)

	// Close will terminate the connection and free resources.
	Close()
}

Client defines the generic RPC interface for the throttler service.

func New

func New(addr string) (Client, error)

New will return a client for the selected RPC implementation.

type Factory

type Factory func(addr string) (Client, error)

Factory has to be implemented and must create a new RPC client for a given "addr".

Jump to

Keyboard shortcuts

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