cluster

package
v0.0.0-...-dd34702 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 20 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var File_cluster_proto protoreflect.FileDescriptor

Functions

func NewAgent

func NewAgent(c *Cluster) actor.Producer

Types

type Activation

type Activation struct {
	PID *actor.PID `protobuf:"bytes,1,opt,name=PID,proto3" json:"PID,omitempty"`
	// contains filtered or unexported fields
}

func (*Activation) CloneMessageVT

func (m *Activation) CloneMessageVT() proto.Message

func (*Activation) CloneVT

func (m *Activation) CloneVT() *Activation

func (*Activation) Descriptor deprecated

func (*Activation) Descriptor() ([]byte, []int)

Deprecated: Use Activation.ProtoReflect.Descriptor instead.

func (*Activation) EqualMessageVT

func (this *Activation) EqualMessageVT(thatMsg proto.Message) bool

func (*Activation) EqualVT

func (this *Activation) EqualVT(that *Activation) bool

func (*Activation) GetPID

func (x *Activation) GetPID() *actor.PID

func (*Activation) MarshalToSizedBufferVT

func (m *Activation) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Activation) MarshalToSizedBufferVTStrict

func (m *Activation) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Activation) MarshalToVT

func (m *Activation) MarshalToVT(dAtA []byte) (int, error)

func (*Activation) MarshalToVTStrict

func (m *Activation) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Activation) MarshalVT

func (m *Activation) MarshalVT() (dAtA []byte, err error)

func (*Activation) MarshalVTStrict

func (m *Activation) MarshalVTStrict() (dAtA []byte, err error)

func (*Activation) ProtoMessage

func (*Activation) ProtoMessage()

func (*Activation) ProtoReflect

func (x *Activation) ProtoReflect() protoreflect.Message

func (*Activation) Reset

func (x *Activation) Reset()

func (*Activation) SizeVT

func (m *Activation) SizeVT() (n int)

func (*Activation) String

func (x *Activation) String() string

func (*Activation) UnmarshalVT

func (m *Activation) UnmarshalVT(dAtA []byte) error

type ActivationConfig

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

ActivationConfig...

func NewActivationConfig

func NewActivationConfig() ActivationConfig

NewActivationConfig returns a new default config.

func (ActivationConfig) WithID

func (config ActivationConfig) WithID(id string) ActivationConfig

WithID set's the id of the actor that will be activated on the cluster.

Defaults to a random identifier.

func (ActivationConfig) WithRegion

func (config ActivationConfig) WithRegion(region string) ActivationConfig

WithRegion set's the region on where this actor should be spawned.

Defaults to a "default".

func (ActivationConfig) WithSelectMemberFunc

func (config ActivationConfig) WithSelectMemberFunc(fun SelectMemberFunc) ActivationConfig

WithSelectMemberFunc set's the fuction that will be invoked during the activation process. It will select the member where the actor will be activated/spawned on.

type ActivationDetails

type ActivationDetails struct {
	// Region where the actor should be activated on
	Region string
	// A slice of members that are pre-filtered by the kind of the actor
	// that need to be activated
	Members []*Member
	// The kind of the actor
	Kind string
}

ActivationDetails holds detailed information about an activation.

type ActivationEvent

type ActivationEvent struct {
	PID *actor.PID
}

ActivationEvent gets triggered each time a new actor is activated somewhere on the cluster.

type ActivationRequest

type ActivationRequest struct {
	Kind         string `protobuf:"bytes,1,opt,name=Kind,proto3" json:"Kind,omitempty"`
	ID           string `protobuf:"bytes,2,opt,name=ID,proto3" json:"ID,omitempty"`
	Region       string `protobuf:"bytes,3,opt,name=Region,proto3" json:"Region,omitempty"`
	TopologyHash uint64 `protobuf:"varint,4,opt,name=topologyHash,proto3" json:"topologyHash,omitempty"`
	// contains filtered or unexported fields
}

func (*ActivationRequest) CloneMessageVT

func (m *ActivationRequest) CloneMessageVT() proto.Message

func (*ActivationRequest) CloneVT

func (m *ActivationRequest) CloneVT() *ActivationRequest

func (*ActivationRequest) Descriptor deprecated

func (*ActivationRequest) Descriptor() ([]byte, []int)

Deprecated: Use ActivationRequest.ProtoReflect.Descriptor instead.

func (*ActivationRequest) EqualMessageVT

func (this *ActivationRequest) EqualMessageVT(thatMsg proto.Message) bool

func (*ActivationRequest) EqualVT

func (this *ActivationRequest) EqualVT(that *ActivationRequest) bool

func (*ActivationRequest) GetID

func (x *ActivationRequest) GetID() string

func (*ActivationRequest) GetKind

