actorsystem

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoRpcHost string = "-"
	NoRpcPort int    = 0
)

Variables

This section is empty.

Functions

func IsNoSender

func IsNoSender(req *rpc.RpcMessageRequest) bool

Types

type ActorDispatcher

type ActorDispatcher struct {
	// contains filtered or unexported fields
}

func NewActorDispatcher

func NewActorDispatcher(sender *MsgSender) *ActorDispatcher

func (*ActorDispatcher) AddCallbackActor added in v1.0.1

func (dispatcher *ActorDispatcher) AddCallbackActor(session []byte, actor ICallbackUntypedActor, ttl time.Duration)

func (*ActorDispatcher) Destroy added in v1.0.1

func (dispatcher *ActorDispatcher) Destroy()

func (*ActorDispatcher) Dispatch

func (dispatcher *ActorDispatcher) Dispatch(req *rpc.RpcMessageRequest)

func (*ActorDispatcher) RegisterActor added in v1.0.1

func (dispatcher *ActorDispatcher) RegisterActor(method string, actorCreateFun func() IUntypedActor, concurrentCount int)

type ActorExecutor added in v1.0.1

type ActorExecutor struct {
	// contains filtered or unexported fields
}

func NewActorExecutor added in v1.0.1

func NewActorExecutor(concurrentCount int, actorCreateFun func() IUntypedActor) *ActorExecutor

func (*ActorExecutor) Execute added in v1.0.1

func (executor *ActorExecutor) Execute(req *rpc.RpcMessageRequest, msgSender *MsgSender)

type ActorRef

type ActorRef interface {
	Tell(proto.Message, ActorRef)
	TellAndNoSender(proto.Message)
	GetMethod() string
	GetHost() string
	GetPort() int
	// contains filtered or unexported methods
}

func NewActorRef

func NewActorRef(host string, port int, method string, session []byte, sender *MsgSender) ActorRef

func NewCallbackActorRef added in v1.0.1

func NewCallbackActorRef(ttl time.Duration, host string, port int, session []byte, callbackActor ICallbackUntypedActor, sender *MsgSender, dispatcher *ActorDispatcher) ActorRef

type ActorSystem

type ActorSystem struct {
	Name string
	Host string
	Prot int

	RecvDecoder func([]byte, interface{})
	// contains filtered or unexported fields
}

func NewActorSystem

func NewActorSystem(name, host string, port int) *ActorSystem

func NewActorSystemNoRpc added in v1.0.1

func NewActorSystemNoRpc(name string) *ActorSystem

func (*ActorSystem) ActerOf

func (system *ActorSystem) ActerOf(host string, port int, method string) ActorRef

func (*ActorSystem) CallbackActerOf added in v1.0.1

func (system *ActorSystem) CallbackActerOf(ttl time.Duration, actor ICallbackUntypedActor) ActorRef

func (*ActorSystem) LocalActorOf added in v1.0.1

func (system *ActorSystem) LocalActorOf(method string) ActorRef

func (*ActorSystem) RegisterActor added in v1.0.1

func (system *ActorSystem) RegisterActor(method string, actorCreateFun func() IUntypedActor, concurrentCount int)

type CallbackActorExecutor added in v1.0.1

type CallbackActorExecutor struct {
	Task *timewheel.Task
	// contains filtered or unexported fields
}

func NewCallbackActorExecutor added in v1.0.1

func NewCallbackActorExecutor(callbackPool *tunny.Pool, wraperChan chan wraper, actor ICallbackUntypedActor) *CallbackActorExecutor

func (*CallbackActorExecutor) Execute added in v1.0.1

func (executor *CallbackActorExecutor) Execute(req *rpc.RpcMessageRequest, msgSender *MsgSender)

type DeadLetterActorRef

type DeadLetterActorRef struct {
	DefaultActorRef
}
var NoSender *DeadLetterActorRef

func (*DeadLetterActorRef) GetHost

func (ref *DeadLetterActorRef) GetHost() string

func (*DeadLetterActorRef) GetMethod

func (ref *DeadLetterActorRef) GetMethod() string

func (*DeadLetterActorRef) GetPort

func (ref *DeadLetterActorRef) GetPort() int

