node.go 570 B

123456789101112131415161718192021222324252627
  1. package ruleEngine
  2. import (
  3. "sparrow/pkg/actor"
  4. "sparrow/pkg/entities"
  5. "sparrow/pkg/protocol"
  6. )
  7. type Node interface {
  8. Init(ctx Context, config string) error
  9. OnMessage(ctx Context, message *protocol.Message) error
  10. }
  11. // RuleNodeCtx 节点上下文
  12. type RuleNodeCtx struct {
  13. TenantId string // 租户Id
  14. ChainActor actor.Ref // 规则链 actor
  15. SelfActor actor.Ref // 当前节点的 actor
  16. Self *RuleNode // 当前节点
  17. }
  18. // RuleNodeRelation 节点关系
  19. type RuleNodeRelation struct {
  20. In entities.EntityId
  21. Out entities.EntityId
  22. Type string
  23. }