func (x *ActivationRequest) GetKind() string

func (*ActivationRequest) GetRegion

func (x *ActivationRequest) GetRegion() string

func (*ActivationRequest) GetTopologyHash

func (x *ActivationRequest) GetTopologyHash() uint64

func (*ActivationRequest) MarshalToSizedBufferVT

func (m *ActivationRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ActivationRequest) MarshalToSizedBufferVTStrict

func (m *ActivationRequest) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*ActivationRequest) MarshalToVT

func (m *ActivationRequest) MarshalToVT(dAtA []byte) (int, error)

func (*ActivationRequest) MarshalToVTStrict

func (m *ActivationRequest) MarshalToVTStrict(dAtA []byte) (int, error)

func (*ActivationRequest) MarshalVT

func (m *ActivationRequest) MarshalVT() (dAtA []byte, err error)

func (*ActivationRequest) MarshalVTStrict

func (m *ActivationRequest) MarshalVTStrict() (dAtA []byte, err error)

func (*ActivationRequest) ProtoMessage

func (*ActivationRequest) ProtoMessage()

func (*ActivationRequest) ProtoReflect

func (x *ActivationRequest) ProtoReflect() protoreflect.Message

func (*ActivationRequest) Reset

func (x *ActivationRequest) Reset()

func (*ActivationRequest) SizeVT

func (m *ActivationRequest) SizeVT() (n int)

func (*ActivationRequest) String

func (x *ActivationRequest) String() string

func (*ActivationRequest) UnmarshalVT

func (m *ActivationRequest) UnmarshalVT(dAtA []byte) error

type ActivationResponse

type ActivationResponse struct {
	PID          *actor.PID `protobuf:"bytes,1,opt,name=PID,proto3" json:"PID,omitempty"`
	Success      bool       `protobuf:"varint,2,opt,name=success,proto3" json:"success,omitempty"`
	TopologyHash uint64     `protobuf:"varint,3,opt,name=topologyHash,proto3" json:"topologyHash,omitempty"`
	// contains filtered or unexported fields
}

func (*ActivationResponse) CloneMessageVT

func (m *ActivationResponse) CloneMessageVT() proto.Message

func (*ActivationResponse) CloneVT

func (m *ActivationResponse) CloneVT() *ActivationResponse

func (*ActivationResponse) Descriptor deprecated

func (*ActivationResponse) Descriptor() ([]byte, []int)

Deprecated: Use ActivationResponse.ProtoReflect.Descriptor instead.

func (*ActivationResponse) EqualMessageVT

func (this *ActivationResponse) EqualMessageVT(thatMsg proto.Message) bool

func (*ActivationResponse) EqualVT

func (this *ActivationResponse) EqualVT(that *ActivationResponse) bool

func (*ActivationResponse) GetPID

func (x *ActivationResponse) GetPID() *actor.PID

func (*ActivationResponse) GetSuccess

func (x *ActivationResponse) GetSuccess() bool

func (*ActivationResponse) GetTopologyHash

func (x *ActivationResponse) GetTopologyHash() uint64

func (*ActivationResponse) MarshalToSizedBufferVT

func (m *ActivationResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ActivationResponse) MarshalToSizedBufferVTStrict

func (m *ActivationResponse) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*ActivationResponse) MarshalToVT

func (m *ActivationResponse) MarshalToVT(dAtA []byte) (int, error)

func (*ActivationResponse) MarshalToVTStrict

func (m *ActivationResponse) MarshalToVTStrict(dAtA []byte) (int, error)

func (*ActivationResponse) MarshalVT

func (m *ActivationResponse) MarshalVT() (dAtA []byte, err error)

func (*ActivationResponse) MarshalVTStrict

func (m *ActivationResponse) MarshalVTStrict() (dAtA []byte, err error)

func (*ActivationResponse) ProtoMessage

func (*ActivationResponse) ProtoMessage()

func (*ActivationResponse) ProtoReflect

func (x *ActivationResponse) ProtoReflect() protoreflect.Message

func (*ActivationResponse) Reset

func (x *ActivationResponse) Reset()

func (*ActivationResponse) SizeVT

func (m *ActivationResponse) SizeVT() (n int)

func (*ActivationResponse) String

func (x *ActivationResponse) String() string

func (*ActivationResponse) UnmarshalVT

func (m *ActivationResponse) UnmarshalVT(dAtA []byte) error

type ActorInfo

type ActorInfo struct {
	PID *actor.PID `protobuf:"bytes,2,opt,name=PID,proto3" json:"PID,omitempty"`
	// contains filtered or unexported fields
}

func (*ActorInfo) CloneMessageVT

func (m *ActorInfo) CloneMessageVT() proto.Message

func (*ActorInfo) CloneVT

func (m *ActorInfo) CloneVT() *ActorInfo

