actor_ref.go 587 B

123456789101112131415161718192021222324
  1. package ruleEngine
  2. import "sparrow/pkg/protocol"
  3. // Ref a actor reference
  4. type Ref interface {
  5. // get actor id
  6. GetActorId() string
  7. // tell actor a message
  8. Tell(msg protocol.ActorMsg)
  9. // tell actor a message with high priority
  10. TellWithHighPriority(msg protocol.ActorMsg)
  11. }
  12. // Ctx a actor context
  13. type Ctx interface {
  14. Ref
  15. GetSelf() string
  16. GetParentRef() Ref
  17. TellActor(actorId string, msg protocol.ActorMsg)
  18. Stop(actorId string) error
  19. GetOrCreateChildActor(actorId string, dispatcherName string, create Creator) (Ref, error)
  20. BroadcastChildren(msg protocol.ActorMsg) error
  21. }