cluster

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor interface {
	OnReceive(ctx ActorContext)
}

type ActorContext

type ActorContext interface {
	vivid.ActorContext
	Cluster() *ActorSystem
}

type ActorProvider

type ActorProvider interface {
	// Provide 每次调用都应返回一个新的 Actor 实例,错误的使用可能导致 Actor 状态被污染。
	Provide() Actor
}

ActorProvider 是一个 Actor 生成器接口,它定义了生成 Actor 实例的方法。

type ActorSystem

type ActorSystem struct {
	*vivid.ActorSystem // 如果单独使用,那么一切行为将越过集群
	// contains filtered or unexported fields
}

func NewActorSystem

func NewActorSystem(sharedAddress, bindAddress prc.PhysicalAddress, configurator ...ActorSystemConfigurator) *ActorSystem

func (*ActorSystem) ActorOfC

func (sys *ActorSystem) ActorOfC(identity, ability string) vivid.ActorRef

ActorOfC 以特定身份获取集群中的对应能力 Actor 的引用

func (*ActorSystem) ClusterName

func (sys *ActorSystem) ClusterName() string

ClusterName 返回集群名称

func (*ActorSystem) ClusterRef

func (sys *ActorSystem) ClusterRef() vivid.ActorRef

ClusterRef 返回该集群的引用

func (*ActorSystem) JoinNodes

func (sys *ActorSystem) JoinNodes(addresses ...prc.PhysicalAddress) error

JoinNodes 动态的尝试加入集群节点

func (*ActorSystem) Name

func (sys *ActorSystem) Name() string

Name 返回节点名称

type ActorSystemConfiguration

type ActorSystemConfiguration struct {
	*vivid.ActorSystemConfiguration
	// contains filtered or unexported fields
}

func (*ActorSystemConfiguration) WithAbility

WithAbility 声明集群能提供的能力

func (*ActorSystemConfiguration) WithAdvertiseAddress

func (c *ActorSystemConfiguration) WithAdvertiseAddress(address prc.PhysicalAddress) *ActorSystemConfiguration

WithAdvertiseAddress 设置广告地址

func (*ActorSystemConfiguration) WithClusterName

func (c *ActorSystemConfiguration) WithClusterName(name string) *ActorSystemConfiguration

WithClusterName 设置集群名称

func (*ActorSystemConfiguration) WithName

WithName 设置集群内节点名称

func (*ActorSystemConfiguration) WithSeedNodes

func (c *ActorSystemConfiguration) WithSeedNodes(nodes ...string) *ActorSystemConfiguration

WithSeedNodes 设置默认散播的种子节点地址

func (*ActorSystemConfiguration) WithShared

WithShared 设置是否开启网络共享,开启后 ActorSystem 将允许通过网络与其他 ActorSystem 交互。

  • 默认的网络序列化是采用的 ProtoBuffer,如果需要调整,可指定编解码器

在集群模式下,address 的值将被 advertiseAddress 所取代,但 codec 仍然有效

type ActorSystemConfigurator

type ActorSystemConfigurator interface {
	// Configure 配置 ActorSystem
	Configure(config *ActorSystemConfiguration)
}

ActorSystemConfigurator 是用于配置 ActorSystem 的配置器

type FunctionalActor

type FunctionalActor func(ctx ActorContext)

func (FunctionalActor) OnReceive

func (f FunctionalActor) OnReceive(ctx ActorContext)

type FunctionalActorProvider

type FunctionalActorProvider func() Actor

FunctionalActorProvider 是一个函数类型的 Actor 生成器,它定义了生成 Actor 实例的方法。

func (FunctionalActorProvider) Provide

func (f FunctionalActorProvider) Provide() Actor

Provide 每次调用都应返回一个新的 Actor 实例,错误的使用可能导致 Actor 状态被污染。

type FunctionalActorSystemConfigurator

type FunctionalActorSystemConfigurator func(config *ActorSystemConfiguration)

FunctionalActorSystemConfigurator 是用于配置 ActorSystem 的配置器

func (FunctionalActorSystemConfigurator) Configure

Configure 配置 ActorSystem

type IdentityMaintainer

type IdentityMaintainer interface {
}

IdentityMaintainer 身份维护者是用于查询集群节点成员的接口

Directories

Path Synopsis
internal
cm

Jump to

Keyboard shortcuts

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