func (*ActorInfo) Descriptor deprecated

func (*ActorInfo) Descriptor() ([]byte, []int)

Deprecated: Use ActorInfo.ProtoReflect.Descriptor instead.

func (*ActorInfo) EqualMessageVT

func (this *ActorInfo) EqualMessageVT(thatMsg proto.Message) bool

func (*ActorInfo) EqualVT

func (this *ActorInfo) EqualVT(that *ActorInfo) bool

func (*ActorInfo) GetPID

func (x *ActorInfo) GetPID() *actor.PID

func (*ActorInfo) MarshalToSizedBufferVT

func (m *ActorInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ActorInfo) MarshalToSizedBufferVTStrict

func (m *ActorInfo) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*ActorInfo) MarshalToVT

func (m *ActorInfo) MarshalToVT(dAtA []byte) (int, error)

func (*ActorInfo) MarshalToVTStrict

func (m *ActorInfo) MarshalToVTStrict(dAtA []byte) (int, error)

func (*ActorInfo) MarshalVT

func (m *ActorInfo) MarshalVT() (dAtA []byte, err error)

func (*ActorInfo) MarshalVTStrict

func (m *ActorInfo) MarshalVTStrict() (dAtA []byte, err error)

func (*ActorInfo) ProtoMessage

func (*ActorInfo) ProtoMessage()

func (*ActorInfo) ProtoReflect

func (x *ActorInfo) ProtoReflect() protoreflect.Message

func (*ActorInfo) Reset

func (x *ActorInfo) Reset()

func (*ActorInfo) SizeVT

func (m *ActorInfo) SizeVT() (n int)

func (*ActorInfo) String

func (x *ActorInfo) String() string

func (*ActorInfo) UnmarshalVT

func (m *ActorInfo) UnmarshalVT(dAtA []byte) error

type ActorTopology

type ActorTopology struct {
	Actors []*ActorInfo `protobuf:"bytes,1,rep,name=actors,proto3" json:"actors,omitempty"`
	// contains filtered or unexported fields
}

func (*ActorTopology) CloneMessageVT

func (m *ActorTopology) CloneMessageVT() proto.Message

func (*ActorTopology) CloneVT

func (m *ActorTopology) CloneVT() *ActorTopology

func (*ActorTopology) Descriptor deprecated

func (*ActorTopology) Descriptor() ([]byte, []int)

Deprecated: Use ActorTopology.ProtoReflect.Descriptor instead.

func (*ActorTopology) EqualMessageVT

func (this *ActorTopology) EqualMessageVT(thatMsg proto.Message) bool

func (*ActorTopology) EqualVT

func (this *ActorTopology) EqualVT(that *ActorTopology) bool

func (*ActorTopology) GetActors

func (x *ActorTopology) GetActors() []*ActorInfo

func (*ActorTopology) MarshalToSizedBufferVT

func (m *ActorTopology) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ActorTopology) MarshalToSizedBufferVTStrict

func (m *ActorTopology) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*ActorTopology) MarshalToVT

func (m *ActorTopology) MarshalToVT(dAtA []byte) (int, error)

func (*ActorTopology) MarshalToVTStrict

func (m *ActorTopology) MarshalToVTStrict(dAtA []byte) (int, error)

func (*ActorTopology) MarshalVT

func (m *ActorTopology) MarshalVT() (dAtA []byte, err error)

func (*ActorTopology) MarshalVTStrict

func (m *ActorTopology) MarshalVTStrict() (dAtA []byte, err error)

func (*ActorTopology) ProtoMessage

func (*ActorTopology) ProtoMessage()

func (*ActorTopology) ProtoReflect

func (x *ActorTopology) ProtoReflect() protoreflect.Message

func (*ActorTopology) Reset

func (x *ActorTopology) Reset()

func (*ActorTopology) SizeVT

func (m *ActorTopology) SizeVT() (n int)

func (*ActorTopology) String

func (x *ActorTopology) String() string

func (*ActorTopology) UnmarshalVT

func (m *ActorTopology) UnmarshalVT(dAtA []byte) error

type Agent

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

Agent is an actor/receiver that is responsible for managing the state of the cluster.

func (*Agent) Receive

func (a *Agent) Receive(c *actor.Context)

type CID

type CID struct {
	PID    *actor.PID `protobuf:"bytes,1,opt,name=PID,proto3" json:"PID,omitempty"`
	ID     string     `protobuf:"bytes,2,opt,name=ID,proto3" json:"ID,omitempty"`
	Kind   string     `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"`
	Region string     `protobuf:"bytes,4,opt,name=region,proto3" json:"region,omitempty"`
	// contains filtered or unexported fields
}

func NewCID

func NewCID(pid *actor.PID, kind, id, region string) *CID

