actors

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Options added in v1.0.16

func Options() *options

Types

type Actable

type Actable interface {
	GetActorIdentifier() 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

func (*ActionsHandler) RegisterAfterActionHook added in v1.0.8

func (handler *ActionsHandler) RegisterAfterActionHook(afterActionHook Hook)

RegisterAfterActionHook used to add after hook

func (*ActionsHandler) RegisterBeforeActionHook added in v1.0.8

func (handler *ActionsHandler) RegisterBeforeActionHook(beforeActionHook Hook)

RegisterBeforeActionHook used to add before hook

type Actor

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

Actor is the base representation of actor in actor model

func (*Actor) Ch

func (actor *Actor) Ch() chan event

func (*Actor) Identifier

func (actor *Actor) Identifier() string

Identifier used to identify mailbox's address of actor

func (*Actor) Root

func (actor *Actor) Root() string

type Addresses

type Addresses map[string]*Actor

Addresses is alias for map[string]*Actor

type Context

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

Context used to represent actor execution context with data

func (*Context) Params

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

Params used to retrieve params value

func (*Context) ParamsBool

func (context *Context) ParamsBool(key string) bool

ParamsBool used to retrieve params value in bool

func (*Context) ParamsDict added in v1.0.21

func (context *Context) ParamsDict() *helpers.Dictionary

func (*Context) ParamsFloat64

func (context *Context) ParamsFloat64(key string, fallback float64) float64

ParamsFloat64 used to retrieve params value in float64

func (*Context) ParamsInt

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

ParamsInt used to retrieve params value in int

func (*Context) ParamsStr

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

ParamsStr used to retrieve params value in string

func (*Context) PrepareRender added in v1.0.11

func (context *Context) PrepareRender(viewName string) *views.Renderer

func (*Context) Property added in v1.0.8

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

Property used to retrieve context property value

func (*Context) PropertyBool added in v1.0.8

func (context *Context) PropertyBool(key string) bool

PropertyBool used to retrieve params value in bool

func (*Context) PropertyFloat64 added in v1.0.8

func (context *Context) PropertyFloat64(key string, fallback float64) float64

PropertyFloat64 used to retrieve params value in float64

func (*Context) PropertyInt added in v1.0.8

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

PropertyInt used to retrieve params value in int

func (*Context) PropertyStr added in v1.0.8

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

PropertyStr used to retrieve params value in string

func (*Context) SetProperty added in v1.0.8

func (context *Context) SetProperty(key string, value interface{})

SetProperty used to set property that can used across the context

func (*Context) Tell added in v1.0.20

func (context *Context) Tell(actor *Actor, eventName string, params map[string]interface{}, cascade bool)

Tell used to delegating a task to an actor asynchronously

type Hook added in v1.0.8

type Hook func(string, *Context)

Hook is alias for func(string, *Context)

type Mailbox

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

type Manager

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

Manager is singleton manager for actor module

func (*Manager) GetActors

func (manager *Manager) GetActors() []*Actor

GetActors used to return all registered actors

func (*Manager) RegisterActor

func (manager *Manager) RegisterActor(actable Actable) error

RegisterActor used for registering an actor

func (*Manager) RegisterActorWithOptions added in v1.0.16

func (manager *Manager) RegisterActorWithOptions(actable Actable) error

RegisterActorWithOptions used for registering an actor with options

func (*Manager) RegisterChildActor

func (manager *Manager) RegisterChildActor(parent Actable, actable Actable) error

RegisterChildActor used to creating an actor instance for model

func (*Manager) Request

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(viewsManager *views.Manager)

Setup used to setup actor manager

func (*Manager) Tell

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

Tell used to delegating a task to an actor asynchronously

type Response

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