nodes

package
v1.87.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPrimaryNotHealthy = errors.New("primary is not healthy")

ErrPrimaryNotHealthy indicates the primary of a shard is not in a healthy state and hence should not be used for a new request

Functions

This section is empty.

Types

type Manager

type Manager interface {
	GetShard(virtualStorageName string) (Shard, error)
}

Manager is responsible for returning shards for virtual storages

type Mgr

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

Mgr is a concrete type that adheres to the Manager interface

func NewManager

func NewManager(log *logrus.Entry, c config.Config, dialOpts ...grpc.DialOption) (*Mgr, error)

NewNodeManager creates a new NodeMgr based on virtual storage configs

func (*Mgr) GetShard

func (n *Mgr) GetShard(virtualStorageName string) (Shard, error)

GetShard retrieves a shard for a virtual storage name

func (*Mgr) Start

func (n *Mgr) Start(bootstrapInterval, monitorInterval time.Duration)

Start will bootstrap the node manager by calling healthcheck on the nodes as well as kicking off the monitoring process. Start must be called before NodeMgr can be used.

type Node

type Node interface {
	GetStorage() string
	GetAddress() string
	GetToken() string
	GetConnection() *grpc.ClientConn
}

Node represents some metadata of a node as well as a connection

type Shard

type Shard interface {
	GetPrimary() (Node, error)
	GetSecondaries() ([]Node, error)
}

Shard is a primary with a set of secondaries

Jump to

Keyboard shortcuts

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