NewCID returns a new Cluster ID.

func (*CID) CloneMessageVT

func (m *CID) CloneMessageVT() proto.Message

func (*CID) CloneVT

func (m *CID) CloneVT() *CID

func (*CID) Descriptor deprecated

func (*CID) Descriptor() ([]byte, []int)

Deprecated: Use CID.ProtoReflect.Descriptor instead.

func (*CID) EqualMessageVT

func (this *CID) EqualMessageVT(thatMsg proto.Message) bool

func (*CID) EqualVT

func (this *CID) EqualVT(that *CID) bool

func (*CID) Equals

func (cid *CID) Equals(other *CID) bool

Equals returns true whether the given CID equals the caller.

func (*CID) GetID

func (x *CID) GetID() string

func (*CID) GetKind

func (x *CID) GetKind() string

func (*CID) GetPID

func (x *CID) GetPID() *actor.PID

func (*CID) GetRegion

func (x *CID) GetRegion() string

func (*CID) MarshalToSizedBufferVT

func (m *CID) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*CID) MarshalToSizedBufferVTStrict

func (m *CID) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*CID) MarshalToVT

func (m *CID) MarshalToVT(dAtA []byte) (int, error)

func (*CID) MarshalToVTStrict

func (m *CID) MarshalToVTStrict(dAtA []byte) (int, error)

func (*CID) MarshalVT

func (m *CID) MarshalVT() (dAtA []byte, err error)

func (*CID) MarshalVTStrict

func (m *CID) MarshalVTStrict() (dAtA []byte, err error)

func (*CID) ProtoMessage

func (*CID) ProtoMessage()

func (*CID) ProtoReflect

func (x *CID) ProtoReflect() protoreflect.Message

func (*CID) Reset

func (x *CID) Reset()

func (*CID) SizeVT

func (m *CID) SizeVT() (n int)

func (*CID) String

func (x *CID) String() string

func (*CID) UnmarshalVT

func (m *CID) UnmarshalVT(dAtA []byte) error

type Cluster

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

Cluster allows you to write distributed actors. It combines Engine, Remote, and Provider which allows members of the cluster to send messages to eachother in a self discovering environment.

func New

func New(config Config) (*Cluster, error)

New returns a new cluster given a Config.

func (*Cluster) Activate

func (c *Cluster) Activate(kind string, config ActivationConfig) *actor.PID

Activate actives the registered kind in the cluster based on the given config. The actor does not need to be registered locally on the member if at least one member has that kind registered.

playerPID := cluster.Activate("player", cluster.NewActivationConfig())

func (*Cluster) Address

func (c *Cluster) Address() string

Address returns the host/address of the cluster.

func (*Cluster) Deactivate

func (c *Cluster) Deactivate(pid *actor.PID)

Deactivate deactivates the given PID.

func (*Cluster) Engine

func (c *Cluster) Engine() *actor.Engine

Engine returns the actor engine.

func (*Cluster) GetActivated

func (c *Cluster) GetActivated(id string) *actor.PID

TODO: Weird

func (*Cluster) HasKind

func (c *Cluster) HasKind(name string) bool

HasKind returns true whether the given kind is available for activation on the cluster.

func (*Cluster) HasKindLocal

func (c *Cluster) HasKindLocal(name string) bool

HasKindLocal returns true whether the node of the cluster has the kind locally registered.

func (*Cluster) ID

func (c *Cluster) ID() string

ID returns the ID of the cluster.

func (*Cluster) Member

func (c *Cluster) Member() *Member

Member returns the member info of this node.

func (*Cluster) Members

func (c *Cluster) Members() []*Member

Members returns all the members that are part of the cluster.

func (*Cluster) PID

func (c *Cluster) PID() *actor.PID

PID returns the reachable actor process id, which is the Agent actor.

func (*Cluster) Region

func (c *Cluster) Region() string

Region return the region of the cluster.

func (*Cluster) RegisterKind

func (c *Cluster) RegisterKind(kind string, producer actor.Producer, config KindConfig)

RegisterKind registers a new actor that can be activated from any member in the cluster.

cluster.Register("player", NewPlayer, NewKindConfig())

NOTE: Kinds can only be registered before the cluster is started.

func (*Cluster) Spawn

func (c *Cluster) Spawn(p actor.Producer, id string, opts ...actor.OptFunc) *actor.PID

Spawn an actor locally on the node with cluster awareness.

func (*Cluster) Start

func (c *Cluster) Start()

Start the cluster

func (*Cluster) Stop

func (c *Cluster) Stop() *sync.WaitGroup

Stop will shutdown the cluster poisoning all its actors.

type Config

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

Config holds the cluster configuration

func NewConfig

func NewConfig() Config

NewConfig returns a Config that is initialized with default values.

