cluster

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrActorNotFound is return when an actor is not found
	ErrActorNotFound = errors.New("actor not found")
)

Functions

This section is empty.

Types

type Cluster

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

Cluster represents the Cluster

func New

func New(name string, serviceDiscovery *discovery.ServiceDiscovery, opts ...Option) (*Cluster, error)

New creates an instance of Cluster

func (*Cluster) GetActor

func (c *Cluster) GetActor(ctx context.Context, actorName string) (*goaktpb.WireActor, error)

GetActor fetches an actor from the Cluster

func (*Cluster) GetPartition added in v0.3.0

func (c *Cluster) GetPartition(actorName string) int

GetPartition returns the partition where a given actor is stored

func (*Cluster) NodeHost

func (c *Cluster) NodeHost() string

NodeHost returns the Cluster node Host

func (*Cluster) NodeRemotingPort added in v0.3.0

func (c *Cluster) NodeRemotingPort() int

NodeRemotingPort returns the Cluster node remoting port

func (*Cluster) PutActor

func (c *Cluster) PutActor(ctx context.Context, actor *goaktpb.WireActor) error

PutActor replicates onto the Cluster the metadata of an actor

func (*Cluster) Start

func (c *Cluster) Start(ctx context.Context) error

Start starts the Cluster.

func (*Cluster) Stop

func (c *Cluster) Stop(ctx context.Context) error

Stop stops the Cluster gracefully

type Interface added in v0.6.0

type Interface interface {
	// Start starts the Cluster engine
	Start(ctx context.Context) error
	// Stop stops the Cluster engine
	Stop(ctx context.Context) error
	// NodeHost returns the Cluster node host address
	NodeHost() string
	// NodeRemotingPort returns the Cluster node remoting port
	NodeRemotingPort() int
	// PutActor replicates onto the Cluster the metadata of an actor
	PutActor(ctx context.Context, actor *goaktpb.WireActor) error
	// GetActor fetches an actor from the Cluster
	GetActor(ctx context.Context, actorName string) (*goaktpb.WireActor, error)
	// GetPartition returns the partition where a given actor is stored
	GetPartition(actorName string) int
}

Interface defines the Cluster interface

type Option

type Option interface {
	// Apply sets the Option value of a config.
	Apply(cl *Cluster)
}

Option is the interface that applies a configuration option.

func WithHasher added in v0.5.0

func WithHasher(hasher hash.Hasher) Option

WithHasher sets the custom hasher

func WithLogger added in v0.3.0

func WithLogger(logger log.Logger) Option

WithLogger sets the logger

func WithPartitionsCount added in v0.3.0

func WithPartitionsCount(count uint64) Option

WithPartitionsCount sets the total number of partitions

func WithReadTimeout added in v0.3.0

func WithReadTimeout(timeout time.Duration) Option

WithReadTimeout sets the Cluster read timeout. This timeout specifies the timeout of a data retrieval

func WithShutdownTimeout added in v0.3.0

func WithShutdownTimeout(timeout time.Duration) Option

WithShutdownTimeout sets the Cluster shutdown timeout.

func WithWriteTimeout added in v0.3.0

func WithWriteTimeout(timeout time.Duration) Option

WithWriteTimeout sets the Cluster write timeout. This timeout specifies the timeout of a data replication

type OptionFunc

type OptionFunc func(cl *Cluster)

OptionFunc implements the Option interface.

func (OptionFunc) Apply

func (f OptionFunc) Apply(c *Cluster)

Apply applies the Cluster's option

Jump to

Keyboard shortcuts

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