mrconnector

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	io.Closer

	ClusterID() types.ClusterID

	NumberOfMR() int

	ActiveMRs() map[types.NodeID]string

	ConnectedNodeID() types.NodeID

	Client(ctx context.Context) (mrc.MetadataRepositoryClient, error)

	ManagementClient(ctx context.Context) (mrc.MetadataRepositoryManagementClient, error)

	AddRPCAddr(nodeID types.NodeID, addr string)

	DelRPCAddr(nodeID types.NodeID)
}

Connector represents a connection proxy for the metadata repository. It contains clients and management clients for the metadata repository.

func New

func New(ctx context.Context, opts ...Option) (Connector, error)

type Option

type Option func(*config)

func WithClusterID

func WithClusterID(clusterID types.ClusterID) Option

WithClusterID sets cluster ID of MR cluster.

func WithConnectTimeout

func WithConnectTimeout(connTimeout time.Duration) Option

WithConnectTimeout sets a timeout to connect to the MR.

func WithInitCount

func WithInitCount(initCount int) Option

WithInitCount sets the maximum number of tries to connect to the given seed and fetch addresses of MRs.

func WithInitRetryInterval

func WithInitRetryInterval(interval time.Duration) Option

WithInitRetryInterval sets the interval between tries to initialize.

func WithLogger

func WithLogger(logger *zap.Logger) Option

func WithRPCTimeout

func WithRPCTimeout(rpcTimeout time.Duration) Option

WithRPCTimeout sets a timeout to call RPC methods to the MR.

func WithSeed

func WithSeed(seed []string) Option

WithSeed sets seed addresses of MRs that can be used to fetch addresses of MRs initially. Seed is an immutable list of addresses of MRs.

func WithUpdateInterval

func WithUpdateInterval(interval time.Duration) Option

WithUpdateInterval sets the interval between updates of information of MR cluster.

Jump to

Keyboard shortcuts

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