Documentation ¶
Overview ¶
Package behavior provides dynamic lookup of functions for handling events like receiving messages and for setting up and running stuff like actors.
Index ¶
- Variables
- func FormatTimestamp(t time.Time) string
- type ActionHandler
- type Address
- type Context
- func (ctx Context) Deadline() (deadline time.Time, ok bool)
- func (ctx Context) Done() <-chan struct{}
- func (ctx Context) Err() error
- func (ctx *Context) GetHandler(name string) Handler
- func (ctx *Context) GetStep() Step
- func (ctx *Context) HandleAction(spec m.Map, msg *Message)
- func (ctx *Context) HandleDone() bool
- func (ctx *Context) HandleMsg(msg *Message) bool
- func (ctx *Context) HandleSpec(spec m.Map) bool
- func (ctx *Context) Log(lvl l.Level, txt string, fields m.Map)
- func (ctx *Context) LogCatch(txt string) interface{}
- func (ctx *Context) LogDebug(txt string, fields m.Map)
- func (ctx *Context) LogErr(txt string, fields m.Map)
- func (ctx *Context) LogInfo(txt string, fields m.Map)
- func (ctx *Context) LogTrace(txt string, fields m.Map)
- func (ctx *Context) LogWarn(txt string, fields m.Map)
- func (ctx *Context) Msg(par ...string) msgCtx
- func (ctx *Context) Run(fct func())
- func (ctx *Context) RunAction(fct ActionHandler, spec m.Map, msg *Message)
- func (ctx *Context) RunListener()
- func (ctx *Context) RunMsg(fct MsgProc, msg *Message)
- func (ctx *Context) RunProc(fct Proc)
- func (ctx *Context) Send(msg *Message, svcName string)
- func (ctx *Context) SendAddr(msg *Message, addr Address)
- func (ctx *Context) SendToAddr(msg *Message, addr Address)
- func (ctx *Context) SendToMailbox(mb Mailbox, msg *Message)
- func (ctx *Context) Setup()
- func (ctx *Context) Startup()
- func (ctx Context) Value(key interface{}) interface{}
- func (ctx *Context) WrappedFromJson(jsstr string) *WrappedMessage
- type ContextState
- type DefaultState
- type DummyHandler
- type HSpecs
- type Handler
- type Logger
- type Mailbox
- type Message
- type MsgCtx
- type MsgHandler
- type MsgProc
- type Payload
- type Proc
- type Session
- type SpecHandler
- type Step
- type Timestamp
- type WrappedMessage
Constants ¶
This section is empty.
Variables ¶
View Source
var LoadRegistry = reg.LoadRegistry
View Source
var Quit = Message{Action: "quit"}
Functions ¶
func FormatTimestamp ¶ added in v0.1.8
Types ¶
type Context ¶
type Context struct { Name string Home string Config m.Map State ContextState Logger Logger Parent *Context Self chan Message DoneCh chan struct{} WaitGroup *sync.WaitGroup Services map[string]*Context Errors []error ForgeEnv *forge.ForgeEnv }
func (*Context) GetHandler ¶
func (*Context) HandleDone ¶
func (*Context) RunAction ¶ added in v0.1.9
func (ctx *Context) RunAction(fct ActionHandler, spec m.Map, msg *Message)
func (*Context) RunListener ¶
func (ctx *Context) RunListener()
func (*Context) SendToAddr ¶ added in v0.1.13
func (*Context) SendToMailbox ¶ added in v0.1.13
SendToMailbox is a wrapper around the standard <- operator for sending a message via a channel. The context on which this method is called should be that of the receiver so that information about channel capacity handling can be retrieved.
func (*Context) WrappedFromJson ¶ added in v0.1.8
func (ctx *Context) WrappedFromJson(jsstr string) *WrappedMessage
type ContextState ¶ added in v0.1.8
type DefaultState ¶ added in v0.1.8
type DefaultState struct{}
func (*DefaultState) GetSession ¶ added in v0.1.19
func (st *DefaultState) GetSession(sid string) Session
type DummyHandler ¶
type Message ¶
type Message struct { Domain string `json:"domain,omitempty"` Action string `json:"action,omitempty"` Class string `json:"class,omitempty"` Item string `json:"item,omitempty"` Sender Address `json:"sender"` Payload Payload `json:"payload,omitempty"` }
func (*Message) SetPayload ¶ added in v0.1.13
func (*Message) SetTimestampInPayload ¶ added in v0.1.15
func (*Message) Wrapped ¶ added in v0.1.8
func (msg *Message) Wrapped() *WrappedMessage
type MsgHandler ¶
type Timestamp ¶ added in v0.1.8
func GetTimestampDef ¶ added in v0.1.15
func (*Timestamp) MarshalText ¶ added in v0.1.8
func (*Timestamp) UnmarshalText ¶ added in v0.1.8
type WrappedMessage ¶ added in v0.1.8
type WrappedMessage struct { Message *Message `json:"message"` Timestamp Timestamp `json:"timestamp"` }
func (*WrappedMessage) Json ¶ added in v0.1.8
func (wm *WrappedMessage) Json(ctx *Context) string
Click to show internal directories.
Click to hide internal directories.