func (*DeadLetterActorRef) Tell

func (ref *DeadLetterActorRef) Tell(message proto.Message, sender ActorRef)

func (*DeadLetterActorRef) TellAndNoSender added in v1.0.1

func (ref *DeadLetterActorRef) TellAndNoSender(message proto.Message)

type DefaultActorRef

type DefaultActorRef struct {
	Host    string
	Port    int
	Method  string
	Session []byte
	Sender  *MsgSender
	// contains filtered or unexported fields
}

func (*DefaultActorRef) GetHost

func (ref *DefaultActorRef) GetHost() string

func (*DefaultActorRef) GetMethod

func (ref *DefaultActorRef) GetMethod() string

func (*DefaultActorRef) GetPort

func (ref *DefaultActorRef) GetPort() int

func (*DefaultActorRef) Tell

func (ref *DefaultActorRef) Tell(message proto.Message, sender ActorRef)

func (*DefaultActorRef) TellAndNoSender added in v1.0.1

func (ref *DefaultActorRef) TellAndNoSender(message proto.Message)

type ICallbackUntypedActor added in v1.0.4

type ICallbackUntypedActor interface {
	IDefaultUntypedActor
	ITimeoutHandler
}

type ICreateInputHandler added in v1.0.2

type ICreateInputHandler interface {
	CreateInputObj() proto.Message
}

type IDefaultUntypedActor added in v1.0.4

type IDefaultUntypedActor interface {
	IReceiveHandler
	ISenderHandler
	ISelfHandler
	ICreateInputHandler
}

type IExecutor added in v1.0.1

type IExecutor interface {
	Execute(req *rpc.RpcMessageRequest, msgSender *MsgSender)
}

type IReceiveHandler added in v1.0.2

type IReceiveHandler interface {
	OnReceive(msg proto.Message)
}

type ISelfHandler added in v1.0.2

type ISelfHandler interface {
	SetSelf(self ActorRef)
}

type ISenderHandler added in v1.0.2

type ISenderHandler interface {
	SetSender(sender ActorRef)
}

type ITimeoutHandler added in v1.0.2

type ITimeoutHandler interface {
	OnTimeout()
}

type IUntypedActor added in v1.0.2

type IUntypedActor interface{}

type MsgReceiver

type MsgReceiver struct {
	// contains filtered or unexported fields
}

func NewMsgReceiver

func NewMsgReceiver(host string, port int, dispatcher *ActorDispatcher) *MsgReceiver

func (*MsgReceiver) Receive

func (rec *MsgReceiver) Receive(req *rpc.RpcMessageRequest)

type MsgSender

type MsgSender struct {
	// contains filtered or unexported fields
}

func NewMsgSender

func NewMsgSender() *MsgSender

func (*MsgSender) Send

func (sender *MsgSender) Send(req *rpc.RpcMessageRequest)

func (*MsgSender) SetMsgReceiver

func (sender *MsgSender) SetMsgReceiver(receiver *MsgReceiver)

func (*MsgSender) Stop

func (sender *MsgSender) Stop()

type NewInput

type NewInput func() proto.Message

type Processor

type Processor func(ActorRef, proto.Message)

type RpcClient

type RpcClient struct {
	Address string
	// contains filtered or unexported fields
}

func NewRpcClient

func NewRpcClient(address string) *RpcClient

func (*RpcClient) DisConnect

func (client *RpcClient) DisConnect()

func (*RpcClient) Send

func (client *RpcClient) Send(req *rpc.RpcMessageRequest)

type RpcServer

type RpcServer struct {
	Host string
	Port int
	// contains filtered or unexported fields
}

func NewRpcServer

func NewRpcServer(host string, port int, msgReceiver *MsgReceiver) *RpcServer

func (*RpcServer) Send

func (*RpcServer) Start

func (server *RpcServer) Start()

type UntypedActor added in v1.0.1

type UntypedActor struct {
	Sender ActorRef
	Self   ActorRef
}

func (*UntypedActor) SetSelf added in v1.0.1

func (act *UntypedActor) SetSelf(self ActorRef)

func (*UntypedActor) SetSender added in v1.0.1

func (act *UntypedActor) SetSender(sender ActorRef)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL