actors

package
v0.0.43 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actable

type Actable interface {
	GetID() string
	RegisterActorActions(*ActionsHandler)
}

Actable is the interface for all models implementing actor model

type Action

type Action func(context *Context) error

Action is alias for func(context *Context) error

type ActionsHandler

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

ActionsHandler used to mange callbacks for controllers

func (*ActionsHandler) RegisterAction

func (handler *ActionsHandler) RegisterAction(actionName string, action Action)

RegisterAction used to register action

type Actor

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

Actor is the base representation of actor in actor model

func (*Actor) Identifier added in v0.0.25

func (actor *Actor) Identifier() string

Identifier used to identify mailbox's address of actor

type Context

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

Context used to represent context with data

func (*Context) Params added in v0.0.34

func (context *Context) Params(key string) interface{}

Params used to retrieve params value

func (*Context) ParamsInt added in v0.0.34

func (context *Context) ParamsInt(key string, fallback int) int

ParamsInt used to retrieve params value in int

func (*Context) ParamsStr added in v0.0.34

func (context *Context) ParamsStr(key string) string

ParamsStr used to retrieve params value in string

type Event

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

type Mailboxes

type Mailboxes map[string]chan Event

Mailboxes is alias for map[string]chan Event

type Manager

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

Manager is singleton manager for actor module

func (*Manager) RegisterActor

func (manager *Manager) RegisterActor(nsp string, actable Actable) *Actor

RegisterActor used to creating an actor instance for model

func (*Manager) Request added in v0.0.34

func (manager *Manager) Request(actorIdentifier string, eventName string, params map[string]interface{}) error

Request used to delegating a task to an actor synchronously with an response

func (*Manager) Setup

func (manager *Manager) Setup()

Setup used to setup actor manager

func (*Manager) Tell added in v0.0.34

func (manager *Manager) Tell(actorIdentifier string, eventName string, params map[string]interface{})

Tell used to delegating a task to an actor asynchronously

type Response added in v0.0.34

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

Response represents the response for synchronous task delegation request for action

Jump to

Keyboard shortcuts

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