mirror of
https://github.com/lightningnetwork/lnd.git
synced 2026-08-18 13:07:58 +02:00
In this commit, we implement the actor.ActorBehavior interface for StateMachine. This enables the state machine executor to be registered as an actor, and have messages be sent to it via a unique ServiceKey that a concrete instance will set.
23 lines
526 B
Go
23 lines
526 B
Go
package protofsm
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/lightningnetwork/lnd/actor"
|
|
)
|
|
|
|
// ActorMessage wraps an Event, in order to create a new message that can be
|
|
// used with the actor package.
|
|
type ActorMessage[Event any] struct {
|
|
actor.BaseMessage
|
|
|
|
// Event is the event that is being sent to the actor.
|
|
Event Event
|
|
}
|
|
|
|
// MessageType returns the type of the message.
|
|
//
|
|
// NOTE: This implements the actor.Message interface.
|
|
func (a ActorMessage[Event]) MessageType() string {
|
|
return fmt.Sprintf("ActorMessage(%T)", a.Event)
|
|
}
|