func (Config) WithEngine

func (config Config) WithEngine(e *actor.Engine) Config

WithEngine set's the internal actor engine that will be used to power the actors running on the node.

If no engine is given the cluster will instanciate a new engine and remote.

func (Config) WithID

func (config Config) WithID(id string) Config

WithID set's the ID of this node.

Defaults to a random generated ID.

func (Config) WithListenAddr

func (config Config) WithListenAddr(addr string) Config

WithListenAddr set's the listen address of the underlying remote.

Defaults to a random port number.

func (Config) WithProvider

func (config Config) WithProvider(p Producer) Config

WithProvider set's the cluster provider.

Defaults to the SelfManagedProvider.

func (Config) WithRegion

func (config Config) WithRegion(region string) Config

WithRegion set's the region where the member will be hosted.

Defaults to "default"

func (Config) WithRequestTimeout

func (config Config) WithRequestTimeout(d time.Duration) Config

WithRequestTimeout set's the maximum duration of how long a request can take between members of the cluster.

Defaults to 1 second to support communication between nodes in other regions.

type Deactivation

type Deactivation struct {
	PID *actor.PID `protobuf:"bytes,1,opt,name=PID,proto3" json:"PID,omitempty"`
	// contains filtered or unexported fields
}

func (*Deactivation) CloneMessageVT

func (m *Deactivation) CloneMessageVT() proto.Message

func (*Deactivation) CloneVT

func (m *Deactivation) CloneVT() *Deactivation

func (*Deactivation) Descriptor deprecated

func (*Deactivation) Descriptor() ([]byte, []int)

Deprecated: Use Deactivation.ProtoReflect.Descriptor instead.

func (*Deactivation) EqualMessageVT

func (this *Deactivation) EqualMessageVT(thatMsg proto.Message) bool

func (*Deactivation) EqualVT

func (this *Deactivation) EqualVT(that *Deactivation) bool

func (*Deactivation) GetPID

func (x *Deactivation) GetPID() *actor.PID

func (*Deactivation) MarshalToSizedBufferVT

func (m *Deactivation) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Deactivation) MarshalToSizedBufferVTStrict

func (m *Deactivation) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Deactivation) MarshalToVT

func (m *Deactivation) MarshalToVT(dAtA []byte) (int, error)

func (*Deactivation) MarshalToVTStrict

func (m *Deactivation) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Deactivation) MarshalVT

func (m *Deactivation) MarshalVT() (dAtA []byte, err error)

func (*Deactivation) MarshalVTStrict

func (m *Deactivation) MarshalVTStrict() (dAtA []byte, err error)

func (*Deactivation) ProtoMessage

func (*Deactivation) ProtoMessage()

func (*Deactivation) ProtoReflect

func (x *Deactivation) ProtoReflect() protoreflect.Message

func (*Deactivation) Reset

func (x *Deactivation) Reset()

func (*Deactivation) SizeVT

func (m *Deactivation) SizeVT() (n int)

func (*Deactivation) String

func (x *Deactivation) String() string

func (*Deactivation) UnmarshalVT

func (m *Deactivation) UnmarshalVT(dAtA []byte) error

type DeactivationEvent

type DeactivationEvent struct {
	PID *actor.PID
}

DeactivationEvent gets triggered each time an actor gets deactivated somewhere on the cluster.

type Handshake

type Handshake struct {
	Member *Member `protobuf:"bytes,1,opt,name=Member,proto3" json:"Member,omitempty"`
	// contains filtered or unexported fields
}

func (*Handshake) CloneMessageVT

func (m *Handshake) CloneMessageVT() proto.Message

func (*Handshake) CloneVT

func (m *Handshake) CloneVT() *Handshake

func (*Handshake) Descriptor deprecated

func (*Handshake) Descriptor() ([]byte, []int)

Deprecated: Use Handshake.ProtoReflect.Descriptor instead.

func (*Handshake) EqualMessageVT

func (this *Handshake) EqualMessageVT(thatMsg proto.Message) bool

func (*Handshake) EqualVT

func (this *Handshake) EqualVT(that *Handshake) bool

func (*Handshake) GetMember

func (x *Handshake) GetMember() *Member

func (*Handshake) MarshalToSizedBufferVT

func (m *Handshake) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Handshake) MarshalToSizedBufferVTStrict

func (m *Handshake) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Handshake) MarshalToVT

func (m *Handshake) MarshalToVT(dAtA []byte) (int, error)

func (*Handshake) MarshalToVTStrict

func (m *Handshake) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Handshake) MarshalVT

func (m *Handshake) MarshalVT() (dAtA []byte, err error)

func (*Handshake) MarshalVTStrict

func (m *Handshake) MarshalVTStrict() (dAtA []byte, err error)

func (*Handshake) ProtoMessage

func (*Handshake) ProtoMessage()

func (*Handshake) ProtoReflect

func (x *Handshake) ProtoReflect() protoreflect.Message

func (*Handshake) Reset

func (x *Handshake) Reset()

func (*Handshake) SizeVT

func (m *Handshake) SizeVT() (n int)

func (*Handshake) String

func (x *Handshake) String() string

func (*Handshake) UnmarshalVT

func (m *Handshake) UnmarshalVT(dAtA []byte) error

type KindConfig

type KindConfig struct{}

KindConfig holds configuration for a registered kind.

func NewKindConfig

func NewKindConfig() KindConfig

NewKindConfig returns a default kind configuration.

type Member

type Member struct {
	ID     string   `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
	Host   string   `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"`
	Region string   `protobuf:"bytes,3,opt,name=region,proto3" json:"region,omitempty"`
	Kinds  []string `protobuf:"bytes,4,rep,name=kinds,proto3" json:"kinds,omitempty"`
	// contains filtered or unexported fields
}

func SelectRandomMember

func SelectRandomMember(details ActivationDetails) *Member

SelectRandomMember selects a random member of the cluster.

func (*Member) CloneMessageVT

func (m *Member) CloneMessageVT() proto.Message

func (*Member) CloneVT

func (m *Member) CloneVT() *Member

func (*Member) Descriptor deprecated

func (*Member) Descriptor() ([]byte, []int)

Deprecated: Use Member.ProtoReflect.Descriptor instead.

func (*Member) EqualMessageVT

func (this *Member) EqualMessageVT(thatMsg proto.Message) bool

func (*Member) EqualVT

func (this *Member) EqualVT(that *Member) bool

func (*Member) Equals

func (m *Member) Equals(other *Member) bool

func (*Member) GetHost

func (x *Member) GetHost() string

func (*Member) GetID

func (x *Member) GetID() string

func (*Member) GetKinds

func (x *Member) GetKinds() []string

func (*Member) GetRegion

func (x *Member) GetRegion() string

func (*Member) HasKind

func (m *Member) HasKind(kind string) bool

TODO: Maybe relocate this function. HasKind returns true whether the Member has the given kind registered.

func (*Member) MarshalToSizedBufferVT

func (m *Member) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Member) MarshalToSizedBufferVTStrict

func (m *Member) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Member) MarshalToVT

func (m *Member) MarshalToVT(dAtA []byte) (int, error)

func (*Member) MarshalToVTStrict

func (m *Member) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Member) MarshalVT

func (m *Member) MarshalVT() (dAtA []byte, err error)

func (*Member) MarshalVTStrict

func (m *Member) MarshalVTStrict() (dAtA []byte, err error)

func (*Member) PID

func (m *Member) PID() *actor.PID

PID returns the cluster PID of where the node agent can be reach.

func (*Member) ProtoMessage

func (*Member) ProtoMessage()

func (*Member) ProtoReflect

func (x *Member) ProtoReflect() protoreflect.Message

func (*Member) Reset

func (x *Member) Reset()

func (*Member) SizeVT

func (m *Member) SizeVT() (n int)

func (*Member) String

func (x *Member) String() string

func (*Member) UnmarshalVT

func (m *Member) UnmarshalVT(dAtA []byte) error

type MemberAddr

type MemberAddr struct {
	ListenAddr string
	ID         string
}

MemberAddr represents a reachable node in the cluster.

type MemberJoinEvent

type MemberJoinEvent struct {
	Member *Member
}

MemberJoinEvent gets triggered each time a new member enters the cluster.

type MemberLeaveEvent

type MemberLeaveEvent struct {
	Member *Member
}

MemberLeaveEvent gets triggered each time a member leaves the cluster.

type MemberSet

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

func NewMemberSet

func NewMemberSet(members ...*Member) *MemberSet

func (*MemberSet) Add

func (s *MemberSet) Add(member *Member)

func (*MemberSet) Contains

func (s *MemberSet) Contains(member *Member) bool

func (*MemberSet) Except

func (s *MemberSet) Except(members []*Member) []*Member

func (*MemberSet) FilterByKind

func (s *MemberSet) FilterByKind(kind string) []*Member

func (*MemberSet) ForEach

func (s *MemberSet) ForEach(fun func(m *Member) bool)

func (*MemberSet) GetByHost

func (s *MemberSet) GetByHost(host string) *Member

func (*MemberSet) Len

func (s *MemberSet) Len() int

func (*MemberSet) Remove

func (s *MemberSet) Remove(member *Member)

func (*MemberSet) RemoveByHost

func (s *MemberSet) RemoveByHost(host string)

func (*MemberSet) Slice

func (s *MemberSet) Slice() []*Member

type Members

