Documentation ¶
Index ¶
- Constants
- Variables
- type Discovery
- type Future
- func (o *Future) Code() int
- func (o *Future) Err() error
- func (o *Future) ErrCause() interface{}
- func (o *Future) Fail(code int, errCause interface{})
- func (o *Future) GetContext() interface{}
- func (o *Future) IsFail() bool
- func (o *Future) IsSucceed() bool
- func (o *Future) OnFail(callback FutureCallback) *Future
- func (o *Future) OnFinally(callback FutureCallback) *Future
- func (o *Future) OnSucceed(callback FutureCallback) *Future
- func (o *Future) Result() interface{}
- func (o *Future) Run() *Future
- func (o *Future) RunAndWait(timeout time.Duration) (*Future, error)
- func (o *Future) SetContext(context interface{}) *Future
- func (o *Future) SetRoutine(routine FutureCallback) *Future
- func (o *Future) Succeed(code int, result interface{})
- func (o *Future) Then(callback FutureCallback) *Future
- func (o *Future) TryFail(code int, cause interface{})
- func (o *Future) TrySucceed(code int, result interface{})
- type FutureCallback
- type FutureCallbackReturn
- type FutureEvent
- type Gateway
- type GatewayEvent
- type GatewayEventBox
- type LifeCycler
- type Message
- func (o *Message) Clone() *Message
- func (o *Message) Error(code int, errmsg string, args ...interface{}) error
- func (o *Message) FromJson(data []byte) error
- func (o *Message) FromMap(m map[string]interface{})
- func (o *Message) GetTraceDepth() int
- func (o *Message) IsError() bool
- func (o *Message) Overseer() *Microroller
- func (o *Message) Reply(code int, data interface{}) error
- func (o *Message) SetHandler(handler MessageHandler) *Message
- func (o *Message) SetHeaders(headers MessageHeaders) *Message
- func (o *Message) SetOptions(options MessageOptions) *Message
- func (o *Message) SetTimeout(timeout time.Duration) *Message
- func (o *Message) String() string
- func (o *Message) ToJson() ([]byte, error)
- func (o *Message) ToJsonString() (string, error)
- func (o *Message) ToMap() map[string]interface{}
- func (o *Message) TypeString() string
- func (o *Message) WaitReply(timeout time.Duration) (*Message, bool)
- type MessageFlag
- type MessageHandler
- type MessageHeaders
- type MessageOptions
- type MessageType
- type Microroller
- func (o *Microroller) Broadcast(gatekey string, message *Message) error
- func (o *Microroller) GetDiscovery() Discovery
- func (o *Microroller) GetLogger() *log.Logger
- func (o *Microroller) GetTina() *Tina
- func (o *Microroller) Multicast(gatekey string, message *Message) error
- func (o *Microroller) NanoLocalRegister(nano *Nano) error
- func (o *Microroller) NanoLocalUnregister(nano *Nano) error
- func (o *Microroller) Post(gatekey string, request *Message) (response *Message, err error)
- func (o *Microroller) SetDiscovery(discovery Discovery)
- func (o *Microroller) SetGateways(gateways map[string]Gateway, gatewaydef string) *Microroller
- func (o *Microroller) SetLogger(logger *log.Logger) *Microroller
- func (o *Microroller) Start(config map[string]interface{}) error
- func (o *Microroller) Stop() error
- type Nano
- func (o *Nano) CallbackAdd(callback NanoCallback) *Nano
- func (o *Nano) CallbackInvoke(event NanoEvent, context interface{}, dopanic bool) (err error)
- func (o *Nano) Dispatch(message *Message)
- func (o *Nano) GatewayGetData(address string) interface{}
- func (o *Nano) LocalAdd(silbing *Nano)
- func (o *Nano) LocalIterate(routine func(*Nano) (bool, error)) error
- func (o *Nano) LocalRemove(id string) error
- func (o *Nano) PortalAdd(address string, data interface{})
- func (o *Nano) PortalAddress(index int32) string
- func (o *Nano) PortalAddresses() []string
- func (o *Nano) PortalCount() int
- func (o *Nano) PortalPointer() ([]string, int)
- func (o *Nano) PortalRemove(address string)
- func (o *Nano) PortalSet(address []string, data []interface{})
- type NanoCallback
- type NanoEvent
- type NanoFlag
- type NanoHandler
- type NanoOptions
- type OverseerErrorHandler
- type Portal
- type PortalKind
- type Tina
- func (o *Tina) Deploy(id string, guide TinyGuideKind, config map[string]interface{}, flag TinyFlag, ...) *Future
- func (o *Tina) GetDiscovery() Discovery
- func (o *Tina) GetGateways() map[string]Gateway
- func (o *Tina) GetLogger() *log.Logger
- func (o *Tina) GetMicroroller() *Microroller
- func (o *Tina) GetNodeId() string
- func (o *Tina) SetDiscovery(discovery Discovery)
- func (o *Tina) SetGateways(gateways map[string]Gateway, gatewaydef string) *Tina
- func (o *Tina) SetLogger(logger *log.Logger) *Tina
- func (o *Tina) SetMicroroller(microroller *Microroller) *Tina
- func (o *Tina) Start(config map[string]interface{}) error
- func (o *Tina) Stop() error
- func (o *Tina) Undeploy(tinyId string) *Future
- type Tiny
- func (o *Tiny) GetConfig() map[string]interface{}
- func (o *Tiny) GetGroup() string
- func (o *Tiny) GetGuide() TinyGuideKind
- func (o *Tiny) GetId() string
- func (o *Tiny) GetOptions() TinyOptions
- func (o *Tiny) GetTina() *Tina
- func (o *Tiny) NanoLocalRegister(nano *Nano) error
- func (o *Tiny) NanoLocalUnregister(nano *Nano) error
- func (o *Tiny) Post(gatekey string, request *Message) (*Message, error)
- func (o *Tiny) Start(future *Future)
- func (o *Tiny) Stop(future *Future)
- type TinyFlag
- type TinyGuide
- type TinyGuideCallback
- type TinyGuideEvent
- type TinyGuideKind
- type TinyKind
- type TinyOptions
Constants ¶
View Source
const (
NanoEventStop = 0x0010
)
Variables ¶
View Source
var MessageTraceDepthDefault = 3
Functions ¶
This section is empty.
Types ¶
type Discovery ¶
type Discovery interface { GetNodeId() string SetNodeId(string) GetLogger() *log.Logger SetLogger(logger *log.Logger) Start(config map[string]interface{}) error Stop(config map[string]interface{}) error NanoRemoteRegister(nano *Nano) error NanoRemoteUnregister(nano *Nano) error NanoRemoteGet(address string) (*Nano, error) NanoLocalRegister(nano *Nano) error NanoLocalUnregister(nano *Nano) error NanoLocalGet(address string) (*Nano, error) GatewayGet(gatekey string) Gateway GatewayPublish(gatekey string, gateway Gateway) error GatewayUnpublish(gatekey string) error PortalGet(address string) PortalKind }
type Future ¶
func (*Future) GetContext ¶
func (o *Future) GetContext() interface{}
func (*Future) OnFail ¶
func (o *Future) OnFail(callback FutureCallback) *Future
func (*Future) OnFinally ¶
func (o *Future) OnFinally(callback FutureCallback) *Future
func (*Future) OnSucceed ¶
func (o *Future) OnSucceed(callback FutureCallback) *Future
func (*Future) SetContext ¶
func (*Future) SetRoutine ¶
func (o *Future) SetRoutine(routine FutureCallback) *Future
func (*Future) Then ¶
func (o *Future) Then(callback FutureCallback) *Future
func (*Future) TrySucceed ¶
type FutureCallback ¶
type FutureCallback func(event FutureEvent, future *Future) FutureCallbackReturn
type FutureCallbackReturn ¶
type FutureCallbackReturn int
const ( FutureCallbackContinue FutureCallbackReturn = 0x0000 FutureCallbackTerminate FutureCallbackReturn = 0x0001 )
type FutureEvent ¶
type FutureEvent int
const ( FutureEventRoutine FutureEvent = 0x0001 FutureEventThen FutureEvent = 0x0010 FutureEventSucceed FutureEvent = 0x1000 FutureEventFail FutureEvent = 0x2000 FutureEventFinally FutureEvent = 0x4000 )
type Gateway ¶
type Gateway interface { GetId() string SetId(string) GetIdHash() uint32 GetNodeId() string SetNodeId(string) GetNodeIdHash() uint32 GetType() string GetTypeHash() uint32 GetMeta() map[string]interface{} GetConfig() map[string]interface{} SetConfig(map[string]interface{}) GetLogger() *log.Logger SetLogger(logger *log.Logger) Start(config map[string]interface{}) error Stop(config map[string]interface{}) error Poll(limit int) (chan *Message, error) Post(message *Message, discovery Discovery) error Multicast(message *Message, discovery Discovery) error Broadcast(message *Message, discovery Discovery) error EventChannelGet(channelId string) (<-chan *GatewayEventBox, error) EventChannelClose(channelId string) error }
type GatewayEvent ¶
type GatewayEvent int
const ( GatewayEventConnected GatewayEvent = 1 GatewayEventDisconnected GatewayEvent = 2 GatewayEventConfigChange GatewayEvent = 3 )
type GatewayEventBox ¶
type GatewayEventBox struct { Event GatewayEvent Source Gateway Meta interface{} }
type LifeCycler ¶
type Message ¶
type Message struct { Type MessageType LocalFlag MessageFlag Address string Gatekey string Data interface{} Timeout time.Duration Canceled bool Err error Sender string Receiver string Session string SessionRelated interface{} Headers MessageHeaders Options MessageOptions Replier string ReplyId uint64 ReplyErr string ReplyTrace string TraceDepth int ReplyCode int ReplyData interface{} ReplyChannel chan *Message Handler MessageHandler Related *Message // contains filtered or unexported fields }
func NewMessage ¶
func (*Message) GetTraceDepth ¶
func (*Message) Overseer ¶
func (o *Message) Overseer() *Microroller
func (*Message) SetHandler ¶
func (o *Message) SetHandler(handler MessageHandler) *Message
func (*Message) SetHeaders ¶
func (o *Message) SetHeaders(headers MessageHeaders) *Message
func (*Message) SetOptions ¶
func (o *Message) SetOptions(options MessageOptions) *Message
func (*Message) ToJsonString ¶
func (*Message) TypeString ¶
type MessageFlag ¶
type MessageFlag uint32
const ( MessageFlagLocalOnly MessageFlag = 0x0001 MessageFlagRemoteOnly MessageFlag = 0x0002 )
type MessageHandler ¶
type MessageHandler func(message *Message)
type MessageHeaders ¶
type MessageHeaders map[string]interface{}
type MessageOptions ¶
type MessageOptions map[string]interface{}
type MessageType ¶
type MessageType uint32
const ( MessageTypeSend MessageType = 0x0001 MessageTypeReply MessageType = 0x0002 MessageTypeFail MessageType = 0x0004 MessageTypeBroadcast MessageType = 0x1000 MessageTypeMulticast MessageType = 0x2000 )
type Microroller ¶
type Microroller struct { ErrHandler OverseerErrorHandler Verbose int // contains filtered or unexported fields }
func (*Microroller) Broadcast ¶
func (o *Microroller) Broadcast(gatekey string, message *Message) error
func (*Microroller) GetDiscovery ¶
func (o *Microroller) GetDiscovery() Discovery
func (*Microroller) GetLogger ¶
func (o *Microroller) GetLogger() *log.Logger
func (*Microroller) GetTina ¶
func (o *Microroller) GetTina() *Tina
func (*Microroller) Multicast ¶
func (o *Microroller) Multicast(gatekey string, message *Message) error
func (*Microroller) NanoLocalRegister ¶
func (o *Microroller) NanoLocalRegister(nano *Nano) error
func (*Microroller) NanoLocalUnregister ¶
func (o *Microroller) NanoLocalUnregister(nano *Nano) error
func (*Microroller) Post ¶
func (o *Microroller) Post(gatekey string, request *Message) (response *Message, err error)
func (*Microroller) SetDiscovery ¶
func (o *Microroller) SetDiscovery(discovery Discovery)
func (*Microroller) SetGateways ¶
func (o *Microroller) SetGateways(gateways map[string]Gateway, gatewaydef string) *Microroller
func (*Microroller) SetLogger ¶
func (o *Microroller) SetLogger(logger *log.Logger) *Microroller
func (*Microroller) Start ¶
func (o *Microroller) Start(config map[string]interface{}) error
func (*Microroller) Stop ¶
func (o *Microroller) Stop() error
type Nano ¶
type Nano struct { Id string Address string Options NanoOptions Handler NanoHandler Flag NanoFlag // contains filtered or unexported fields }
func NewNano ¶
func NewNano(address string, flag NanoFlag, options NanoOptions, handler NanoHandler) *Nano
func (*Nano) CallbackAdd ¶
func (o *Nano) CallbackAdd(callback NanoCallback) *Nano
func (*Nano) CallbackInvoke ¶
func (*Nano) GatewayGetData ¶
func (*Nano) LocalRemove ¶
func (*Nano) PortalAddress ¶
func (*Nano) PortalAddresses ¶
func (*Nano) PortalCount ¶
func (*Nano) PortalPointer ¶
func (*Nano) PortalRemove ¶
type NanoCallback ¶
type NanoHandler ¶
type NanoHandler func(message *Message)
type NanoOptions ¶
type NanoOptions map[string]interface{}
type OverseerErrorHandler ¶
type OverseerErrorHandler func(event string, err interface{}, microroller *Microroller)
type Portal ¶
type Portal struct { Type string TypeHash uint32 Path string Address string Discoverer Discovery Meta map[string]interface{} }
func (*Portal) GetAddress ¶
func (*Portal) GetTypeHash ¶
type PortalKind ¶
type Tina ¶
type Tina struct {
// contains filtered or unexported fields
}
func (*Tina) Deploy ¶
func (o *Tina) Deploy(id string, guide TinyGuideKind, config map[string]interface{}, flag TinyFlag, options TinyOptions) *Future
func (*Tina) GetDiscovery ¶
func (*Tina) GetGateways ¶
func (*Tina) GetMicroroller ¶
func (o *Tina) GetMicroroller() *Microroller
func (*Tina) SetDiscovery ¶
func (*Tina) SetGateways ¶
func (*Tina) SetMicroroller ¶
func (o *Tina) SetMicroroller(microroller *Microroller) *Tina
type Tiny ¶
func (*Tiny) GetGuide ¶
func (o *Tiny) GetGuide() TinyGuideKind
func (*Tiny) GetOptions ¶
func (o *Tiny) GetOptions() TinyOptions
func (*Tiny) NanoLocalRegister ¶
func (*Tiny) NanoLocalUnregister ¶
type TinyGuide ¶
type TinyGuide struct { util.LazyData Start TinyGuideCallback Stop TinyGuideCallback Err TinyGuideCallback // contains filtered or unexported fields }
func (*TinyGuide) CallbackAdd ¶
func (o *TinyGuide) CallbackAdd(callback TinyGuideCallback)
type TinyGuideCallback ¶
type TinyGuideCallback func(event TinyGuideEvent, tiny TinyKind, guide TinyGuideKind, config map[string]interface{}, future *Future, err error)
type TinyGuideEvent ¶
type TinyGuideEvent int
const ( TinyGuideEventStart TinyGuideEvent = 0x0001 TinyGuideEventStop TinyGuideEvent = 0x0002 TinyGuideEventError TinyGuideEvent = 0x0010 TinyGuideEventAspect TinyGuideEvent = 0x1000 )
type TinyGuideKind ¶
type TinyGuideKind interface { util.LazyDataKind CallbackAdd(callback TinyGuideCallback) Invoke(event TinyGuideEvent, tiny TinyKind, config map[string]interface{}, future *Future) }
type TinyKind ¶
type TinyKind interface { util.LazyDataKind GetId() string GetGroup() string GetGuide() TinyGuideKind GetOptions() TinyOptions GetConfig() map[string]interface{} GetTina() *Tina Post(gatekey string, request *Message) (response *Message, err error) NanoLocalRegister(nano *Nano) error NanoLocalUnregister(nano *Nano) error }
type TinyOptions ¶
type TinyOptions map[string]interface{}
Click to show internal directories.
Click to hide internal directories.