cluster

package
v0.0.0-...-b0a49f2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyRunning   = errors.New("cluster: cluster already running")
	ErrNotRunning       = errors.New("cluster: cluster is not running")
	ErrBootstrapTimeout = errors.New("cluster: bootstrap timeout")
	ErrNodeNotFound     = errors.New("cluster: node not found")
	ErrNilOptions       = errors.New("cluster: options cannot be nil")
)

Functions

This section is empty.

Types

type Cluster

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

func New

func New(grpcServer *grpc.Server, logger *zap.Logger, opts *Options) (*Cluster, error)

func (*Cluster) Addr

func (c *Cluster) Addr() string

func (*Cluster) CurrentLevel

func (c *Cluster) CurrentLevel() int

func (*Cluster) IsOwner

func (c *Cluster) IsOwner(addr string) bool

func (*Cluster) Join

func (c *Cluster) Join(peers []string) error

func (*Cluster) Lookup

func (c *Cluster) Lookup(index h3.H3Index) (h3geodist.Cell, bool)

func (*Cluster) Run

func (c *Cluster) Run() (err error)

func (*Cluster) Shutdown

func (c *Cluster) Shutdown() (err error)

type Options

type Options struct {
	GRPCServerAddr string `yaml:"grpc_server_addr"`
	GRPCServerPort int    `yaml:"grpc_server_port"`

	GRPCClientIdleTimeout     time.Duration `yaml:"grpc_client_idle_timeout"`
	GRPCClientMaxLifeDuration time.Duration `yaml:"grpc_client_max_life_duration"`
	GRPCClientInitPoolCount   int           `yaml:"grpc_client_pool_init_count"`
	GRPCClientPoolCapacity    int           `yaml:"grpc_client_pool_capacity"`

	H3DistLevel    int    `yaml:"h3dist_level"`
	H3DistVNodes   uint64 `yaml:"h3dist_vnodes"`
	H3DistReplicas int    `yaml:"h3dist_replicas"`

	JoinRetryInterval time.Duration `yaml:"join_retry_interval"`
	MaxJoinAttempts   int           `yaml:"max_join_attempts"`
	Peers             []string      `yaml:"peers"`
	BootstrapTimeout  time.Duration `yaml:"bootstrap_timeout"`

	CoordinatorPushInterval time.Duration `yaml:"coordinator_update_push_interval"`

	MemberlistDefaultConf   string         `yaml:"memberlist_default_conf"`
	BindAddr                string         `yaml:"memberlist_bind_addr"`
	BindPort                int            `yaml:"memberlist_bind_port"`
	AdvertiseAddr           *string        `yaml:"memberlist_advertise_addr"`
	AdvertisePort           *int           `yaml:"memberlist_advertise_port"`
	EnableCompression       *bool          `yaml:"memberlist_enable_compression"`
	IndirectChecks          *int           `yaml:"memberlist_indirect_checks"`
	RetransmitMult          *int           `yaml:"memberlist_retransmit_mult"`
	SuspicionMult           *int           `yaml:"memberlist_suspicion_mult"`
	TCPTimeout              *time.Duration `yaml:"memberlist_tcp_timeout"`
	PushPullInterval        *time.Duration `yaml:"memberlist_push_pull_interval"`
	ProbeTimeout            *time.Duration `yaml:"memberlist_probe_timeout"`
	ProbeInterval           *time.Duration `yaml:"memberlist_probe_interval"`
	GossipInterval          *time.Duration `yaml:"memberlist_gossip_interval"`
	GossipToTheDeadTime     *time.Duration `yaml:"memberlist_gossip_dead_time"`
	SuspicionMaxTimeoutMult *int           `yaml:"memberlist_suspicion_max_timeout_mult"`
	AwarenessMaxMultiplier  *int           `yaml:"memberlist_awareness_max_multiplier"`
	GossipNodes             *int           `yaml:"memberlist_gossip_nodes"`
	GossipVerifyIncoming    *bool          `yaml:"memberlist_gossip_verify_incoming"`
	GossipVerifyOutgoing    *bool          `yaml:"memberlist_gossip_verify_outgoing"`
	DNSConfigPath           *string        `yaml:"memberlist_dns_config_path"`
	HandoffQueueDepth       *int           `yaml:"memberlist_handoff_queue_depth"`
	UDPBufferSize           *int           `yaml:"memberlist_udp_buffer_size"`

	GRPCClientDialOpts []grpc.DialOption `yaml:"-"`
}

type VNode

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

func (*VNode) NoData

func (v *VNode) NoData() bool

func (*VNode) SetOwners

func (v *VNode) SetOwners(owners []*pb.NodeInfo)

type VNodeKind

type VNodeKind int
const (
	Primary VNodeKind = iota + 1
	Secondary
)

Jump to

Keyboard shortcuts

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