type Members struct {
	Members []*Member `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
	// contains filtered or unexported fields
}

func (*Members) CloneMessageVT

func (m *Members) CloneMessageVT() proto.Message

func (*Members) CloneVT

func (m *Members) CloneVT() *Members

func (*Members) Descriptor deprecated

func (*Members) Descriptor() ([]byte, []int)

Deprecated: Use Members.ProtoReflect.Descriptor instead.

func (*Members) EqualMessageVT

func (this *Members) EqualMessageVT(thatMsg proto.Message) bool

func (*Members) EqualVT

func (this *Members) EqualVT(that *Members) bool

func (*Members) GetMembers

func (x *Members) GetMembers() []*Member

func (*Members) MarshalToSizedBufferVT

func (m *Members) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Members) MarshalToSizedBufferVTStrict

func (m *Members) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Members) MarshalToVT

func (m *Members) MarshalToVT(dAtA []byte) (int, error)

func (*Members) MarshalToVTStrict

func (m *Members) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Members) MarshalVT

func (m *Members) MarshalVT() (dAtA []byte, err error)

func (*Members) MarshalVTStrict

func (m *Members) MarshalVTStrict() (dAtA []byte, err error)

func (*Members) ProtoMessage

func (*Members) ProtoMessage()

func (*Members) ProtoReflect

func (x *Members) ProtoReflect() protoreflect.Message

func (*Members) Reset

func (x *Members) Reset()

func (*Members) SizeVT

func (m *Members) SizeVT() (n int)

func (*Members) String

func (x *Members) String() string

func (*Members) UnmarshalVT

func (m *Members) UnmarshalVT(dAtA []byte) error

type MembersJoin

type MembersJoin struct {
	Members []*Member `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
	// contains filtered or unexported fields
}

TODO: Deprecated

func (*MembersJoin) CloneMessageVT

func (m *MembersJoin) CloneMessageVT() proto.Message

func (*MembersJoin) CloneVT

func (m *MembersJoin) CloneVT() *MembersJoin

func (*MembersJoin) Descriptor deprecated

func (*MembersJoin) Descriptor() ([]byte, []int)

Deprecated: Use MembersJoin.ProtoReflect.Descriptor instead.

func (*MembersJoin) EqualMessageVT

func (this *MembersJoin) EqualMessageVT(thatMsg proto.Message) bool

func (*MembersJoin) EqualVT

func (this *MembersJoin) EqualVT(that *MembersJoin) bool

func (*MembersJoin) GetMembers

func (x *MembersJoin) GetMembers() []*Member

func (*MembersJoin) MarshalToSizedBufferVT

func (m *MembersJoin) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*MembersJoin) MarshalToSizedBufferVTStrict

func (m *MembersJoin) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*MembersJoin) MarshalToVT

func (m *MembersJoin) MarshalToVT(dAtA []byte) (int, error)

func (*MembersJoin) MarshalToVTStrict

func (m *MembersJoin) MarshalToVTStrict(dAtA []byte) (int, error)

func (*MembersJoin) MarshalVT

func (m *MembersJoin) MarshalVT() (dAtA []byte, err error)

func (*MembersJoin) MarshalVTStrict

func (m *MembersJoin) MarshalVTStrict() (dAtA []byte, err error)

func (*MembersJoin) ProtoMessage

func (*MembersJoin) ProtoMessage()

func (*MembersJoin) ProtoReflect

func (x *MembersJoin) ProtoReflect() protoreflect.Message

func (*MembersJoin) Reset

func (x *MembersJoin) Reset()

func (*MembersJoin) SizeVT

func (m *MembersJoin) SizeVT() (n int)

func (*MembersJoin) String

func (x *MembersJoin) String() string

func (*MembersJoin) UnmarshalVT

func (m *MembersJoin) UnmarshalVT(dAtA []byte) error

type MembersLeave

