Documentation
¶
Index ¶
- Constants
- Variables
- func RegisterMessage(message Message)
- func RegisterMessageName(name string, message Message)
- type AccidentRecord
- type Actor
- type ActorConfiguration
- type ActorConfigurator
- type ActorConfiguratorFn
- type ActorContext
- type ActorContextLife
- type ActorContextLogger
- type ActorContextPersistent
- type ActorContextProcess
- type ActorContextSpawner
- type ActorContextTiming
- type ActorContextTransport
- type ActorContextTransportInteractive
- type ActorFn
- type ActorOptions
- type ActorOptionsFetcher
- type ActorProvider
- type ActorProviderFn
- type ActorRef
- type ActorSpawnChain
- type ActorSystem
- type ActorSystemBuilder
- func (builder ActorSystemBuilder) Build() ActorSystem
- func (builder ActorSystemBuilder) FromConfiguration(config ActorSystemConfiguration) ActorSystem
- func (builder ActorSystemBuilder) FromConfigurators(configurators ...ActorSystemConfigurator) ActorSystem
- func (builder ActorSystemBuilder) FromCustomize(configuration ActorSystemConfiguration, ...) ActorSystem
- type ActorSystemConfiguration
- type ActorSystemConfigurator
- type ActorSystemConfiguratorFn
- type ActorSystemOptions
- type ActorSystemOptionsFetcher
- type Addr
- type Codec
- type CodecProvider
- type CodecProviderFn
- type DedicatedOnKill
- type DedicatedOnKillFailed
- type DedicatedOnKilled
- type DedicatedOnLaunch
- type DedicatedOnPing
- type DedicatedOnUnwatch
- type DedicatedOnWatch
- type DedicatedOnWatchStopped
- type DedicatedPong
- type Dispatcher
- type DispatcherProvider
- type DispatcherProviderFn
- type Envelope
- type EnvelopeBuilder
- type Future
- type FutureAdaptation
- type FutureAdapter
- type Host
- type ID
- type IDBuilder
- type LaunchContextProvider
- type LaunchContextProviderFn
- type Mailbox
- type MailboxProvider
- type MailboxProviderFn
- type Message
- type MessageType
- type OnKill
- type OnKillBuilder
- type OnKillFailed
- type OnKillFailedBuilder
- type OnKilled
- type OnKilledBuilder
- type OnLaunch
- type OnLaunchBuilder
- type OnPing
- type OnPingBuilder
- type OnUnwatch
- type OnUnwatchBuilder
- type OnWatch
- type OnWatchBuilder
- type OnWatchStopped
- type OnWatchStoppedBuilder
- type Path
- type PersistentStorage
- type Pong
- type PongBuilder
- type Process
- type Recipient
- type RemoteMessageBuilder
- type Supervisor
- type SupervisorFn
- type TimingTask
- type TimingTaskFn
- type WatchHandler
- type WatchHandlerFn
Constants ¶
const (
DefaultFutureTimeout = time.Second
)
Variables ¶
var ErrorFutureTimeout = fmt.Errorf("future timeout")
Functions ¶
func RegisterMessage ¶
func RegisterMessage(message Message)
RegisterMessage 是 gob.Register 的快捷方式,用于注册消息类型
- 当需要跨网络传输且采用默认的 gob 编码器时,需要通过此方法注册你的消息类型
func RegisterMessageName ¶
RegisterMessageName 是 gob.RegisterName 的快捷方式,用于注册消息类型
- 当需要跨网络传输且采用默认的 gob 编码器时,需要通过此方法注册你的消息类型
Types ¶
type AccidentRecord ¶
type AccidentRecord interface { // ActorContext 获取当前责任人上下文 ActorContext() ActorContext // GetPrimeCulprit 获取事故元凶,即导致事故的消息发送人 GetPrimeCulprit() ActorRef // GetVictim 获取事故受害者,即接收到导致事故的消息的 Actor GetVictim() ActorRef // GetMessage 获取导致事故的消息 GetMessage() Message // GetReason 获取事故原因 GetReason() Message // GetStack 获取事件堆栈 GetStack() []byte // GetRestartCount 获取重启次数 GetRestartCount() int // Kill 立即停止目标 Actor 继续运行 Kill(ref ActorRef, reason ...string) // PoisonKill 在目标 Actor 处理完剩余消息后停止其运行 PoisonKill(ref ActorRef, reason ...string) // Resume 忽略本条消息并恢复事故受害者的运行 Resume() // Restart 重启目标 Actor,并在重启后继续处理剩余消息 Restart(ref ActorRef, reason ...string) // ExponentialBackoffRestart 退避指数重启 ExponentialBackoffRestart(ref ActorRef, restartCount int, baseDelay, maxDelay time.Duration, multiplier, randomization float64, reason ...string) // Escalate 将事故升级至上级 Actor 处理 Escalate() // contains filtered or unexported methods }
AccidentRecord 事故记录信息,当事故发生时必须通过任一非 Get 方法来处理事故,当事故未被处理时将会自动进一步升级
type Actor ¶
type Actor interface { // OnReceive 当 Actor 接收到消息时,将调用此方法 OnReceive(ctx ActorContext) }
Actor 是由用户定义的 Actor 行为接口,他将对 Actor 所收到的消息进行处理
type ActorConfiguration ¶
type ActorConfiguration interface { ActorOptions ActorOptionsFetcher // InitDefault 初始化 Actor 的默认配置 InitDefault() ActorConfiguration }
ActorConfiguration 是 Actor 的配置接口
func NewActorConfig ¶
func NewActorConfig(parent ActorContext) ActorConfiguration
NewActorConfig 创建 Actor 的配置
type ActorConfigurator ¶
type ActorConfigurator interface { // Configure 配置 Actor Configure(config ActorConfiguration) }
ActorConfigurator 是 Actor 的配置接口
type ActorConfiguratorFn ¶
type ActorConfiguratorFn func(config ActorConfiguration)
ActorConfiguratorFn 是 Actor 的配置函数接口
func (ActorConfiguratorFn) Configure ¶
func (f ActorConfiguratorFn) Configure(config ActorConfiguration)
Configure 配置 Actor
type ActorContext ¶
type ActorContext interface {
// contains filtered or unexported methods
}
ActorContext 定义了一个完整的 Actor 上下文,包含了与 Actor 运行相关的所有信息和功能。 它是 Actor 生命周期管理和消息处理的重要组成部分,提供了多种方法用于管理 Actor 状态、调度消息、访问上下文信息等。
使用 ActorContext 时,必须严格遵循以下注意事项:
- 在没有明确需求的情况下,不要将 ActorContext 传递给 Actor.OnReceive 以外的地方, 以避免潜在的状态泄露问题,这可能导致数据竞争(race condition)或不一致的行为。
- ActorContext 内的所有方法在 Actor.OnReceive 内调用时是并发安全的,确保消息处理的线程安全性。 然而,当在 Actor.OnReceive 之外调用时,必须格外注意并发安全问题,可能需要额外的同步机制来保证线程安全。
- 在多个 Actor 之间传递消息时,应当避免不必要的跨 Actor 边界的调用, 以确保系统的可扩展性和并发性能。
总之,ActorContext 是 Actor 系统中的关键组件,合理使用和管理 ActorContext 对于系统的稳定性、可维护性和性能至关重要。 需要在设计和实现中遵循并发安全原则,并尽量避免不必要的状态共享和副作用。
type ActorContextLife ¶
type ActorContextLife interface { // System 获取当前 Actor 所在的 ActorSystem。 // // 该方法返回一个 ActorSystem 实例,表示当前 Actor 所处的系统环境, // 该系统负责管理 Actor 的生命周期、消息调度和资源分配。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 System() ActorSystem // Parent 获取当前 Actor 的父 Actor 引用。 // // 该方法返回当前 Actor 的父 Actor 的引用(ActorRef), // 通常用于 Actor 之间的层级关系管理。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 Parent() ActorRef // Ref 获取当前 Actor 的引用。 // // 该方法返回当前 Actor 的 ActorRef, // 如果通过 ActorSystem 获取该 Actor,将返回根 Actor 的引用。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 Ref() ActorRef }
ActorContextLife 是 ActorContext 的子集,它提供了对于 Actor 生命周期中的一些信息的访问及控制。
type ActorContextLogger ¶
type ActorContextLogger interface { // Logger 获取 Actor 的日志记录器。 // // 该方法返回一个日志记录器实例,可以用于在 Actor 内部进行日志记录。 // 返回的 Logger 可用于调试、错误跟踪和系统监控。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 Logger() log.Logger }
ActorContextLogger 是 ActorContext 的一个子集,专注于日志记录与追踪。 它提供了日志功能,允许在 Actor 的生命周期中记录重要事件、状态变更、错误信息等。 使用 ActorContextLogger 时,需要合理设计日志的记录频率与内容,避免日志泛滥或漏记录关键事件。 同时,应确保日志记录不影响 Actor 的性能和响应时间,且能准确反映系统的状态。
type ActorContextPersistent ¶
type ActorContextPersistent interface { // Snapshot 为当前 Actor 创建持久化快照并移除历史事件。 Snapshot(snapshot Message) // Persist 主动将当前 Actor 的快照和事件持久化存储。 Persist() error // IsPersistentRecovering 判断当前 Actor 是否正在进行持久化恢复 IsPersistentRecovering() bool // GetPersistentEventNum 获取当前 Actor 的持久化事件数量,可用于判断是否需要生成快照 GetPersistentEventNum() int }
type ActorContextProcess ¶
type ActorContextProcess interface{}
ActorContextProcess 是 ActorContext 的一个子集,专注于处理与 Actor 相关的进程(Process)操作。 它确保了 Actor 在进程层面上的操作逻辑,如进程的启动、停止以及相关资源的管理。 使用 ActorContextProcess 时,确保仅在必要时进行进程管理操作,避免不必要的进程状态泄露。 此接口的实现应保证进程操作的并发安全性,并且严格按照 Actor 生命周期进行操作。
type ActorContextSpawner ¶
type ActorContextSpawner interface { // ActorOf 创建并返回一个新的 Actor 实例。 // // 该方法通过提供者和可选的配置器生成新的 Actor,返回值为 Actor 的引用(ActorRef)。 // 使用此方法时,确保提供的 ActorProvider 和配置器能够正确初始化 Actor。 // // 该函数在多个 goroutine 中调用时无法保证并发安全。 ActorOf(provider ActorProvider, configurator ...ActorConfigurator) ActorRef // ActorOfFn 使用函数式编程方式生成新的 Actor。 // // 该方法接收一个 ActorProviderFn 和可选的 ActorConfiguratorFn,用于生成并返回一个新的 Actor 实例。 // 使用函数式接口可以灵活地配置 Actor 的创建过程。 // // 该函数在多个 goroutine 中调用时无法保证并发安全。 ActorOfFn(provider ActorProviderFn, configurator ...ActorConfiguratorFn) ActorRef // ActorOfConfig 使用配置化方式生成 Actor。 // // 参数 `config` 是一个 ActorConfiguration 实例,包含了创建 Actor 所需的配置。 // 使用此方法时,可以根据特定的配置生成 Actor。 // // 该函数在多个 goroutine 中调用时无法保证并发安全。 ActorOfConfig(provider ActorProvider, config ActorConfiguration) ActorRef // ChainOf 通过责任链模式生成一个新的 Actor。 // // 该方法通过 ActorProvider 创建 Actor,并将多个处理步骤链接在一起形成责任链。 // 使用此方法时,可以灵活配置 Actor 的创建流程。 // // 该函数在多个 goroutine 中调用时无法保证并发安全。 ChainOf(provider ActorProvider) ActorSpawnChain }
ActorContextSpawner 是 ActorContext 的一个子集,负责 Actor 的生成与生命周期管理。 它提供了接口用于创建子 Actor 生命周期。
type ActorContextTiming ¶
type ActorContextTiming interface { // After 创建一个延迟执行的任务,该任务将在指定的时间后被发送到 Actor 的邮箱。 // // 参数 `name` 为任务名称,`duration` 为延迟时间,`task` 为延迟执行的任务。 // 该任务将在指定时间后执行,通常用于延时处理。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // // 需要注意: // - 需要避免在 TimingTask 中将 ActorContext 传递到外部进行使用。 After(name string, duration time.Duration, task TimingTask) // ForeverLoop 创建一个循环执行的定时任务,该任务将在第一次执行后每隔一段时间继续执行。 // // 参数 `name` 为任务名称,`duration` 为首次执行的延迟时间,`interval` 为循环执行的间隔时间,`task` 为要执行的任务。 // 该任务会持续执行,直到显式停止或系统终止。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // // 需要注意: // - 需要避免在 TimingTask 中将 ActorContext 传递到外部进行使用。 ForeverLoop(name string, duration, interval time.Duration, task TimingTask) // Loop 创建一个具有次数限制的循环任务,该任务将在指定的延迟时间后首次执行,并根据设定的间隔时间执行。 // // 参数 `name` 为任务名称,`duration` 为首次执行的延迟时间,`interval` 为间隔时间,`times` 为任务执行的次数。 // 当 times 的值为 0 时,任务将不会被执行,如果 times 的值为负数,那么任务将永远不会停止,除非主动停止 // 该任务会在执行次数达到预定值时停止。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // // 需要注意: // - 需要避免在 TimingTask 中将 ActorContext 传递到外部进行使用。 Loop(name string, duration, interval time.Duration, times int, task TimingTask) // Cron 创建一个基于 cron 表达式的定时任务,该任务根据给定的 cron 表达式定时执行。 // // 参数 `name` 为任务名称,`cron` 为 cron 表达式,`task` 为要执行的任务。 // 该任务的执行时间由 cron 表达式决定,可以在指定时间内多次触发执行。 // 如果 cron 表达式无效,函数将返回错误。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // // 需要注意: // - 需要避免在 TimingTask 中将 ActorContext 传递到外部进行使用。 // // 表达式说明可参阅:https://github.com/gorhill/cronexpr Cron(name string, cron string, task TimingTask) error // StopTimingTask 停止指定名称的定时任务。 // // 该方法会停止指定名称的定时任务,并清理相关资源。使用时确保提供正确的任务名称。 // 当名称无效时,不会发生任何反应。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 StopTimingTask(name string) // ClearTimingTasks 停止当前所有正在执行或尚未执行的定时任务。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 ClearTimingTasks() }
ActorContextTiming 是 ActorContext 的一个子集,提供了与定时器相关的功能。 它允许在 Actor 中设置定时任务(如定时执行某些操作、周期性事件等), 并确保定时任务的调度和执行过程符合 Actor 的并发模型。 在使用 ActorContextTiming 时,应避免不必要的定时任务重入或调度冲突,以保证系统的性能和稳定性。
type ActorContextTransport ¶
type ActorContextTransport interface { ActorContextTransportInteractive // Sender 返回当前消息的发送者(ActorRef),用于标识并与发送该消息的 Actor 进行交互。 // // 注意事项: // - 该函数始终返回一个有效的 ActorRef,如果当前消息没有明确的发送者,则可能返回一个匿名引用或系统默认的引用。 // - 该函数是并发安全的,可以安全地在多个 goroutine 中调用。 // - 返回的 ActorRef 只能用于消息传递,不能直接访问对方的内部状态,否则会破坏 Actor 的封装性和隔离性。 Sender() ActorRef // Message 返回当前待处理的消息,调用者可以通过该方法获取具体的消息内容。 // // 注意事项: // - 该函数始终返回一个有效的 Message 对象,调用者需要根据消息的具体类型进行处理。 // - 该函数是并发安全的,可以安全地在多个 goroutine 中调用。 Message() Message // Reply 向当前消息的发送者(Sender)回复一个消息。 // 该方法是 ActorContextTransportInteractive.Tell 的快捷方式,简化了回复操作。 // // 使用规则: // - 该函数可以在 Actor 处理当前消息时随时调用,且可以多次回复不同的消息。 // - 若当前消息没有明确的发送者(例如系统消息或匿名请求),则调用该方法不会产生任何效果。 // - 该函数是并发安全的,可以安全地在多个 goroutine 中调用。 // - 如果是在跨网络通讯中,回复的消息 `message` 必须是可被 Codec 序列化的,否则可能导致传输失败或异常行为。 // - 避免在 Reply 之后继续使用 `message`,以防止意外的并发修改。 Reply(message Message) }
ActorContextTransport 是 ActorContext 的一个子集,定义了 Actor 之间的通信接口。 它负责实现 Actor 之间的消息传递、数据交换和远程调用等功能。 使用 ActorContextTransport 时,必须确保消息传递的可靠性和高效性,避免数据丢失或通信阻塞。 需要特别关注网络延迟和异常情况的处理,确保在并发环境下的稳定通信。
type ActorContextTransportInteractive ¶
type ActorContextTransportInteractive interface { // Kill 忽略一切尚未处理的消息,立即终止目标 Actor。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // 在调用时会强制终止目标 Actor,忽略所有待处理消息,这可能导致目标 Actor 内部状态的不一致, // 请谨慎使用,特别是在 Actor 状态不允许被中断的场景中。 Kill(target ActorRef, reason ...string) // PoisonKill 等待目标 Actor 处理完当前所有消息后终止目标 Actor。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // 与 Kill 不同,PoisonKill 会确保目标 Actor 完成当前剩余消息的处理后再终止, // 这种方式适用于希望目标 Actor 在终止前完成当前工作或清理的场景。 PoisonKill(target ActorRef, reason ...string) // Tell 向指定的 Actor 发送消息。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // 该方法将消息发送到目标 Actor,目标 Actor 会在其消息处理队列中接收到该消息。 // 此方法不会等待处理结果,适合于单向的消息传递。 Tell(target ActorRef, message Message) // Ask 向目标 Actor 发送消息,并返回一个 Future 用于获取结果。 // - 如果 timeout 参数不存在,那么将会在 DefaultFutureTimeout 时间内等待结果。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // Ask 是一个请求-响应模式的操作,发送消息后会返回一个 Future 对象, // 可以通过该 Future 对象等待目标 Actor 返回的响应消息,适合于需要获取结果的场景。 Ask(target ActorRef, message Message, timeout ...time.Duration) Future[Message] // Broadcast 向所有子 Actor 发送消息。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // 该方法将消息广播到所有当前 Actor 的子 Actor,适合用于群发通知或信息同步等场景。 Broadcast(message Message) // Ping 尝试对目标 Actor 发送 Ping 消息,并返回 Pong 消息。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // Ping 通过向目标 Actor 发送 Ping 消息来测试与其的连接是否正常,目标 Actor 在收到后将会返回 Pong 消息。 // 适用于检查连接健康状态或进行通信确认。 Ping(target ActorRef, timeout ...time.Duration) (Pong, error) // Watch 监视目标 Actor 的生命周期,当目标 Actor 终止时,会收到 OnWatchStopped 消息。 // 该函数会向目标 Actor 发送 Watch 消息,目标 Actor 收到 Watch 消息后会将自己加入到监视列表中。 // - 如果传入了 handler 函数,那么当目标 Actor 终止时,会调用 handler 函数,而不再投递 OnWatchStopped 消息。 // - handler 的调用是在当前 Actor 中作为消息进行处理的。 // - 如果 handler 存在多个,那么会按照顺序调用。 // - 重复的调用会追加更多的 handler。 // // 该函数在多个 goroutine 中调用时无法保证并发安全。 // Watch 用于监控目标 Actor 的生命周期,通常用于 Actor 之间的依赖管理或资源清理。 // 在使用时应注意 handler 的执行顺序。 Watch(target ActorRef, handlers ...WatchHandler) error // Unwatch 取消监视目标 Actor 的生命周期。 // // 该函数在多个 goroutine 中调用时无法保证并发安全。 // 调用该方法将取消当前 Actor 对目标 Actor 的监视,并停止接收 OnWatchStopped 消息。 // 如果在 Watch 中注册了 handler,那么 handler 将不再被触发。 Unwatch(target ActorRef) // Restart 重启目标 Actor。 // // 该函数是并发安全的,可以在多个 goroutine 中调用。 // Restart 会重新启动目标 Actor,给定是否优雅重启的标志, // 优雅重启会等待目标 Actor 完成当前处理的任务后再进行重启,适用于对 Actor 状态要求较高的场景。 Restart(target ActorRef, gracefully bool, reason ...string) }
ActorContextTransportInteractive 是 ActorContextTransport 的一个子集,专门处理 Actor 之间的交互操作。 它提供了一些方法,用于与其他 Actor 进行消息传递、生命周期管理等交互操作。 使用 ActorContextTransportInteractive 时,应确保交互操作的顺序性和一致性,以避免出现并发问题。
type ActorFn ¶
type ActorFn func(ctx ActorContext)
ActorFn 是 Actor 的函数实现
func (ActorFn) OnReceive ¶
func (f ActorFn) OnReceive(ctx ActorContext)
OnReceive 当 Actor 接收到消息时,将调用此方法
type ActorOptions ¶
type ActorOptions interface { options.LogicOptions[ActorOptionsFetcher, ActorOptions] // WithReadOnly 设置 Actor 的配置为只读 WithReadOnly() ActorConfiguration // WithLoggerProvider 设置 Actor 的日志记录器获取器 WithLoggerProvider(provider log.Provider) ActorConfiguration // WithName 设置 Actor 的名称 WithName(name string) ActorConfiguration // WithDispatcher 设置 Actor 的调度器 WithDispatcher(provider DispatcherProvider) ActorConfiguration // WithMailbox 设置 Actor 的邮箱 WithMailbox(provider MailboxProvider) ActorConfiguration // WithLaunchContextProvider 设置 Actor 的启动上下文提供者 // - 通过使用提供者的方式,允许 Actor 在每一次启动时都能获取到不同的启动上下文 // // 提供者如果返回的是空指针,不会引发任何异常,但会导致 Actor 在启动时无法获取到启动上下文 WithLaunchContextProvider(provider LaunchContextProvider) ActorConfiguration // WithSupervisor 设置 Actor 的监管者,监管者用于对 Actor 异常情况进行监管策略的执行 WithSupervisor(supervisor Supervisor) ActorConfiguration // WithTimingWheel 设置 Actor 的定时器 // - 如果 Actor 需要使用大量的定时器,可通过该选项指定独立的定时器 // - 默认使用的是 ActorSystem 的全局定时器 WithTimingWheel(timing timing.Wheel) ActorConfiguration // WithSlowMessageThreshold 设置 Actor 的慢消息阈值,覆盖 ActorSystem 的全局慢消息阈值 // - 用于设置 Actor 处理消息的阈值,当消息处理时间超过该阈值时,会记录一条 WARN 级别日志 // - 当阈值为 <= 0 时,不会记录任何日志 WithSlowMessageThreshold(threshold time.Duration) ActorConfiguration // WithPersistent 设置 Actor 为持久化 Actor // - 持久化 Actor 会将持久化消息进行记录,并在 Actor 重启时进行恢复 // - 设置 interval 可指定持久化消息的自动存储间隔,当 <= 0 时,不会自动存储,需要主动调用 ActorContextPersistent.Persist 方法 WithPersistent(persistentId string, interval time.Duration, storage PersistentStorage) ActorConfiguration }
ActorOptions 是 Actor 的配置接口,描述了 Actor 的各项行为
type ActorOptionsFetcher ¶
type ActorOptionsFetcher interface { // FetchReadOnly 获取 Actor 的配置是否为只读 FetchReadOnly() bool // FetchLogger 获取 Actor 的日志记录器获取器 FetchLogger() log.Logger // FetchName 获取 Actor 的名称 FetchName() string // FetchDispatcher 获取 Actor 的调度器 FetchDispatcher() DispatcherProvider // FetchMailbox 获取 Actor 的邮箱 FetchMailbox() MailboxProvider // FetchLoggerProvider 获取 Actor 的日志记录器获取器 FetchLoggerProvider() log.Provider // FetchLaunchContextProvider 获取 Actor 的启动上下文提供者 FetchLaunchContextProvider() LaunchContextProvider // FetchSupervisor 获取 Actor 的监管者 FetchSupervisor() Supervisor // FetchTimingWheel 获取 Actor 的定时器 FetchTimingWheel() timing.Wheel // FetchSlowMessageThreshold 获取 Actor 的慢消息阈值 FetchSlowMessageThreshold() time.Duration // FetchPersistentId 获取 Actor 的持久化 ID FetchPersistentId() string // FetchPersistentInterval 获取 Actor 的持久化间隔 FetchPersistentInterval() time.Duration // FetchPersistentStorage 获取 Actor 的持久化存储器 FetchPersistentStorage() PersistentStorage }
ActorOptionsFetcher 是 Actor 的配置获取接口
type ActorProvider ¶
type ActorProvider interface { // Provide 提供一个 Actor 实例 Provide() Actor }
ActorProvider 是 Actor 的提供者接口,他将提供 Actor 实例
type ActorSpawnChain ¶
type ActorSpawnChain interface { // SetConfig 设置 ActorConfiguration SetConfig(config ActorConfiguration) ActorSpawnChain // SetConfigurator 设置 ActorConfigurator SetConfigurator(configurator ActorConfigurator) ActorSpawnChain // SetFnConfigurator 设置 ActorConfiguratorFn SetFnConfigurator(configurator ActorConfiguratorFn) ActorSpawnChain // AddNextConfigurator 添加 ActorConfigurator AddNextConfigurator(configurator ActorConfigurator) ActorSpawnChain // AddNextFnConfigurator 添加 ActorConfiguratorFn AddNextFnConfigurator(configurator ActorConfiguratorFn) ActorSpawnChain // ActorOf 生成 Actor ActorOf() ActorRef }
ActorSpawnChain 是 Actor 生成链,用于生成 Actor
type ActorSystem ¶
type ActorSystem interface { ActorContextSpawner ActorContextLife ActorContextLogger ActorContextTransportInteractive // Start 启动 Actor 系统 Start() error // StartP 启动 Actor 系统,并在发生异常时 panic StartP() ActorSystem // Shutdown 关闭 Actor 系统 Shutdown() error // ShutdownP 关闭 Actor 系统,并在发生异常时 panic ShutdownP() ActorSystem // contains filtered or unexported methods }
ActorSystem 是完整的 Actor 系统的接口,它包含了对于 Actor Model 的完整实现。
- Actor 系统是基于 Actor 模式的并发编程模型,负责管理和调度 Actor 实例。
- 它提供了创建、监控、发送消息、以及终止 Actor 的功能。
- 在 Actor 系统中,所有的操作都是通过消息传递的方式进行的,
- 其中每个 Actor 都是独立的计算单元,通过收发消息与其他 Actor 进行交互。
Actor 系统的设计遵循了高并发和低耦合的原则,能够有效地处理大量并发任务, 同时避免传统线程模型中的共享状态问题和锁竞争问题。 这使得 Actor 系统在需要高并发、分布式计算和容错的场景中非常适用。
func NewActorSystem ¶
func NewActorSystem(configurator ...ActorSystemConfigurator) ActorSystem
NewActorSystem 该函数是综合了 ActorSystemBuilder 的快捷创建方法
- 如果不传入任何配置器,则会使用默认配置创建 ActorSystem 实例
- 如果传入配置器,则会使用配置器创建 ActorSystem 实例
type ActorSystemBuilder ¶
type ActorSystemBuilder struct{}
ActorSystemBuilder 是 ActorSystem 的构建器
func GetActorSystemBuilder ¶
func GetActorSystemBuilder() ActorSystemBuilder
GetActorSystemBuilder 返回 ActorSystem 的构建器
func (ActorSystemBuilder) Build ¶
func (builder ActorSystemBuilder) Build() ActorSystem
Build 用于构建 ActorSystem 实例
func (ActorSystemBuilder) FromConfiguration ¶
func (builder ActorSystemBuilder) FromConfiguration(config ActorSystemConfiguration) ActorSystem
FromConfiguration 通过配置构建 ActorSystem 实例
func (ActorSystemBuilder) FromConfigurators ¶
func (builder ActorSystemBuilder) FromConfigurators(configurators ...ActorSystemConfigurator) ActorSystem
FromConfigurators 通过配置器构建 ActorSystem 实例
func (ActorSystemBuilder) FromCustomize ¶
func (builder ActorSystemBuilder) FromCustomize(configuration ActorSystemConfiguration, configurators ...ActorSystemConfigurator) ActorSystem
FromCustomize 通过自定义配置构建 ActorSystem 实例
type ActorSystemConfiguration ¶
type ActorSystemConfiguration interface { ActorSystemOptions ActorSystemOptionsFetcher // InitDefault 初始化 ActorSystem 的默认配置 InitDefault() ActorSystemConfiguration }
ActorSystemConfiguration 是 ActorSystem 的配置接口
func NewActorSystemConfig ¶
func NewActorSystemConfig() ActorSystemConfiguration
NewActorSystemConfig 创建一个用于 ActorSystem 的默认配置器
type ActorSystemConfigurator ¶
type ActorSystemConfigurator interface { // Configure 配置 ActorSystem Configure(config ActorSystemConfiguration) }
ActorSystemConfigurator 是 ActorSystem 的配置接口,它允许结构化的配置 ActorSystem
type ActorSystemConfiguratorFn ¶
type ActorSystemConfiguratorFn func(config ActorSystemConfiguration)
ActorSystemConfiguratorFn 是 ActorSystem 的配置接口,它允许通过函数式的方式配置 ActorSystem
func (ActorSystemConfiguratorFn) Configure ¶
func (f ActorSystemConfiguratorFn) Configure(config ActorSystemConfiguration)
type ActorSystemOptions ¶
type ActorSystemOptions interface { options.LogicOptions[ActorSystemOptionsFetcher, ActorSystemOptions] // WithReadOnly 设置 ActorSystem 的配置为只读 WithReadOnly() ActorSystemOptionsFetcher // WithName 设置 ActorSystem 的名称 WithName(name string) ActorSystemConfiguration // WithLoggerProvider 设置 ActorSystem 的日志记录器提供者 // - 提供者不应在每次都返回一个新的示例,应返回当前所使用的示例 WithLoggerProvider(provider log.Provider) ActorSystemConfiguration // WithCodec 设置 ActorSystem 的编解码器,仅在通过 WithListen 设置了监听地址后有效 WithCodec(codec CodecProvider, builder RemoteMessageBuilder) ActorSystemConfiguration // WithListen 设置 ActorSystem 的监听地址,该方法会覆盖 WithListener 方法 // - 监听地址应该为一个有效的 TCP 地址,例如 ":8080" // - 当监听地址不合法时,将会产生 panic WithListen(address string) ActorSystemOptionsFetcher // WithListener 设置 ActorSystem 的监听器,该方法会覆盖 WithListen 方法 WithListener(listener net.Listener) ActorSystemOptionsFetcher // WithDefaultSupervisorRestartLimit 设置 ActorSystem 的默认 Supervisor 重启次数限制 WithDefaultSupervisorRestartLimit(limit int) ActorSystemOptionsFetcher // WithSlowMessageThreshold 设置 ActorSystem 的慢消息阈值 // - 当消息处理时间超过阈值时,将会产生一条警告日志 // - 阈值为 0 时,表示关闭慢消息检测,默认值为 500ms WithSlowMessageThreshold(threshold time.Duration) ActorSystemOptionsFetcher }
ActorSystemOptions 是 ActorSystem 的配置选项
type ActorSystemOptionsFetcher ¶
type ActorSystemOptionsFetcher interface { // FetchReadOnly 获取 ActorSystem 的配置是否为只读 FetchReadOnly() bool // FetchName 获取 ActorSystem 的名称 FetchName() string // FetchLogger 获取 ActorSystem 的日志记录器 FetchLogger() log.Logger // FetchLoggerProvider 获取 ActorSystem 的日志记录器提供者 FetchLoggerProvider() log.Provider // FetchCodec 获取 ActorSystem 的编解码器 FetchCodec() CodecProvider // FetchRemoteMessageBuilder 获取 ActorSystem 的远程消息构建器 FetchRemoteMessageBuilder() RemoteMessageBuilder // FetchListener 获取 ActorSystem 的监听器 FetchListener() net.Listener // FetchDefaultSupervisorRestartLimit 获取 ActorSystem 的默认 Supervisor 重启次数限制 FetchDefaultSupervisorRestartLimit() int // FetchSlowMessageThreshold 获取 ActorSystem 的慢消息阈值 FetchSlowMessageThreshold() time.Duration }
ActorSystemOptionsFetcher 是 ActorSystem 的配置选项获取器
type CodecProvider ¶
type CodecProvider interface {
Provide() Codec
}
type CodecProviderFn ¶
type CodecProviderFn func() Codec
func (CodecProviderFn) Provide ¶
func (f CodecProviderFn) Provide() Codec
type DedicatedOnKill ¶
type DedicatedOnKill struct{}
DedicatedOnKill 是 OnKill 的专用标记实现,它可以用来实现自定义的 OnKill 消息
type DedicatedOnKillFailed ¶
type DedicatedOnKillFailed struct{}
DedicatedOnKillFailed 是 OnKillFailed 的专用标记实现,它可以用来实现自定义的 OnKillFailed 消息
type DedicatedOnKilled ¶
type DedicatedOnKilled struct{}
type DedicatedOnLaunch ¶
type DedicatedOnLaunch struct{}
type DedicatedOnPing ¶
type DedicatedOnPing struct{}
DedicatedOnPing 是 OnPing 的专用标记实现,它可以用来实现自定义的 OnPing 消息
type DedicatedOnUnwatch ¶
type DedicatedOnUnwatch struct{}
DedicatedOnUnwatch 是 OnUnwatch 的专用标记实现,它可以用来实现自定义的 OnUnwatch 消息
type DedicatedOnWatch ¶
type DedicatedOnWatch struct{}
DedicatedOnWatch 是 OnWatch 的专用标记实现,它可以用来实现自定义的 OnWatch 消息
type DedicatedOnWatchStopped ¶
type DedicatedOnWatchStopped struct {
Ref ActorRef
}
DedicatedOnWatchStopped 是 OnWatchStopped 的专用标记实现,它可以用来实现自定义的 OnWatchStopped 消息
type Dispatcher ¶
type Dispatcher interface {
Dispatch(handler func())
}
type DispatcherProvider ¶
type DispatcherProvider interface {
Provide() Dispatcher
}
type DispatcherProviderFn ¶
type DispatcherProviderFn func() Dispatcher
func (DispatcherProviderFn) Provide ¶
func (f DispatcherProviderFn) Provide() Dispatcher
type Envelope ¶
type Envelope interface { // GetAgent 获取消息代理的 ID GetAgent() ID // GetSender 获取消息发送者的 ID GetSender() ID // GetReceiver 获取消息接收者的 ID GetReceiver() ID // GetMessage 获取消息的内容 GetMessage() Message // GetMessageType 获取消息的类型 GetMessageType() MessageType // SetMessage 设置消息的内容 SetMessage(message Message) }
Envelope 是进程间通信的消息包装,包含原始消息内容和附加的头部信息,支持跨网络传输。
- 如果需要支持其他序列化方式,可以通过实现 Envelope 接口并自定义消息包装,同时实现 EnvelopeBuilder 接口来提供构建方式。
- 有一点值得注意,需要满足跨网络传输时,需确保 GetMessage 得到的消息支持 Codec 编解码。
type EnvelopeBuilder ¶
type EnvelopeBuilder interface { // BuildEnvelope 构建一个空的消息包装,它不包含任何头部信息及消息内容,适用于反序列化场景 BuildEnvelope() Envelope // BuildStandardEnvelope 构建一个标准的消息包装,它包含了消息的发送者、接收者、消息内容及消息类型 BuildStandardEnvelope(senderID ID, receiverID ID, messageType MessageType, message Message) Envelope // BuildAgentEnvelope 构建一个代理的消息包装,它与标准消息包装相似,但是实际发送人为代理 Actor BuildAgentEnvelope(agent, senderID, receiverID ID, messageType MessageType, message Message) Envelope }
EnvelopeBuilder 是 Envelope 的构建器,由于 Envelope 支持不同的实现,且包含多种构建方式,因此需要通过构建器来进行创建
type Future ¶
type Future[M Message] interface { // Ref 返回该 Future 的 ActorRef Ref() ActorRef // Result 阻塞地等待结果 Result() (M, error) // OnlyResult 阻塞地等待结果,不关心错误,如果发送错误将会返回空指针 OnlyResult() M // AssertResult 阻塞地等待结果,当发生错误时将会引发 panic AssertResult() M // Wait 阻塞的等待结果,该方式不关心结果,仅关心是否成功 Wait() error // AssertWait 阻塞的等待结果,该方式不关心结果,仅关心是否成功,当发生错误时将会引发 panic AssertWait() // Forward 将结果转发给其他的 ActorRef Forward(refs ...ActorRef) // Close 提前关闭 Close(reason error) // AwaitForward 异步地等待阻塞结束后向目标 Actor 转发消息 AwaitForward(ref ActorRef, asyncFunc func() M) // Adapter 支持对结果进行适配,通过使用 vivid.FutureAdapter 包装函数,以便在函数中处理结果 Adapter(handler FutureAdaptation) error }
type FutureAdaptation ¶
type FutureAdaptation interface {
// contains filtered or unexported methods
}
type FutureAdapter ¶
type ID ¶
type ID interface { // GetHost 返回这个 ID 所属的主机地址 GetHost() Host // GetPath 返回这个 ID 的资源路径 GetPath() Path // GetProcessCache 返回这个 ID 的进程缓存 GetProcessCache() Process // SetProcessCache 设置这个 ID 的进程缓存 // - 进程缓存是被用于加速进程查找的功能,当进程可用时,可通过进程缓存直接获取进程,而不需要通过进程管理器进行查找。 SetProcessCache(process Process) // Clone 返回这个 ID 的一个副本 Clone() ID // Sub 基于当前 ID 构建一个子 ID Sub(path Path) ID // String 返回这个 ID 的字符串表示 String() string // Equal 判断两个 ID 是否相等 Equal(id ID) bool // Hash 返回这个 ID 的哈希值 Hash() uint32 }
ID 是一个可以跨网络传输的唯一标识的抽象。为了支持通过 Protocol Buffers 或其他方式进行序列化,ID 在 Vivid 中被定义为接口。
type IDBuilder ¶
type IDBuilder interface { // BuildID 通过指定的主机地址和资源路径构建一个 ID BuildID(host Host, path Path) ID // BuildRootID 通过指定的主机地址构建一个根 ID BuildRootID(host Host) ID }
IDBuilder 是一个用于构建 ID 的接口。
- 由于 ID 可能存在多种构建方式,因此 IDBuilder 是一个接口,而不是一个具体的类型。
在使用 IDBuilder 时,应该是在构建之初便确定的,因此不应为此提供 Provider,避免在运行时动态更改 IDBuilder 而导致序列化方式不一致。
type LaunchContextProvider ¶
type LaunchContextProviderFn ¶
func (LaunchContextProviderFn) Provide ¶
func (f LaunchContextProviderFn) Provide() map[any]any
type Mailbox ¶
type Mailbox interface { // Init 初始化邮箱 Init(recipient Recipient, dispatcher Dispatcher) // Suspend 并发安全的暂停邮箱 Suspend() // Resume 并发安全的恢复邮箱 Resume() // Delivery 投递消息到邮箱 Delivery(envelope Envelope) }
type MailboxProvider ¶
type MailboxProvider interface {
Provide() Mailbox
}
type MailboxProviderFn ¶
type MailboxProviderFn func() Mailbox
func (MailboxProviderFn) Provide ¶
func (fn MailboxProviderFn) Provide() Mailbox
type MessageType ¶
type MessageType = int8
MessageType 是消息的类型,它用于区分消息的优先级及执行方式
const ( // UserMessage 表示用户消息,该类型消息优先级将低于 SystemMessage UserMessage MessageType = iota // SystemMessage 表示系统消息,该类型消息优先级为最高 SystemMessage )
type OnKill ¶
type OnKill interface { // GetReason 获取终止原因 GetReason() string // GetOperator 获取操作者 GetOperator() ActorRef // IsPoison 是否为优雅终止 IsPoison() bool // Restart 是否需要重启 Restart() bool // contains filtered or unexported methods }
OnKill 该消息表示 Actor 在处理完成当前消息后,将会被立即终止。需要在该阶段完成状态的持久化及资源的释放等操作。
- 在 Actor 重启时不会收到该消息
- 该消息支持在跨网络 ActorSystem 间传递
type OnKillBuilder ¶
type OnKillBuilder interface { // BuildOnKill 构建一个 OnKill 消息 BuildOnKill(reason string, operator ActorRef, poison bool, restart bool) OnKill }
OnKillBuilder 是用于构建 OnKill 消息的接口
type OnKillFailed ¶
type OnKillFailed interface { // GetStack 获取异常堆栈 GetStack() []byte // GetReason 获取异常原因 GetReason() Message // GetSender 获取 OnKill 消息发送者 GetSender() ActorRef // GetMessage 获取 OnKill 消息 GetMessage() OnKill // contains filtered or unexported methods }
OnKillFailed 在处理 OnKill 消息发生异常时,将会收到该消息,可用于处理异常情况
- 在处理该消息发生异常时,将不会再进行额外的处理,因此需要确保该消息的处理逻辑不会再次发生异常
- 该消息支持在跨网络 ActorSystem 间传递
异常:panic
type OnKillFailedBuilder ¶
type OnKillFailedBuilder interface { // BuildOnKillFailed 构建一个 OnKillFailed 消息 BuildOnKillFailed(stack []byte, reason Message, sender ActorRef, message OnKill) OnKillFailed }
OnKillFailedBuilder 是用于构建 OnKillFailed 消息的接口
type OnKilled ¶
type OnKilled interface {
// contains filtered or unexported methods
}
OnKilled 是在 ActorSystem 内部使用的消息类型,它被用于告知 Actor 其 Sender(子) 已经终止
- 该消息在 Actor 的 Sender 终止时被投递,用于处理 Actor 的状态
- 该消息支持在跨网络 ActorSystem 间传递
type OnKilledBuilder ¶
type OnLaunch ¶
type OnLaunch interface { // GetLaunchTime 获取 Actor 启动时间,该时间为 Actor 创建完毕后的时间,而非 Actor 启动时的时间 GetLaunchTime() time.Time // GetContext 获取 Actor 启动上下文中定义的内容,如果不存在则返回 nil 及 false // // 在一些时候,你也许希望 ActorProvider 返回的是一个单一的 Actor 实例,但在不同的 Actor 启动时,需要传递不同的参数。 // 通过 GetContext 方法,你可以获取 Actor 启动时传递的参数,以便在 Actor 启动时进行初始化。 GetContext(key any) (val any, exist bool) // Restarted 是否为重启 Restarted() bool // contains filtered or unexported methods }
OnLaunch 是在 Actor 启动时的消息,它包含了 Actor 的启动时间、启动上下文以及是否为重启的状态标识
- 该消息在 Actor 启动或重启时被投递,用于初始化 Actor 的状态
- 通常并不建议用户主动投递该消息,如果控制不良将会出现重复初始化等情况
- 该消息支持在跨网络 ActorSystem 间传递
type OnLaunchBuilder ¶
type OnLaunchBuilder interface { // BuildOnLaunch 构建一个 OnLaunch 消息 BuildOnLaunch(launchAt time.Time, context map[any]any, isRestart bool) OnLaunch }
OnLaunchBuilder 是用于构建 OnLaunch 消息的接口
type OnPing ¶
type OnPing interface { // GetTime 获取发起 Ping 的时间 GetTime() time.Time // contains filtered or unexported methods }
OnPing 是在 ActorSystem 中内部使用的消息类型,由于该消息被内部定义为系统消息,在用户消息中监听该消息仅会得到主动投递的用户级消息
- 自行依赖该消息实现 Ping-Pong 机制不能完整的代表网络通讯的延迟,仅代表 Actor 的消息处理延迟
- 该消息支持在跨网络 ActorSystem 间传递
type OnPingBuilder ¶
type OnPingBuilder interface { // BuildOnPing 构建一个 OnPing 消息 BuildOnPing() OnPing }
OnPingBuilder 是用于构建 OnPing 消息的接口
type OnUnwatch ¶
type OnUnwatch interface {
// contains filtered or unexported methods
}
OnUnwatch 是在 ActorSystem 中内部使用的消息类型,它被用于告知 Actor 的观察者已停止对其的观察
- 该消息支持在跨网络 ActorSystem 间传递
type OnUnwatchBuilder ¶
type OnUnwatchBuilder interface { // BuildOnUnwatch 构建一个 OnUnwatch 消息 BuildOnUnwatch() OnUnwatch }
OnUnwatchBuilder 是用于构建 OnUnwatch 消息的接口
type OnWatch ¶
type OnWatch interface {
// contains filtered or unexported methods
}
OnWatch 是在 ActorSystem 中内部使用的消息类型,它被用于告知 Actor 的观察者已开始对其进行观察
- 该消息由于是系统消息,因此在用户消息中监听该消息将会得到主动投递的用户级消息
- 该消息支持在跨网络 ActorSystem 间传递
type OnWatchBuilder ¶
type OnWatchBuilder interface { // BuildOnWatch 构建一个 OnWatch 消息 BuildOnWatch() OnWatch }
OnWatchBuilder 是用于构建 OnWatch 消息的接口
type OnWatchStopped ¶
type OnWatchStopped interface { // GetRef 获取已停止观察的 ActorRef GetRef() ActorRef // contains filtered or unexported methods }
OnWatchStopped 是用于告知 Actor 所观察的目标 Actor 已经停止运行的消息,该消息将会在目标 Actor 终止时投递给观察者
- 在使用过程中主动投递该消息不会影响内部的观察逻辑,所以在对已观察的目标投递该消息后,当目标 Actor 终止时,将会再次收到该消息,这将可能导致重复处理
- 该消息支持在跨网络 ActorSystem 间传递
type OnWatchStoppedBuilder ¶
type OnWatchStoppedBuilder interface { // BuildOnWatchStopped 构建一个 OnWatchStopped 消息 BuildOnWatchStopped(ref ActorRef) OnWatchStopped }
OnWatchStoppedBuilder 是用于构建 OnWatchStopped 消息的接口
type PersistentStorage ¶
type PersistentStorage interface { // Save 保存持久化数据 Save(persistentId string, snapshot Message, events []Message) error // Load 加载持久化数据 Load(persistentId string) (snapshot Message, events []Message, err error) }
PersistentStorage 持久化存储器接口
func GetMemoryPersistentStorage ¶
func GetMemoryPersistentStorage() PersistentStorage
GetMemoryPersistentStorage 创建一个内部提供的基于内存持久化的存储器
type Pong ¶
type Pong interface { // GetPing 获取 Ping 的时间 GetPing() time.Time // GetPong 获取 Pong 的时间 GetPong() time.Time // contains filtered or unexported methods }
Pong 该消息反应了一个 Actor 的延迟情况,当通过 ActorContextTransportInteractive.Ping 发起消息后,将会收到该消息
- 该消息支持在跨网络 ActorSystem 间传递
type PongBuilder ¶
PongBuilder 是用于构建 Pong 消息的接口
type Recipient ¶
type Recipient interface { // OnReceiveEnvelope 处理收到的信封 OnReceiveEnvelope(envelope Envelope) }
type RemoteMessageBuilder ¶
type RemoteMessageBuilder interface { EnvelopeBuilder IDBuilder OnKillBuilder OnKilledBuilder OnWatchBuilder OnWatchStoppedBuilder OnUnwatchBuilder OnPingBuilder PongBuilder OnLaunchBuilder OnKillFailedBuilder }
type Supervisor ¶
type Supervisor interface {
Decision(record AccidentRecord)
}
Supervisor 是一个监管者接口,用于对 Actor 异常情况进行监管策略的执行
type SupervisorFn ¶
type SupervisorFn func(record AccidentRecord)
func (SupervisorFn) Decision ¶
func (f SupervisorFn) Decision(record AccidentRecord)
type TimingTask ¶
type TimingTask interface { // Execute 执行定时任务 Execute(ctx ActorContext) }
TimingTask 是可以被 Actor 执行的定时任务,它是一个接口类型,允许创建有状态的定时任务
- 如果仅需要简单的执行函数,可以使用 TimingTaskFn 类型
type TimingTaskFn ¶
type TimingTaskFn func(ctx ActorContext)
TimingTaskFn 是一个简单的定时任务函数类型,它可以被 Actor 执行
func (TimingTaskFn) Execute ¶
func (f TimingTaskFn) Execute(ctx ActorContext)
type WatchHandler ¶
type WatchHandler interface {
Handle(ctx ActorContext, stopped OnWatchStopped)
}
type WatchHandlerFn ¶
type WatchHandlerFn func(ctx ActorContext, stopped OnWatchStopped)
func (WatchHandlerFn) Handle ¶
func (fn WatchHandlerFn) Handle(ctx ActorContext, stopped OnWatchStopped)
Source Files
¶
- accident_record.go
- actor.go
- actor_config.go
- actor_context.go
- actor_context_life.go
- actor_context_logger.go
- actor_context_presistent.go
- actor_context_process.go
- actor_context_recipient.go
- actor_context_spawner.go
- actor_context_timing.go
- actor_context_transport.go
- actor_spawn_chain.go
- actor_system.go
- actor_system_config.go
- actor_system_internal.go
- behavior.go
- codec.go
- dispatcher.go
- future.go
- gob.go
- guard_actor.go
- id.go
- logger.go
- mailbox.go
- message.go
- persistent_storage.go
- process.go
- process_manager.go
- remote_server.go
- remote_stream.go
- remote_stream_manager.go
- remote_stream_process.go
- supervisor.go
- timing_task.go
- vivid.go
- watch.go