lnd/protofsm/actor_wrapper.go
Olaoluwa Osuntokun ac4bc2392d protofsm: implement the actor.ActorBehavior interface for StateMachine
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.
2026-04-22 17:33:04 -07:00

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)
}