type MembersLeave struct {
	Members []*Member `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
	// contains filtered or unexported fields
}

func (*MembersLeave) CloneMessageVT

func (m *MembersLeave) CloneMessageVT() proto.Message

func (*MembersLeave) CloneVT

func (m *MembersLeave) CloneVT() *MembersLeave

func (*MembersLeave) Descriptor deprecated

func (*MembersLeave) Descriptor() ([]byte, []int)

Deprecated: Use MembersLeave.ProtoReflect.Descriptor instead.

func (*MembersLeave) EqualMessageVT

func (this *MembersLeave) EqualMessageVT(thatMsg proto.Message) bool

func (*MembersLeave) EqualVT

func (this *MembersLeave) EqualVT(that *MembersLeave) bool

func (*MembersLeave) GetMembers

func (x *MembersLeave) GetMembers() []*Member

func (*MembersLeave) MarshalToSizedBufferVT

func (m *MembersLeave) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*MembersLeave) MarshalToSizedBufferVTStrict

func (m *MembersLeave) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*MembersLeave) MarshalToVT

func (m *MembersLeave) MarshalToVT(dAtA []byte) (int, error)

func (*MembersLeave) MarshalToVTStrict

func (m *MembersLeave) MarshalToVTStrict(dAtA []byte) (int, error)

func (*MembersLeave) MarshalVT

func (m *MembersLeave) MarshalVT() (dAtA []byte, err error)

func (*MembersLeave) MarshalVTStrict

func (m *MembersLeave) MarshalVTStrict() (dAtA []byte, err error)

func (*MembersLeave) ProtoMessage

func (*MembersLeave) ProtoMessage()

func (*MembersLeave) ProtoReflect

func (x *MembersLeave) ProtoReflect() protoreflect.Message

func (*MembersLeave) Reset

func (x *MembersLeave) Reset()

func (*MembersLeave) SizeVT

func (m *MembersLeave) SizeVT() (n int)

func (*MembersLeave) String

func (x *MembersLeave) String() string

func (*MembersLeave) UnmarshalVT

func (m *MembersLeave) UnmarshalVT(dAtA []byte) error

type Producer

type Producer func(c *Cluster) actor.Producer

Producer is a function that produces an actor.Producer given a *cluster.Cluster. Pretty simple, but yet powerfull tool to construct receivers that are depending on Cluster.

func NewSelfManagedProvider

func NewSelfManagedProvider(config SelfManagedConfig) Producer

type SelectMemberFunc

type SelectMemberFunc func(ActivationDetails) *Member

SelectMemberFunc will be invoked during the activation process. Given the ActivationDetails the actor will be spawned on the returned member.

type SelfManaged

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

func (*SelfManaged) Receive

func (s *SelfManaged) Receive(c *actor.Context)

type SelfManagedConfig

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

func NewSelfManagedConfig

func NewSelfManagedConfig() SelfManagedConfig

func (SelfManagedConfig) WithBootstrapMember

func (c SelfManagedConfig) WithBootstrapMember(member MemberAddr) SelfManagedConfig

type Topology

type Topology struct {
	Hash    uint64    `protobuf:"varint,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Members []*Member `protobuf:"bytes,2,rep,name=members,proto3" json:"members,omitempty"`
	Left    []*Member `protobuf:"bytes,3,rep,name=left,proto3" json:"left,omitempty"`
	Joined  []*Member `protobuf:"bytes,4,rep,name=joined,proto3" json:"joined,omitempty"`
	Blocked []*Member `protobuf:"bytes,5,rep,name=blocked,proto3" json:"blocked,omitempty"`
	// contains filtered or unexported fields
}

func (*Topology) CloneMessageVT

func (m *Topology) CloneMessageVT() proto.Message

func (*Topology) CloneVT

func (m *Topology) CloneVT() *Topology

func (*Topology) Descriptor deprecated

func (*Topology) Descriptor() ([]byte, []int)

Deprecated: Use Topology.ProtoReflect.Descriptor instead.

func (*Topology) EqualMessageVT

func (this *Topology) EqualMessageVT(thatMsg proto.Message) bool

func (*Topology) EqualVT

func (this *Topology) EqualVT(that *Topology) bool

func (*Topology) GetBlocked

func (x *Topology) GetBlocked() []*Member

func (*Topology) GetHash

func (x *Topology) GetHash() uint64

func (*Topology) GetJoined

func (x *Topology) GetJoined() []*Member

func (*Topology) GetLeft

func (x *Topology) GetLeft() []*Member

func (*Topology) GetMembers

func (x *Topology) GetMembers() []*Member

func (*Topology) MarshalToSizedBufferVT

func (m *Topology) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Topology) MarshalToSizedBufferVTStrict

func (m *Topology) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error)

func (*Topology) MarshalToVT

func (m *Topology) MarshalToVT(dAtA []byte) (int, error)

func (*Topology) MarshalToVTStrict

func (m *Topology) MarshalToVTStrict(dAtA []byte) (int, error)

func (*Topology) MarshalVT

func (m *Topology) MarshalVT() (dAtA []byte, err error)

func (*Topology) MarshalVTStrict

func (m *Topology) MarshalVTStrict() (dAtA []byte, err error)

func (*Topology) ProtoMessage

func (*Topology) ProtoMessage()

func (*Topology) ProtoReflect

func (x *Topology) ProtoReflect() protoreflect.Message

func (*Topology) Reset

func (x *Topology) Reset()

func (*Topology) SizeVT

func (m *Topology) SizeVT() (n int)

func (*Topology) String

func (x *Topology) String() string

func (*Topology) UnmarshalVT

func (m *Topology) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

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