Documentation ¶
Index ¶
- Constants
- Variables
- func BuildInfo() (r string)
- func ChanSender(ev types.Event, c chan<- types.Event) error
- func CreateDiscovers(url string) (map[string]reflect.Value, error)
- func CreateMutation(si types.ServiceInstance, m *Mutation) (types.StateMutation, error)
- func DefaultRootSpec() types.StateSpec
- func FilterRegexp(ev types.Event, re *regexp.Regexp) (r bool)
- func FilterRegexpStr(ev types.Event, re string) (r bool)
- func FilterSimple(ev types.Event, match []string) (r bool)
- func LookupEnum(url string) (enumName string, enumType reflect.Type, valueMap map[string]int32, err error)
- func LookupEnumValue(url string, value string) (interface{}, error)
- func ModuleExecute(id, module, sock string)
- func MustLookupEnum(url string) (enumName string, enumType reflect.Type, valueMap map[string]int32)
- func MustLookupEnumValue(url string, value string) interface{}
- func MustValueFromString(url, value string) reflect.Value
- func NewEvent(t types.EventType, url string, data interface{}) types.Event
- func NewStateChangeEvent(t pb.StateChangeControl_Type, u string, v reflect.Value) types.Event
- func ServiceLoggerListener(l types.Logger, c <-chan LoggerEvent)
- func ValueFromString(url, value string) (v reflect.Value, err error)
- type Context
- type ContextRPC
- type ContextSDE
- type ContextSME
- type ContextSSE
- type DiscoveryEvent
- type Event
- type EventDispatchEngine
- func (v *EventDispatchEngine) AddListener(el types.EventListener) (e error)
- func (v *EventDispatchEngine) EventChan() chan<- []types.Event
- func (v *EventDispatchEngine) GetLoggerLevel() types.LoggerLevel
- func (v *EventDispatchEngine) GetModule() string
- func (v *EventDispatchEngine) IsEnabledFor(level types.LoggerLevel) bool
- func (v *EventDispatchEngine) Log(level types.LoggerLevel, m string)
- func (v *EventDispatchEngine) Logf(level types.LoggerLevel, fmt string, va ...interface{})
- func (v *EventDispatchEngine) Run(ready chan<- interface{})
- func (v *EventDispatchEngine) SetLoggerLevel(level types.LoggerLevel)
- func (v *EventDispatchEngine) SetModule(name string)
- func (v *EventDispatchEngine) SubscriptionChan() chan<- types.EventListener
- type EventEmitter
- type EventListener
- func (v *EventListener) Filter(ev types.Event) (r bool)
- func (v *EventListener) Name() string
- func (v *EventListener) Send(ev types.Event) (e error)
- func (v *EventListener) SetState(s types.EventListenerState)
- func (v *EventListener) State() types.EventListenerState
- func (v *EventListener) Type() types.EventType
- type Kraken
- func (k *Kraken) Bootstrap()
- func (*Kraken) Cmd() *exec.Cmd
- func (*Kraken) Config() *any.Any
- func (k *Kraken) Emit(v []types.Event)
- func (k *Kraken) EmitOne(v types.Event)
- func (k *Kraken) EventType() types.EventType
- func (*Kraken) Exe() string
- func (k *Kraken) GetLoggerLevel() types.LoggerLevel
- func (k *Kraken) GetModule() string
- func (*Kraken) GetState() types.ServiceState
- func (sse *Kraken) ID() string
- func (k *Kraken) IsEnabledFor(level types.LoggerLevel) bool
- func (k *Kraken) Log(level types.LoggerLevel, m string)
- func (k *Kraken) Logf(level types.LoggerLevel, fmt string, v ...interface{})
- func (*Kraken) Message() *pb.ServiceInstance
- func (sse *Kraken) Module() string
- func (k *Kraken) Name() string
- func (k *Kraken) Release()
- func (k *Kraken) Run()
- func (*Kraken) SetCmd(*exec.Cmd)
- func (*Kraken) SetCtl(chan<- types.ServiceControl)
- func (k *Kraken) SetLoggerLevel(level types.LoggerLevel)
- func (k *Kraken) SetModule(name string)
- func (*Kraken) SetState(types.ServiceState)
- func (*Kraken) State() types.ServiceState
- func (*Kraken) Stop()
- func (k *Kraken) Subscribe(id string, c chan<- []types.Event) error
- func (k *Kraken) Unsubscribe(id string) error
- func (*Kraken) UpdateConfig(*any.Any)
- type KrakenRegistry
- func (r *KrakenRegistry) RegisterDiscoverable(si types.ServiceInstance, d map[string]map[string]reflect.Value)
- func (r *KrakenRegistry) RegisterExtension(e types.Extension)
- func (r *KrakenRegistry) RegisterModule(m types.Module)
- func (r *KrakenRegistry) RegisterMutations(si types.ServiceInstance, d map[string]types.StateMutation)
- func (r *KrakenRegistry) RegisterServiceInstance(m types.Module, d map[string]types.ServiceInstance)
- func (r *KrakenRegistry) Resolve(url string) (proto.Message, error)
- type LoggerEvent
- type ModuleAPIClient
- func (a *ModuleAPIClient) DiscoveryInit(id string) (c chan<- types.Event, e error)
- func (a *ModuleAPIClient) EventInit(id string, module string) (c <-chan types.Event, e error)
- func (a *ModuleAPIClient) GetLoggerLevel() types.LoggerLevel
- func (a *ModuleAPIClient) GetModule() string
- func (a *ModuleAPIClient) IsEnabledFor(level types.LoggerLevel) bool
- func (a *ModuleAPIClient) Log(level types.LoggerLevel, m string)
- func (a *ModuleAPIClient) Logf(level types.LoggerLevel, fmt string, v ...interface{})
- func (a *ModuleAPIClient) LoggerInit(si string) (e error)
- func (a *ModuleAPIClient) MutationInit(id string, module string) (c <-chan types.Event, e error)
- func (a *ModuleAPIClient) QueryCreate(n types.Node) (r types.Node, e error)
- func (a *ModuleAPIClient) QueryDelete(id string) (r types.Node, e error)
- func (a *ModuleAPIClient) QueryDeleteAll() (r []types.Node, e error)
- func (a *ModuleAPIClient) QueryFreeze() (e error)
- func (a *ModuleAPIClient) QueryFrozen() (r bool, e error)
- func (a *ModuleAPIClient) QueryGetValue(id string, url string) (value interface{}, err error)
- func (a *ModuleAPIClient) QueryGetValueDsc(id string, url string) (value interface{}, err error)
- func (a *ModuleAPIClient) QueryGetValues(id string, urls []string) (values map[string]interface{}, err error)
- func (a *ModuleAPIClient) QueryGetValuesDsc(id string, urls []string) (values map[string]interface{}, err error)
- func (a *ModuleAPIClient) QueryMutationEdges() (r pb.MutationEdgeList, e error)
- func (a *ModuleAPIClient) QueryMutationNodes() (r pb.MutationNodeList, e error)
- func (a *ModuleAPIClient) QueryNodeMutationEdges(id string) (r pb.MutationEdgeList, e error)
- func (a *ModuleAPIClient) QueryNodeMutationNodes(id string) (r pb.MutationNodeList, e error)
- func (a *ModuleAPIClient) QueryNodeMutationPath(id string) (r pb.MutationPath, e error)
- func (a *ModuleAPIClient) QueryRead(id string) (r types.Node, e error)
- func (a *ModuleAPIClient) QueryReadAll() (r []types.Node, e error)
- func (a *ModuleAPIClient) QueryReadAllDsc() (r []types.Node, e error)
- func (a *ModuleAPIClient) QueryReadDsc(id string) (r types.Node, e error)
- func (a *ModuleAPIClient) QuerySetValue(id string, url string, value interface{}) (err error)
- func (a *ModuleAPIClient) QuerySetValueDsc(id string, url string, value interface{}) (err error)
- func (a *ModuleAPIClient) QuerySetValues(id string, values map[string]interface{}) (ret map[string]interface{}, err error)
- func (a *ModuleAPIClient) QuerySetValuesDsc(id string, values map[string]interface{}) (ret map[string]interface{}, err error)
- func (a *ModuleAPIClient) QueryThaw() (e error)
- func (a *ModuleAPIClient) QueryUpdate(n types.Node) (r types.Node, e error)
- func (a *ModuleAPIClient) QueryUpdateDsc(n types.Node) (r types.Node, e error)
- func (a *ModuleAPIClient) Self() types.NodeID
- func (a *ModuleAPIClient) ServiceInit(id string, module string) (c <-chan types.ServiceControl, e error)
- func (a *ModuleAPIClient) SetLoggerLevel(level types.LoggerLevel)
- func (a *ModuleAPIClient) SetModule(name string)
- func (a *ModuleAPIClient) SetSelf(s types.NodeID)
- type ModuleAPIServer
- func (s *ModuleAPIServer) DiscoveryInit(stream pb.ModuleAPI_DiscoveryInitServer) (e error)
- func (s *ModuleAPIServer) Emit(v []types.Event)
- func (s *ModuleAPIServer) EmitOne(v types.Event)
- func (s *ModuleAPIServer) EventInit(sir *pb.ServiceInitRequest, stream pb.ModuleAPI_EventInitServer) (e error)
- func (s *ModuleAPIServer) EventType() types.EventType
- func (s *ModuleAPIServer) GetLoggerLevel() types.LoggerLevel
- func (s *ModuleAPIServer) GetModule() string
- func (s *ModuleAPIServer) IsEnabledFor(level types.LoggerLevel) bool
- func (s *ModuleAPIServer) Log(level types.LoggerLevel, m string)
- func (s *ModuleAPIServer) Logf(level types.LoggerLevel, fmt string, v ...interface{})
- func (s *ModuleAPIServer) LoggerInit(stream pb.ModuleAPI_LoggerInitServer) (e error)
- func (s *ModuleAPIServer) MutationInit(sir *pb.ServiceInitRequest, stream pb.ModuleAPI_MutationInitServer) (e error)
- func (s *ModuleAPIServer) QueryCreate(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryDelete(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryDeleteAll(ctx context.Context, in *ptypes.Empty) (out *pb.QueryMulti, e error)
- func (s *ModuleAPIServer) QueryFreeze(ctx context.Context, in *ptypes.Empty) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryFrozen(ctx context.Context, in *ptypes.Empty) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryMutationEdges(ctx context.Context, in *ptypes.Empty) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryMutationNodes(ctx context.Context, in *ptypes.Empty) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryNodeMutationEdges(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryNodeMutationNodes(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryNodeMutationPath(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryRead(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryReadAll(ctx context.Context, in *ptypes.Empty) (out *pb.QueryMulti, e error)
- func (s *ModuleAPIServer) QueryReadAllDsc(ctx context.Context, in *ptypes.Empty) (out *pb.QueryMulti, e error)
- func (s *ModuleAPIServer) QueryReadDsc(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryThaw(ctx context.Context, in *ptypes.Empty) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryUpdate(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) QueryUpdateDsc(ctx context.Context, in *pb.Query) (out *pb.Query, e error)
- func (s *ModuleAPIServer) Run(ready chan<- interface{})
- func (s *ModuleAPIServer) ServiceInit(sir *pb.ServiceInitRequest, stream pb.ModuleAPI_ServiceInitServer) (e error)
- func (s *ModuleAPIServer) SetLoggerLevel(level types.LoggerLevel)
- func (s *ModuleAPIServer) SetModule(name string)
- func (s *ModuleAPIServer) Subscribe(id string, c chan<- []types.Event) error
- func (s *ModuleAPIServer) Unsubscribe(id string) error
- type Mutation
- type MutationEvent
- type Node
- func (n *Node) AddExtension(m proto.Message) (e error)
- func (n *Node) AddService(si *pb.ServiceInstance) (e error)
- func (n *Node) Binary() []byte
- func (n *Node) DelExtension(url string)
- func (n *Node) DelService(id string)
- func (n *Node) Diff(node types.Node, prefix string) (r []string, e error)
- func (n *Node) GetExtensionURLs() (r []string)
- func (n *Node) GetExtensions() (r map[string]proto.Message)
- func (n *Node) GetService(id string) (r *pb.ServiceInstance)
- func (n *Node) GetServiceIDs() (r []string)
- func (n *Node) GetServices() (r []*pb.ServiceInstance)
- func (n *Node) GetValue(url string) (v reflect.Value, e error)
- func (n *Node) GetValues(urls []string) (v map[string]reflect.Value, e error)
- func (n *Node) HasExtension(url string) bool
- func (n *Node) HasService(id string) bool
- func (n *Node) ID() types.NodeID
- func (n *Node) JSON() []byte
- func (n *Node) Merge(node types.Node, pre string) (changes []string, e error)
- func (n *Node) MergeDiff(node types.Node, diff []string) (changes []string, e error)
- func (n *Node) Message() proto.Message
- func (n *Node) ParentID() (pid types.NodeID)
- func (n *Node) SetValue(url string, value reflect.Value) (v reflect.Value, e error)
- func (n *Node) SetValues(valmap map[string]reflect.Value) (v map[string]reflect.Value)
- func (n *Node) String() string
- type Query
- type QueryEngine
- func (q *QueryEngine) Create(n types.Node) (nc types.Node, e error)
- func (q *QueryEngine) Delete(nid types.NodeID) (nc types.Node, e error)
- func (q *QueryEngine) DeleteAll() (nc []types.Node, e error)
- func (q *QueryEngine) Freeze() (e error)
- func (q *QueryEngine) Frozen() (b bool, e error)
- func (q *QueryEngine) GetValue(url string) (v reflect.Value, e error)
- func (q *QueryEngine) GetValueDsc(url string) (v reflect.Value, e error)
- func (q *QueryEngine) Read(n types.NodeID) (nc types.Node, e error)
- func (q *QueryEngine) ReadAll() (nc []types.Node, e error)
- func (q *QueryEngine) ReadAllDsc() (nc []types.Node, e error)
- func (q *QueryEngine) ReadDsc(n types.NodeID) (nc types.Node, e error)
- func (q *QueryEngine) ReadMutationEdges(url string) (mc pb.MutationEdgeList, e error)
- func (q *QueryEngine) ReadMutationNodes(url string) (mc pb.MutationNodeList, e error)
- func (q *QueryEngine) ReadNodeMutationEdges(url string) (mc pb.MutationEdgeList, e error)
- func (q *QueryEngine) ReadNodeMutationNodes(url string) (mc pb.MutationNodeList, e error)
- func (q *QueryEngine) ReadNodeMutationPath(url string) (mc pb.MutationPath, e error)
- func (q *QueryEngine) SetValue(url string, v reflect.Value) (rv reflect.Value, e error)
- func (q *QueryEngine) SetValueDsc(url string, v reflect.Value) (rv reflect.Value, e error)
- func (q *QueryEngine) Thaw() (e error)
- func (q *QueryEngine) Update(n types.Node) (nc types.Node, e error)
- func (q *QueryEngine) UpdateDsc(n types.Node) (nc types.Node, e error)
- type QueryResponse
- type ServiceInstance
- func (si *ServiceInstance) GetState() types.ServiceState
- func (si *ServiceInstance) ID() string
- func (si *ServiceInstance) Module() string
- func (si *ServiceInstance) SetCtl(ctl chan<- types.ServiceControl)
- func (si *ServiceInstance) SetSock(sock string)
- func (si *ServiceInstance) Start()
- func (si *ServiceInstance) Stop()
- func (si *ServiceInstance) UpdateConfig()
- func (si *ServiceInstance) Watch(wchan chan<- types.ServiceInstanceUpdate)
- type ServiceLogger
- func (l *ServiceLogger) GetLoggerLevel() types.LoggerLevel
- func (l *ServiceLogger) GetModule() string
- func (l *ServiceLogger) IsEnabledFor(lv types.LoggerLevel) (r bool)
- func (l *ServiceLogger) Log(lv types.LoggerLevel, m string)
- func (l *ServiceLogger) Logf(lv types.LoggerLevel, f string, v ...interface{})
- func (l *ServiceLogger) RegisterChannel(c chan<- LoggerEvent)
- func (l *ServiceLogger) SetLoggerLevel(lv types.LoggerLevel)
- func (l *ServiceLogger) SetModule(m string)
- type ServiceManager
- type State
- func (s *State) BulkCreate(ns []types.Node) (r []types.Node, e error)
- func (s *State) BulkDelete(ns []types.Node) (r []types.Node, e error)
- func (s *State) BulkDeleteByID(nids []types.NodeID) (r []types.Node, e error)
- func (s *State) BulkRead(nids []types.NodeID) (r []types.Node, e error)
- func (s *State) BulkUpdate(ns []types.Node) (r []types.Node, e error)
- func (s *State) Create(n types.Node) (r types.Node, e error)
- func (s *State) Delete(n types.Node) (r types.Node, e error)
- func (s *State) DeleteAll() (r []types.Node, e error)
- func (s *State) DeleteByID(nid types.NodeID) (r types.Node, e error)
- func (s *State) GetValue(url string) (r reflect.Value, e error)
- func (s *State) Read(nid types.NodeID) (r types.Node, e error)
- func (s *State) ReadAll() (r []types.Node, e error)
- func (s *State) SetValue(url string, v reflect.Value) (r reflect.Value, e error)
- func (s *State) Update(n types.Node) (r types.Node, e error)
- type StateChangeEvent
- type StateDifferenceEngine
- func (n *StateDifferenceEngine) BulkCreate(ms []types.Node) (r []types.Node, e error)
- func (n *StateDifferenceEngine) BulkDelete(ms []types.Node) (r []types.Node, e error)
- func (n *StateDifferenceEngine) BulkDeleteByID(nids []types.NodeID) (r []types.Node, e error)
- func (n *StateDifferenceEngine) BulkRead(nids []types.NodeID) (r []types.Node, e error)
- func (n *StateDifferenceEngine) BulkReadDsc(nids []types.NodeID) (r []types.Node, e error)
- func (n *StateDifferenceEngine) BulkUpdate(ms []types.Node) (r []types.Node, e error)
- func (n *StateDifferenceEngine) BulkUpdateDsc(ms []types.Node) (r []types.Node, e error)
- func (n *StateDifferenceEngine) Create(m types.Node) (r types.Node, e error)
- func (n *StateDifferenceEngine) Delete(m types.Node) (r types.Node, e error)
- func (n *StateDifferenceEngine) DeleteAll() (r []types.Node, e error)
- func (n *StateDifferenceEngine) DeleteByID(nid types.NodeID) (r types.Node, e error)
- func (n *StateDifferenceEngine) Emit(v []types.Event)
- func (n *StateDifferenceEngine) EmitOne(v types.Event)
- func (n *StateDifferenceEngine) EventType() types.EventType
- func (n *StateDifferenceEngine) GetLoggerLevel() types.LoggerLevel
- func (n *StateDifferenceEngine) GetModule() string
- func (n *StateDifferenceEngine) GetValue(url string) (r reflect.Value, e error)
- func (n *StateDifferenceEngine) GetValueDsc(url string) (r reflect.Value, e error)
- func (n *StateDifferenceEngine) IsEnabledFor(level types.LoggerLevel) bool
- func (n *StateDifferenceEngine) Log(level types.LoggerLevel, m string)
- func (n *StateDifferenceEngine) Logf(level types.LoggerLevel, fmt string, v ...interface{})
- func (n *StateDifferenceEngine) QueryChan() chan<- types.Query
- func (n *StateDifferenceEngine) Read(nid types.NodeID) (r types.Node, e error)
- func (n *StateDifferenceEngine) ReadAll() (r []types.Node, e error)
- func (n *StateDifferenceEngine) ReadAllDsc() (r []types.Node, e error)
- func (n *StateDifferenceEngine) ReadDsc(nid types.NodeID) (r types.Node, e error)
- func (n *StateDifferenceEngine) Run(ready chan<- interface{})
- func (n *StateDifferenceEngine) SetLoggerLevel(level types.LoggerLevel)
- func (n *StateDifferenceEngine) SetModule(name string)
- func (n *StateDifferenceEngine) SetValue(url string, v reflect.Value) (r reflect.Value, e error)
- func (n *StateDifferenceEngine) SetValueDsc(url string, v reflect.Value) (r reflect.Value, e error)
- func (n *StateDifferenceEngine) Subscribe(id string, c chan<- []types.Event) error
- func (n *StateDifferenceEngine) Unsubscribe(id string) error
- func (n *StateDifferenceEngine) Update(m types.Node) (r types.Node, e error)
- func (n *StateDifferenceEngine) UpdateDsc(m types.Node) (r types.Node, e error)
- type StateMutation
- func (s *StateMutation) After() types.StateSpec
- func (s *StateMutation) Before() types.StateSpec
- func (s *StateMutation) Context() types.StateMutationContext
- func (s *StateMutation) Excludes() map[string]reflect.Value
- func (s *StateMutation) FailTo() [3]string
- func (s *StateMutation) Mutates() map[string][2]reflect.Value
- func (s *StateMutation) Requires() map[string]reflect.Value
- func (s *StateMutation) SetTimeout(t time.Duration)
- func (s *StateMutation) SpecCompatIn(sp types.StateSpec, muts map[string]uint32) bool
- func (s *StateMutation) SpecCompatOut(sp types.StateSpec, muts map[string]uint32) bool
- func (s *StateMutation) Timeout() time.Duration
- type StateMutationEngine
- func (sme *StateMutationEngine) DumpGraph()
- func (sme *StateMutationEngine) DumpJSONGraph(nodes []*mutationNode, edges []*mutationEdge)
- func (sme *StateMutationEngine) Emit(v []types.Event)
- func (sme *StateMutationEngine) EmitOne(v types.Event)
- func (sme *StateMutationEngine) EventType() types.EventType
- func (sme *StateMutationEngine) Freeze()
- func (sme *StateMutationEngine) Frozen() bool
- func (sme *StateMutationEngine) GetLoggerLevel() types.LoggerLevel
- func (sme *StateMutationEngine) GetModule() string
- func (sme *StateMutationEngine) IsEnabledFor(level types.LoggerLevel) bool
- func (sme *StateMutationEngine) Log(level types.LoggerLevel, m string)
- func (sme *StateMutationEngine) Logf(level types.LoggerLevel, fmt string, v ...interface{})
- func (sme *StateMutationEngine) NodeMatch(node types.Node) (i int)
- func (sme *StateMutationEngine) PathExists(start types.Node, end types.Node) (r bool, e error)
- func (sme *StateMutationEngine) QueryChan() chan<- types.Query
- func (sme *StateMutationEngine) RegisterMutation(si, id string, mut types.StateMutation) (e error)
- func (sme *StateMutationEngine) Run(ready chan<- interface{})
- func (sme *StateMutationEngine) SetLoggerLevel(level types.LoggerLevel)
- func (sme *StateMutationEngine) SetModule(name string)
- func (sme *StateMutationEngine) Subscribe(id string, c chan<- []types.Event) error
- func (sme *StateMutationEngine) Thaw()
- func (sme *StateMutationEngine) Unsubscribe(id string) error
- type StateSpec
- func (s *StateSpec) Equal(b types.StateSpec) bool
- func (s *StateSpec) Excludes() map[string]reflect.Value
- func (s *StateSpec) ExcsEqual(b types.StateSpec) bool
- func (s *StateSpec) LeastCommon(b types.StateSpec)
- func (s *StateSpec) NodeCompatWithMutators(n types.Node, muts map[string]uint32) (r bool)
- func (s *StateSpec) NodeMatch(n types.Node) (r bool)
- func (s *StateSpec) NodeMatchWithMutators(n types.Node, muts map[string]uint32) bool
- func (s *StateSpec) ReqsEqual(b types.StateSpec) bool
- func (s *StateSpec) Requires() map[string]reflect.Value
- func (a *StateSpec) SpecCompat(b types.StateSpec) (r bool)
- func (s *StateSpec) SpecMerge(b types.StateSpec) (ns types.StateSpec, e error)
- func (s *StateSpec) SpecMergeMust(b types.StateSpec) (ns types.StateSpec)
- func (s *StateSpec) StripZeros()
- type StateSyncEngine
- func (sse *StateSyncEngine) Emit(v []types.Event)
- func (sse *StateSyncEngine) EmitOne(v types.Event)
- func (sse *StateSyncEngine) EventType() types.EventType
- func (sse *StateSyncEngine) GetLoggerLevel() types.LoggerLevel
- func (sse *StateSyncEngine) GetModule() string
- func (sse *StateSyncEngine) GetState() types.ServiceState
- func (sse *StateSyncEngine) ID() string
- func (sse *StateSyncEngine) IsEnabledFor(level types.LoggerLevel) bool
- func (sse *StateSyncEngine) Log(level types.LoggerLevel, m string)
- func (sse *StateSyncEngine) Logf(level types.LoggerLevel, fmt string, v ...interface{})
- func (sse *StateSyncEngine) Module() string
- func (*StateSyncEngine) Name() string
- func (sse *StateSyncEngine) RPCPhoneHome(ctx context.Context, in *pb.PhoneHomeRequest) (out *pb.PhoneHomeReply, e error)
- func (sse *StateSyncEngine) Run(ready chan<- interface{})
- func (sse *StateSyncEngine) SetCtl(chan<- types.ServiceControl)
- func (sse *StateSyncEngine) SetLoggerLevel(level types.LoggerLevel)
- func (sse *StateSyncEngine) SetModule(name string)
- func (sse *StateSyncEngine) SetSock(string)
- func (sse *StateSyncEngine) Start()
- func (sse *StateSyncEngine) Stop()
- func (sse *StateSyncEngine) Subscribe(id string, c chan<- []types.Event) error
- func (sse *StateSyncEngine) Unsubscribe(id string) error
- func (sse *StateSyncEngine) UpdateConfig()
- func (sse *StateSyncEngine) Watch(chan<- types.ServiceInstanceUpdate)
- type WriterLogger
- func (l *WriterLogger) GetLoggerLevel() types.LoggerLevel
- func (l *WriterLogger) GetModule() string
- func (l *WriterLogger) IsEnabledFor(lv types.LoggerLevel) (r bool)
- func (l *WriterLogger) Log(lv types.LoggerLevel, m string)
- func (l *WriterLogger) Logf(lv types.LoggerLevel, f string, v ...interface{})
- func (l *WriterLogger) RegisterWriter(w io.Writer)
- func (l *WriterLogger) SetLoggerLevel(lv types.LoggerLevel)
- func (l *WriterLogger) SetModule(m string)
Constants ¶
const ( DDDEBUG = types.LLDDDEBUG DDEBUG = types.LLDDEBUG DEBUG = types.LLDEBUG INFO = types.LLINFO NOTICE = types.LLNOTICE WARNING = types.LLWARNING ERROR = types.LLERROR CRITICAL = types.LLCRITICAL FATAL = types.LLFATAL PANIC = types.LLPANIC )
create shortcut aliases for log levels
const ( StateChange_CREATE pb.StateChangeControl_Type = pb.StateChangeControl_CREATE StateChange_READ pb.StateChangeControl_Type = pb.StateChangeControl_READ //unused StateChange_UPDATE pb.StateChangeControl_Type = pb.StateChangeControl_UPDATE StateChange_DELETE pb.StateChangeControl_Type = pb.StateChangeControl_DELETE StateChange_CFG_READ pb.StateChangeControl_Type = pb.StateChangeControl_CFG_READ //unused StateChange_CFG_UPDATE pb.StateChangeControl_Type = pb.StateChangeControl_CFG_UPDATE )
const ( MutationEvent_MUTATE pb.MutationControl_Type = pb.MutationControl_MUTATE MutationEvent_INTERRUPT pb.MutationControl_Type = pb.MutationControl_INTERRUPT )
const AddrURL = "type.googleapis.com/IPv4.IPv4OverEthernet/Ifaces/kraken/Ip/Ip"
Variables ¶
var MutationEventString = map[pb.MutationControl_Type]string{ MutationEvent_MUTATE: "MUTATE", MutationEvent_INTERRUPT: "INTERRUPT", }
var Registry = NewKrakenRegistry()
Registry is where we register modules & extensions It provides various internal functions We need this prior to init(), so it must be a global
var StateChangeTypeString = map[pb.StateChangeControl_Type]string{ StateChange_CREATE: "CREATE", StateChange_READ: "READ", StateChange_UPDATE: "UPDATE", StateChange_DELETE: "DELETE", StateChange_CFG_READ: "CFG_READ", StateChange_CFG_UPDATE: "CFG_UPDATE", }
Functions ¶
func ChanSender ¶
ChanSender is for the simple case were we just retransmit on a chan
func CreateDiscovers ¶ added in v0.2.0
func CreateMutation ¶ added in v0.2.0
func CreateMutation(si types.ServiceInstance, m *Mutation) (types.StateMutation, error)
createMutation turns a string mutation definition into a StateMutation
func DefaultRootSpec ¶
DefaultRootSpec provides a sensible root StateSpec to build the mutation graph off of
func FilterRegexp ¶
FilterRegexp matches URL to a compiled Regexp
func FilterRegexpStr ¶
FilterRegexpStr matches URL to a regexp (string) FilterRegexp is probably more efficient for repeated filtering
func FilterSimple ¶
FilterSimple is mostly for an example; it's not very useful
func LookupEnum ¶ added in v0.2.0
func LookupEnum(url string) (enumName string, enumType reflect.Type, valueMap map[string]int32, err error)
LookupEnum finds an enum and its value map based on URL
func LookupEnumValue ¶ added in v0.2.0
LookupEnumValue maps an enum value to a reflect.Value based on URL and value string
func ModuleExecute ¶
func ModuleExecute(id, module, sock string)
moduleExecute does all of the necessary steps to start the service instance this is the actual entry point for a new module process
func MustLookupEnum ¶ added in v0.2.0
MustLookupEnum performs LookupEnum, but panics if enum lookup fails
func MustLookupEnumValue ¶ added in v0.2.0
MustLookupEnumValue performs LookupEnumValue, but panics if lookup fails
func MustValueFromString ¶ added in v0.2.0
MustValueFromString wraps ValueFromString, but panics on error
func NewStateChangeEvent ¶
NewStateChangeEvent creates a new event of this time, fully specified
func ServiceLoggerListener ¶
func ServiceLoggerListener(l types.Logger, c <-chan LoggerEvent)
ServiceLoggerListener receives log events through a channel and passes them to a secondary logger interface This can be run as a goroutine
Types ¶
type Context ¶
type Context struct { Logger ServiceLogger Query QueryEngine SubChan chan<- types.EventListener Self types.NodeID Parents []string SDE ContextSDE SSE ContextSSE SME ContextSME RPC ContextRPC Sm types.ServiceManager // API needs this // contains filtered or unexported fields }
Context contains information about the current running context such as who we are, and to whom we belong.
type ContextRPC ¶
type ContextSME ¶
type ContextSSE ¶
type DiscoveryEvent ¶
type DiscoveryEvent struct { ID string // ID of a service instance URL string // fully qualified, with node ValueID string }
A DiscoveryEvent announce a discovery This should probably live elsewhere This maps directly to a pb.DiscoveryControl
func (*DiscoveryEvent) String ¶
func (de *DiscoveryEvent) String() string
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
An Event is a generic container for internal events, like state changes
type EventDispatchEngine ¶
type EventDispatchEngine struct {
// contains filtered or unexported fields
}
EventDispatchEngine redistributes event to (possibly filtered) listeners.
func NewEventDispatchEngine ¶
func NewEventDispatchEngine(ctx Context) (v *EventDispatchEngine)
NewEventDispatchEngine creates an initialized EventDispatchEngine
func (*EventDispatchEngine) AddListener ¶
func (v *EventDispatchEngine) AddListener(el types.EventListener) (e error)
AddListener gets called to add a Listener; Listeners are filtered subscribers
func (*EventDispatchEngine) EventChan ¶
func (v *EventDispatchEngine) EventChan() chan<- []types.Event
EventChan is the channel emitters should send new events on
func (*EventDispatchEngine) GetLoggerLevel ¶
func (v *EventDispatchEngine) GetLoggerLevel() types.LoggerLevel
func (*EventDispatchEngine) GetModule ¶
func (v *EventDispatchEngine) GetModule() string
func (*EventDispatchEngine) IsEnabledFor ¶
func (v *EventDispatchEngine) IsEnabledFor(level types.LoggerLevel) bool
func (*EventDispatchEngine) Log ¶
func (v *EventDispatchEngine) Log(level types.LoggerLevel, m string)
func (*EventDispatchEngine) Logf ¶
func (v *EventDispatchEngine) Logf(level types.LoggerLevel, fmt string, va ...interface{})
func (*EventDispatchEngine) Run ¶
func (v *EventDispatchEngine) Run(ready chan<- interface{})
Run is a goroutine than handles event dispatch and subscriptions There's currently no way to stop this once it's started.
func (*EventDispatchEngine) SetLoggerLevel ¶
func (v *EventDispatchEngine) SetLoggerLevel(level types.LoggerLevel)
func (*EventDispatchEngine) SetModule ¶
func (v *EventDispatchEngine) SetModule(name string)
func (*EventDispatchEngine) SubscriptionChan ¶
func (v *EventDispatchEngine) SubscriptionChan() chan<- types.EventListener
SubscriptionChan gets the channel we can subscribe new EventListeners with
type EventEmitter ¶
type EventEmitter struct {
// contains filtered or unexported fields
}
EventEmitter is really just a helper object, and not a core type. It simplifies making an engine that Emits events to event dispatch.
func NewEventEmitter ¶
func NewEventEmitter(t types.EventType) *EventEmitter
NewEventEmitter creates a new initialized EventEmitter. It must be Subscribed to do anything interesting.
func (*EventEmitter) Emit ¶
func (m *EventEmitter) Emit(v []types.Event)
Emit emits (non-blocking) a slice of Events NOT a goroutine; handles that internally
func (*EventEmitter) EmitOne ¶
func (m *EventEmitter) EmitOne(v types.Event)
EmitOne is a helper for when we have a single event
func (*EventEmitter) EventType ¶
func (m *EventEmitter) EventType() types.EventType
EventType returns the event type that this Emitter sends
func (*EventEmitter) Subscribe ¶
func (m *EventEmitter) Subscribe(id string, c chan<- []types.Event) (e error)
Subscribe links the Emitter to an Event chan, allowing it to actually send events.
func (*EventEmitter) Unsubscribe ¶
func (m *EventEmitter) Unsubscribe(id string) (e error)
Unsubscribe removes an event chan from the subscriber list
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
An EventListener implementation that leaves filter/send as arbitrary function pointers.
func NewEventListener ¶
func NewEventListener(name string, t types.EventType, filter func(types.Event) bool, send func(types.Event) error) *EventListener
NewEventListener creates a new initialized, full specified EventListener
func (*EventListener) Filter ¶
func (v *EventListener) Filter(ev types.Event) (r bool)
Filter processes a filter callback, returns whether this event would be filtered. Send uses this automatically.
func (*EventListener) Name ¶
func (v *EventListener) Name() string
Name returns the name of this listener; names are used to make unique keys, must be unique
func (*EventListener) Send ¶
func (v *EventListener) Send(ev types.Event) (e error)
Send processes the callback to send the event to the object listening.
func (*EventListener) SetState ¶
func (v *EventListener) SetState(s types.EventListenerState)
SetState sets the listener runstate
func (*EventListener) State ¶
func (v *EventListener) State() types.EventListenerState
State is the current state of the listener; listeners can be temporarily muted, for instance
func (*EventListener) Type ¶
func (v *EventListener) Type() types.EventType
Type returns the type of event we're listening for. This is another kind of filter.
type Kraken ¶
type Kraken struct { Ctx Context Ede *EventDispatchEngine Sde *StateDifferenceEngine Sse *StateSyncEngine Sme *StateMutationEngine Api *ModuleAPIServer Sm *ServiceManager // contains filtered or unexported fields }
A Kraken is a mythical giant squid-beast.
func (*Kraken) Bootstrap ¶
func (k *Kraken) Bootstrap()
Bootstrap creates all service instances in the correct order with all of the correct plumbing
func (*Kraken) GetLoggerLevel ¶
func (k *Kraken) GetLoggerLevel() types.LoggerLevel
func (*Kraken) GetState ¶
func (*Kraken) GetState() types.ServiceState
func (*Kraken) ID ¶
implement types.ServiceInstance this is a little artificial, but it's a special case many of these would never becaused because it's not actually managed by ServiceManager
func (*Kraken) IsEnabledFor ¶
func (k *Kraken) IsEnabledFor(level types.LoggerLevel) bool
func (*Kraken) Message ¶
func (*Kraken) Message() *pb.ServiceInstance
func (*Kraken) Release ¶
func (k *Kraken) Release()
Release the Kraken... the Kraken process itself has the core task of managing services
func (*Kraken) SetCtl ¶
func (*Kraken) SetCtl(chan<- types.ServiceControl)
func (*Kraken) SetLoggerLevel ¶
func (k *Kraken) SetLoggerLevel(level types.LoggerLevel)
func (*Kraken) SetState ¶
func (*Kraken) SetState(types.ServiceState)
func (*Kraken) State ¶
func (*Kraken) State() types.ServiceState
func (*Kraken) Unsubscribe ¶
func (*Kraken) UpdateConfig ¶
type KrakenRegistry ¶
type KrakenRegistry struct { Modules map[string]types.Module Extensions map[string]types.Extension Discoverables map[string]map[string]map[string]reflect.Value // d["instance_id"]["property_url"]["value_id"] Mutations map[string]map[string]types.StateMutation // m["instance_id"]["mutation_id"] ServiceInstances map[string]map[string]types.ServiceInstance // s["module"]["instance_id"] }
func NewKrakenRegistry ¶
func NewKrakenRegistry() *KrakenRegistry
func (*KrakenRegistry) RegisterDiscoverable ¶
func (r *KrakenRegistry) RegisterDiscoverable(si types.ServiceInstance, d map[string]map[string]reflect.Value)
RegisterDiscoverable adds a map of discoverables the module can emit
func (*KrakenRegistry) RegisterExtension ¶
func (r *KrakenRegistry) RegisterExtension(e types.Extension)
RegisterExtension adds an extension to the map if it hasn't been already It's probably a good idea for this to be done in init()
func (*KrakenRegistry) RegisterModule ¶
func (r *KrakenRegistry) RegisterModule(m types.Module)
RegisterModule adds an module to the map if it hasn't been already It's probably a good idea for this to be done in init()
func (*KrakenRegistry) RegisterMutations ¶
func (r *KrakenRegistry) RegisterMutations(si types.ServiceInstance, d map[string]types.StateMutation)
RegisterMutations declares mutations a module can perform
func (*KrakenRegistry) RegisterServiceInstance ¶
func (r *KrakenRegistry) RegisterServiceInstance(m types.Module, d map[string]types.ServiceInstance)
RegisterServiceInstance creates a service instance with a particular module.RegisterServiceInstance Note: This can be done after the fact, but serviceinstances that are added after runtime cannot (currently) be used as part of mutation chains.
type LoggerEvent ¶
type LoggerEvent struct { Level types.LoggerLevel Module string Message string }
LoggerEvent is used by ServiceLogger to send log events over channels
type ModuleAPIClient ¶
type ModuleAPIClient struct {
// contains filtered or unexported fields
}
func NewModuleAPIClient ¶
func NewModuleAPIClient(sock string) *ModuleAPIClient
func (*ModuleAPIClient) DiscoveryInit ¶
func (a *ModuleAPIClient) DiscoveryInit(id string) (c chan<- types.Event, e error)
func (*ModuleAPIClient) GetLoggerLevel ¶
func (a *ModuleAPIClient) GetLoggerLevel() types.LoggerLevel
func (*ModuleAPIClient) GetModule ¶
func (a *ModuleAPIClient) GetModule() string
func (*ModuleAPIClient) IsEnabledFor ¶
func (a *ModuleAPIClient) IsEnabledFor(level types.LoggerLevel) bool
func (*ModuleAPIClient) Log ¶
func (a *ModuleAPIClient) Log(level types.LoggerLevel, m string)
func (*ModuleAPIClient) Logf ¶
func (a *ModuleAPIClient) Logf(level types.LoggerLevel, fmt string, v ...interface{})
func (*ModuleAPIClient) LoggerInit ¶
func (a *ModuleAPIClient) LoggerInit(si string) (e error)
func (*ModuleAPIClient) MutationInit ¶
func (*ModuleAPIClient) QueryCreate ¶
func (*ModuleAPIClient) QueryDelete ¶
func (a *ModuleAPIClient) QueryDelete(id string) (r types.Node, e error)
QueryDelete deletes a node by id
func (*ModuleAPIClient) QueryDeleteAll ¶
func (a *ModuleAPIClient) QueryDeleteAll() (r []types.Node, e error)
func (*ModuleAPIClient) QueryFreeze ¶
func (a *ModuleAPIClient) QueryFreeze() (e error)
func (*ModuleAPIClient) QueryFrozen ¶
func (a *ModuleAPIClient) QueryFrozen() (r bool, e error)
func (*ModuleAPIClient) QueryGetValue ¶
func (a *ModuleAPIClient) QueryGetValue(id string, url string) (value interface{}, err error)
QueryGetValue returns the configuration value `url` for `id`
func (*ModuleAPIClient) QueryGetValueDsc ¶
func (a *ModuleAPIClient) QueryGetValueDsc(id string, url string) (value interface{}, err error)
QueryGetValueDsc returns the configuration value `url` for `id`
func (*ModuleAPIClient) QueryGetValues ¶
func (a *ModuleAPIClient) QueryGetValues(id string, urls []string) (values map[string]interface{}, err error)
QueryGetValues returns the configuration values `urls` for `id`
func (*ModuleAPIClient) QueryGetValuesDsc ¶
func (a *ModuleAPIClient) QueryGetValuesDsc(id string, urls []string) (values map[string]interface{}, err error)
QueryGetValuesDsc returns the discoverable values `urls` for `id`
func (*ModuleAPIClient) QueryMutationEdges ¶
func (a *ModuleAPIClient) QueryMutationEdges() (r pb.MutationEdgeList, e error)
func (*ModuleAPIClient) QueryMutationNodes ¶
func (a *ModuleAPIClient) QueryMutationNodes() (r pb.MutationNodeList, e error)
func (*ModuleAPIClient) QueryNodeMutationEdges ¶
func (a *ModuleAPIClient) QueryNodeMutationEdges(id string) (r pb.MutationEdgeList, e error)
func (*ModuleAPIClient) QueryNodeMutationNodes ¶
func (a *ModuleAPIClient) QueryNodeMutationNodes(id string) (r pb.MutationNodeList, e error)
func (*ModuleAPIClient) QueryNodeMutationPath ¶
func (a *ModuleAPIClient) QueryNodeMutationPath(id string) (r pb.MutationPath, e error)
func (*ModuleAPIClient) QueryRead ¶
func (a *ModuleAPIClient) QueryRead(id string) (r types.Node, e error)
func (*ModuleAPIClient) QueryReadAll ¶
func (a *ModuleAPIClient) QueryReadAll() (r []types.Node, e error)
func (*ModuleAPIClient) QueryReadAllDsc ¶
func (a *ModuleAPIClient) QueryReadAllDsc() (r []types.Node, e error)
func (*ModuleAPIClient) QueryReadDsc ¶
func (a *ModuleAPIClient) QueryReadDsc(id string) (r types.Node, e error)
func (*ModuleAPIClient) QuerySetValue ¶
func (a *ModuleAPIClient) QuerySetValue(id string, url string, value interface{}) (err error)
QuerySetValue sets a single configurate state value on node ID
func (*ModuleAPIClient) QuerySetValueDsc ¶
func (a *ModuleAPIClient) QuerySetValueDsc(id string, url string, value interface{}) (err error)
QuerySetValueDsc sets a single discoverable state value on node ID
func (*ModuleAPIClient) QuerySetValues ¶
func (a *ModuleAPIClient) QuerySetValues(id string, values map[string]interface{}) (ret map[string]interface{}, err error)
QuerySetValues sets a specified list of configuration state values on node ID
func (*ModuleAPIClient) QuerySetValuesDsc ¶
func (a *ModuleAPIClient) QuerySetValuesDsc(id string, values map[string]interface{}) (ret map[string]interface{}, err error)
QuerySetValuesDsc sets a specified list of discoverable state values on node ID
func (*ModuleAPIClient) QueryThaw ¶
func (a *ModuleAPIClient) QueryThaw() (e error)
func (*ModuleAPIClient) QueryUpdate ¶
func (*ModuleAPIClient) QueryUpdateDsc ¶
func (*ModuleAPIClient) Self ¶
func (a *ModuleAPIClient) Self() types.NodeID
func (*ModuleAPIClient) ServiceInit ¶
func (a *ModuleAPIClient) ServiceInit(id string, module string) (c <-chan types.ServiceControl, e error)
func (*ModuleAPIClient) SetLoggerLevel ¶
func (a *ModuleAPIClient) SetLoggerLevel(level types.LoggerLevel)
func (*ModuleAPIClient) SetModule ¶
func (a *ModuleAPIClient) SetModule(name string)
func (*ModuleAPIClient) SetSelf ¶
func (a *ModuleAPIClient) SetSelf(s types.NodeID)
type ModuleAPIServer ¶
type ModuleAPIServer struct {
// contains filtered or unexported fields
}
ModuleAPIServer is the gateway for gRPC calls into Kraken (i.e. the Module interface)
func NewModuleAPIServer ¶
func NewModuleAPIServer(ctx Context) *ModuleAPIServer
NewModuleAPIServer creates a new, initialized API
func (*ModuleAPIServer) DiscoveryInit ¶
func (s *ModuleAPIServer) DiscoveryInit(stream pb.ModuleAPI_DiscoveryInitServer) (e error)
DiscoveryInit handles discoveries from nodes This dispatches nodes
func (*ModuleAPIServer) Emit ¶
func (s *ModuleAPIServer) Emit(v []types.Event)
func (*ModuleAPIServer) EmitOne ¶
func (s *ModuleAPIServer) EmitOne(v types.Event)
func (*ModuleAPIServer) EventInit ¶
func (s *ModuleAPIServer) EventInit(sir *pb.ServiceInitRequest, stream pb.ModuleAPI_EventInitServer) (e error)
EventInit handles establishing the event stream This just caputures all events and sends them over the stream
func (*ModuleAPIServer) EventType ¶
func (s *ModuleAPIServer) EventType() types.EventType
func (*ModuleAPIServer) GetLoggerLevel ¶
func (s *ModuleAPIServer) GetLoggerLevel() types.LoggerLevel
func (*ModuleAPIServer) GetModule ¶
func (s *ModuleAPIServer) GetModule() string
func (*ModuleAPIServer) IsEnabledFor ¶
func (s *ModuleAPIServer) IsEnabledFor(level types.LoggerLevel) bool
func (*ModuleAPIServer) Log ¶
func (s *ModuleAPIServer) Log(level types.LoggerLevel, m string)
func (*ModuleAPIServer) Logf ¶
func (s *ModuleAPIServer) Logf(level types.LoggerLevel, fmt string, v ...interface{})
func (*ModuleAPIServer) LoggerInit ¶
func (s *ModuleAPIServer) LoggerInit(stream pb.ModuleAPI_LoggerInitServer) (e error)
LoggerInit initializes and RPC logger stream
func (*ModuleAPIServer) MutationInit ¶
func (s *ModuleAPIServer) MutationInit(sir *pb.ServiceInitRequest, stream pb.ModuleAPI_MutationInitServer) (e error)
MutationInit handles establishing the mutation stream This just caputures (filtered) mutation events and sends them over the stream
func (*ModuleAPIServer) QueryCreate ¶
func (*ModuleAPIServer) QueryDelete ¶
func (*ModuleAPIServer) QueryDeleteAll ¶
func (s *ModuleAPIServer) QueryDeleteAll(ctx context.Context, in *ptypes.Empty) (out *pb.QueryMulti, e error)
func (*ModuleAPIServer) QueryFreeze ¶
func (*ModuleAPIServer) QueryFrozen ¶
func (*ModuleAPIServer) QueryMutationEdges ¶
func (*ModuleAPIServer) QueryMutationNodes ¶
func (*ModuleAPIServer) QueryNodeMutationEdges ¶
func (*ModuleAPIServer) QueryNodeMutationNodes ¶
func (*ModuleAPIServer) QueryNodeMutationPath ¶
func (*ModuleAPIServer) QueryReadAll ¶
func (s *ModuleAPIServer) QueryReadAll(ctx context.Context, in *ptypes.Empty) (out *pb.QueryMulti, e error)
func (*ModuleAPIServer) QueryReadAllDsc ¶
func (s *ModuleAPIServer) QueryReadAllDsc(ctx context.Context, in *ptypes.Empty) (out *pb.QueryMulti, e error)
func (*ModuleAPIServer) QueryReadDsc ¶
func (*ModuleAPIServer) QueryUpdate ¶
func (*ModuleAPIServer) QueryUpdateDsc ¶
func (*ModuleAPIServer) Run ¶
func (s *ModuleAPIServer) Run(ready chan<- interface{})
Run starts the API service listener
func (*ModuleAPIServer) ServiceInit ¶
func (s *ModuleAPIServer) ServiceInit(sir *pb.ServiceInitRequest, stream pb.ModuleAPI_ServiceInitServer) (e error)
func (*ModuleAPIServer) SetLoggerLevel ¶
func (s *ModuleAPIServer) SetLoggerLevel(level types.LoggerLevel)
func (*ModuleAPIServer) SetModule ¶
func (s *ModuleAPIServer) SetModule(name string)
func (*ModuleAPIServer) Subscribe ¶
func (s *ModuleAPIServer) Subscribe(id string, c chan<- []types.Event) error
func (*ModuleAPIServer) Unsubscribe ¶
func (s *ModuleAPIServer) Unsubscribe(id string) error
type Mutation ¶ added in v0.2.0
type Mutation struct { Mutates map[string][2]string Requires map[string]string Excludes map[string]string Context string Timeout string FailTo [2]string Handler func(mut string, cfg, dsc types.Node) }
a mutation object records mutations as strings we have to lookup types & values at runtime (with CreateMutation) This helps generate more generic module objects, as we can perform lookups after The node object with its various extensions is created.
type MutationEvent ¶
type MutationEvent struct { Type pb.MutationControl_Type // strictly speaking, we may only need the Cfg // but we generally have this info on hand anyway NodeCfg types.Node NodeDsc types.Node Mutation [2]string // [0] = module, [1] = mutid }
func (*MutationEvent) String ¶
func (me *MutationEvent) String() string
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
A Node object is the basic data store of the state engine. It is also a wrapper for a protobuf object.
func NewNodeFromBinary ¶
NewNodeFromBinary creates a new node from Binary (proto)
func NewNodeFromJSON ¶
NewNodeFromJSON creates a new node from JSON bytes
func NewNodeFromMessage ¶
NewNodeFromMessage creats a new node based on a proto message
func NewNodeWithID ¶
NewNodeWithID creates a new node with an ID pre-set
func (*Node) AddExtension ¶
AddExtension adds a new extension to the node. It will fail if marshal fails, or if it's a dupe.
func (*Node) AddService ¶
func (n *Node) AddService(si *pb.ServiceInstance) (e error)
AddService adds a ServiceInstance to the node, updates the index
func (*Node) DelExtension ¶
DelExtension removes an extension from the node. Has no return value, even if extension isn't there.
func (*Node) DelService ¶
DelService removes a ServiceInstance from a node This does not error if the instance does not exist
func (*Node) Diff ¶
Diff finds URLs that are different between this Node and another prefix allows a string prefix to be prepended to diffs note: we have to be especially careful about locking in this function
func (*Node) GetExtensionURLs ¶
GetExtensionURLs returns a slice of currently added extensions
func (*Node) GetExtensions ¶
GetExtensions returns the exts map
func (*Node) GetService ¶
func (n *Node) GetService(id string) (r *pb.ServiceInstance)
GetService returns the ServiceInstance by ID
func (*Node) GetServiceIDs ¶
GetServiceIDs returns a slice of service ID strings
func (*Node) GetServices ¶
func (n *Node) GetServices() (r []*pb.ServiceInstance)
GetServices returns a slice of pb.ServiceInstance objects
func (*Node) GetValue ¶
GetValue returns a specific value (reflect.Value) by URL note: we can't just wrap everything in a lock because n.GetService will lock too
func (*Node) HasExtension ¶
HasExtension determines if the node has an extension by URL
func (*Node) HasService ¶
HasService returns a bool stating if a service exists
func (*Node) ID ¶
ID returns the NodeID object for the node Note: we don't lock on this under the assumption that ID's don't typically change
func (*Node) Merge ¶
Merge takes any non-nil values in m into n We don't use protobuf's merge because we generally want to know what values changed! It returns a slice of URLs to changes made
func (*Node) MergeDiff ¶
MergeDiff does a merge if of what is in diff (URLs) only it returns a slice of changes made
func (*Node) SetValue ¶
SetValue sets a specific value (reflect.Value) by URL Returns the value, post-set (same if input if all went well) note: we can't just wrap everything in a lock because n.GetService will lock too
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query objects describe a state query
func NewQuery ¶
func NewQuery(t types.QueryType, s types.QueryState, url string, v []reflect.Value) (*Query, chan types.QueryResponse)
NewQuery creates an initialized query; this is how all Queries should be created
func (*Query) ResponseChan ¶
func (q *Query) ResponseChan() chan<- types.QueryResponse
ResponseChan returns the channel that a QueryResponse should be sent on
func (*Query) State ¶
func (q *Query) State() types.QueryState
State returns the state (Dsc, Cfg, or Both) we are querying
type QueryEngine ¶
type QueryEngine struct {
// contains filtered or unexported fields
}
QueryEngine provides a simple mechanism for state queries FIXME: QueryEngine should probably be abstracted
func NewQueryEngine ¶
func NewQueryEngine(sd chan<- types.Query, sm chan<- types.Query) *QueryEngine
NewQueryEngine creates a specified QueryEngine; this is the only way to set it up
func (*QueryEngine) DeleteAll ¶
func (q *QueryEngine) DeleteAll() (nc []types.Node, e error)
DeleteAll will delete all nodes from the Engine. !!!DANGEROUS!!!
func (*QueryEngine) Freeze ¶
func (q *QueryEngine) Freeze() (e error)
func (*QueryEngine) Frozen ¶
func (q *QueryEngine) Frozen() (b bool, e error)
func (*QueryEngine) GetValue ¶
func (q *QueryEngine) GetValue(url string) (v reflect.Value, e error)
GetValue will get a value from the Cfg state via a URL
func (*QueryEngine) GetValueDsc ¶
func (q *QueryEngine) GetValueDsc(url string) (v reflect.Value, e error)
GetValueDsc will get a value from the Dsc state via a URL
func (*QueryEngine) ReadAll ¶
func (q *QueryEngine) ReadAll() (nc []types.Node, e error)
ReadAll will get a slice of all nodes from the Cfg state
func (*QueryEngine) ReadAllDsc ¶
func (q *QueryEngine) ReadAllDsc() (nc []types.Node, e error)
ReadAllDsc will get a slice of all nodes from the Dsc state
func (*QueryEngine) ReadMutationEdges ¶
func (q *QueryEngine) ReadMutationEdges(url string) (mc pb.MutationEdgeList, e error)
func (*QueryEngine) ReadMutationNodes ¶
func (q *QueryEngine) ReadMutationNodes(url string) (mc pb.MutationNodeList, e error)
func (*QueryEngine) ReadNodeMutationEdges ¶
func (q *QueryEngine) ReadNodeMutationEdges(url string) (mc pb.MutationEdgeList, e error)
func (*QueryEngine) ReadNodeMutationNodes ¶
func (q *QueryEngine) ReadNodeMutationNodes(url string) (mc pb.MutationNodeList, e error)
func (*QueryEngine) ReadNodeMutationPath ¶
func (q *QueryEngine) ReadNodeMutationPath(url string) (mc pb.MutationPath, e error)
func (*QueryEngine) SetValueDsc ¶
SetValueDsc will set a value in the Dsc state via a URL
func (*QueryEngine) Thaw ¶
func (q *QueryEngine) Thaw() (e error)
type QueryResponse ¶
type QueryResponse struct {
// contains filtered or unexported fields
}
A QueryResponse is sent by the Engine to the requester with results and possible errors
func NewQueryResponse ¶
func NewQueryResponse(v []reflect.Value, e error) *QueryResponse
NewQueryResponse creates an initialized and fully specified QueryResponse
func (*QueryResponse) Error ¶
func (q *QueryResponse) Error() error
Error returns the error value of the QueryResponse
func (*QueryResponse) Value ¶
func (q *QueryResponse) Value() []reflect.Value
Value returns an array of []reflect.Value's that may have resulted from the query
type ServiceInstance ¶
type ServiceInstance struct {
// contains filtered or unexported fields
}
A ServiceInstance describes a service that will be built-in to the binary and exec'ed by forking note: state information is stored in the node proto object, this object manages a running context
func NewServiceInstance ¶
func NewServiceInstance(id, module string, entry func()) *ServiceInstance
NewServiceInstance provides a new, initialized ServiceInstance object
func (*ServiceInstance) GetState ¶
func (si *ServiceInstance) GetState() types.ServiceState
GetState returns the current run state of the service
func (*ServiceInstance) ID ¶
func (si *ServiceInstance) ID() string
ID gets the ID string for the service
func (*ServiceInstance) Module ¶
func (si *ServiceInstance) Module() string
Module returns the name of the module this is an instance of
func (*ServiceInstance) SetCtl ¶
func (si *ServiceInstance) SetCtl(ctl chan<- types.ServiceControl)
SetCtl sets the channel to send control message to (to pass through the API)
func (*ServiceInstance) SetSock ¶
func (si *ServiceInstance) SetSock(sock string)
SetSock sets the path to the API socket
func (*ServiceInstance) Stop ¶
func (si *ServiceInstance) Stop()
Stop sends a signal to the running si to stop
func (*ServiceInstance) UpdateConfig ¶
func (si *ServiceInstance) UpdateConfig()
UpdateConfig will send a signal to the running si to check for a config update
func (*ServiceInstance) Watch ¶
func (si *ServiceInstance) Watch(wchan chan<- types.ServiceInstanceUpdate)
Watch provides a channel where process state changes will be reported
type ServiceLogger ¶
type ServiceLogger struct {
// contains filtered or unexported fields
}
A ServiceLogger is a channel interface for aggregating logs from services running as separate goroutines
func (*ServiceLogger) GetLoggerLevel ¶
func (l *ServiceLogger) GetLoggerLevel() types.LoggerLevel
func (*ServiceLogger) GetModule ¶
func (l *ServiceLogger) GetModule() string
func (*ServiceLogger) IsEnabledFor ¶
func (l *ServiceLogger) IsEnabledFor(lv types.LoggerLevel) (r bool)
func (*ServiceLogger) Log ¶
func (l *ServiceLogger) Log(lv types.LoggerLevel, m string)
func (*ServiceLogger) Logf ¶
func (l *ServiceLogger) Logf(lv types.LoggerLevel, f string, v ...interface{})
func (*ServiceLogger) RegisterChannel ¶
func (l *ServiceLogger) RegisterChannel(c chan<- LoggerEvent)
RegisterChannel sets the chan that the ServiceLogger will send events over
func (*ServiceLogger) SetLoggerLevel ¶
func (l *ServiceLogger) SetLoggerLevel(lv types.LoggerLevel)
func (*ServiceLogger) SetModule ¶
func (l *ServiceLogger) SetModule(m string)
type ServiceManager ¶
type ServiceManager struct {
// contains filtered or unexported fields
}
func NewServiceManager ¶
func NewServiceManager(ctx Context, sock string) *ServiceManager
func (*ServiceManager) AddService ¶
func (sm *ServiceManager) AddService(si types.ServiceInstance)
func (*ServiceManager) DelService ¶
func (sm *ServiceManager) DelService(si string)
func (*ServiceManager) GetService ¶
func (sm *ServiceManager) GetService(si string) types.ServiceInstance
func (*ServiceManager) Run ¶
func (sm *ServiceManager) Run(ready chan<- interface{})
type State ¶
type State struct {
// contains filtered or unexported fields
}
A State stores and manipulates a collection of Nodes
func (*State) BulkCreate ¶
BulkCreate creates multiple nodes
func (*State) BulkDelete ¶
BulkDelete removes multiple nodes
func (*State) BulkDeleteByID ¶
BulkDeleteByID removes multiple nodes keyed by NodeID
func (*State) BulkUpdate ¶
BulkUpdate updates multiple nodes
func (*State) DeleteByID ¶
DeleteByID deletes a node from the state keyed by NodeID
type StateChangeEvent ¶
type StateChangeEvent struct { Type pb.StateChangeControl_Type URL string Value reflect.Value }
A StateChangeEvent is emitted when the StateDifferenceEngine detects a change to either Dsc or Cfg
func (*StateChangeEvent) String ¶
func (sce *StateChangeEvent) String() string
type StateDifferenceEngine ¶
type StateDifferenceEngine struct {
// contains filtered or unexported fields
}
An StateDifferenceEngine maintains two kinds of state: - "Discoverable" (Dsc) is the discovered state of the system - "Configuration" (Cfg) is the intended state of the system An StateDifferenceEngine provides a simple Query langage for accessing/updating state. An StateDifferenceEngine emits Events on state change
func NewStateDifferenceEngine ¶
func NewStateDifferenceEngine(ctx Context, qc chan types.Query) *StateDifferenceEngine
NewStateDifferenceEngine initializes a new StateDifferenceEngine object given a Context
func (*StateDifferenceEngine) BulkCreate ¶
BulkCreate creates multiple nodes
func (*StateDifferenceEngine) BulkDelete ¶
BulkDelete deletes multiple nodes
func (*StateDifferenceEngine) BulkDeleteByID ¶
BulkDeleteByID deletes multiple nodes, keyed by their NodeID
func (*StateDifferenceEngine) BulkReadDsc ¶
BulkReadDsc reads multiple nodes from Dsc
func (*StateDifferenceEngine) BulkUpdate ¶
BulkUpdate updates multiple nodes in Cfg
func (*StateDifferenceEngine) BulkUpdateDsc ¶
BulkUpdateDsc updates multiple nodes in Dsc
func (*StateDifferenceEngine) DeleteAll ¶
func (n *StateDifferenceEngine) DeleteAll() (r []types.Node, e error)
DeleteAll deletes all nodes in the engine, careful!
func (*StateDifferenceEngine) DeleteByID ¶
DeleteByID deletes a node by its NodeID
func (*StateDifferenceEngine) Emit ¶
func (n *StateDifferenceEngine) Emit(v []types.Event)
func (*StateDifferenceEngine) EmitOne ¶
func (n *StateDifferenceEngine) EmitOne(v types.Event)
func (*StateDifferenceEngine) EventType ¶
func (n *StateDifferenceEngine) EventType() types.EventType
func (*StateDifferenceEngine) GetLoggerLevel ¶
func (n *StateDifferenceEngine) GetLoggerLevel() types.LoggerLevel
func (*StateDifferenceEngine) GetModule ¶
func (n *StateDifferenceEngine) GetModule() string
func (*StateDifferenceEngine) GetValue ¶
func (n *StateDifferenceEngine) GetValue(url string) (r reflect.Value, e error)
GetValue gets a specific sub-value from Cfg
func (*StateDifferenceEngine) GetValueDsc ¶
func (n *StateDifferenceEngine) GetValueDsc(url string) (r reflect.Value, e error)
GetValueDsc gets a specific sub-value from Dsc
func (*StateDifferenceEngine) IsEnabledFor ¶
func (n *StateDifferenceEngine) IsEnabledFor(level types.LoggerLevel) bool
func (*StateDifferenceEngine) Log ¶
func (n *StateDifferenceEngine) Log(level types.LoggerLevel, m string)
func (*StateDifferenceEngine) Logf ¶
func (n *StateDifferenceEngine) Logf(level types.LoggerLevel, fmt string, v ...interface{})
func (*StateDifferenceEngine) QueryChan ¶
func (n *StateDifferenceEngine) QueryChan() chan<- types.Query
QueryChan returns a chanel that Queries can be sent on
func (*StateDifferenceEngine) ReadAll ¶
func (n *StateDifferenceEngine) ReadAll() (r []types.Node, e error)
ReadAll returns a slice of all nodes in Cfg
func (*StateDifferenceEngine) ReadAllDsc ¶
func (n *StateDifferenceEngine) ReadAllDsc() (r []types.Node, e error)
ReadAllDsc returns a slice of all nodes in Dsc
func (*StateDifferenceEngine) Run ¶
func (n *StateDifferenceEngine) Run(ready chan<- interface{})
Run is a goroutine that manages queries
func (*StateDifferenceEngine) SetLoggerLevel ¶
func (n *StateDifferenceEngine) SetLoggerLevel(level types.LoggerLevel)
func (*StateDifferenceEngine) SetModule ¶
func (n *StateDifferenceEngine) SetModule(name string)
func (*StateDifferenceEngine) SetValueDsc ¶
SetValueDsc sets a specific sub-value in Dsc
func (*StateDifferenceEngine) Subscribe ¶
func (n *StateDifferenceEngine) Subscribe(id string, c chan<- []types.Event) error
func (*StateDifferenceEngine) Unsubscribe ¶
func (n *StateDifferenceEngine) Unsubscribe(id string) error
type StateMutation ¶
type StateMutation struct {
// contains filtered or unexported fields
}
A StateMutation describes a possible mutation of state These are declared by modules These are used to construct the state evolution graph
func NewStateMutation ¶
func NewStateMutation(mut map[string][2]reflect.Value, req map[string]reflect.Value, exc map[string]reflect.Value, context types.StateMutationContext, timeout time.Duration, failto [3]string) *StateMutation
NewStateMutation creates an initialized, specified StateMutation object
func (*StateMutation) After ¶
func (s *StateMutation) After() types.StateSpec
After returns a StatSpec representing the state of of a matching Node after the mutation
func (*StateMutation) Before ¶
func (s *StateMutation) Before() types.StateSpec
Before returns a StatSpec representing the state of of a matching Node before the mutation
func (*StateMutation) Context ¶
func (s *StateMutation) Context() types.StateMutationContext
Context specifies in which context (Self/Child/All) this mutation applies to Note: this doesn't affect the graph; just who does the work.
func (*StateMutation) Excludes ¶
func (s *StateMutation) Excludes() map[string]reflect.Value
Excludes returns the map of URLs/values that are mutally exclusive with this mutation
func (*StateMutation) FailTo ¶
func (s *StateMutation) FailTo() [3]string
func (*StateMutation) Mutates ¶
func (s *StateMutation) Mutates() map[string][2]reflect.Value
Mutates returns the map of URLs/values (before & after) that mutate in this mutation
func (*StateMutation) Requires ¶
func (s *StateMutation) Requires() map[string]reflect.Value
Requires returns the map of URLs/values that are required for this mutation
func (*StateMutation) SetTimeout ¶
func (s *StateMutation) SetTimeout(t time.Duration)
func (*StateMutation) SpecCompatIn ¶
SpecCompatIn decides if this mutation can form an in arrow in the graph This is used for graph building.
func (*StateMutation) SpecCompatOut ¶
SpecCompatOut decides if this mutaiton can form an out arrow in the graph This is used for graph building.
func (*StateMutation) Timeout ¶
func (s *StateMutation) Timeout() time.Duration
type StateMutationEngine ¶
type StateMutationEngine struct {
// contains filtered or unexported fields
}
A StateMutationEngine listens for state change events and manages mutations to evolve Dsc state into Cfg state
func NewStateMutationEngine ¶
func NewStateMutationEngine(ctx Context, qc chan types.Query) *StateMutationEngine
NewStateMutationEngine creates an initialized StateMutationEngine
func (*StateMutationEngine) DumpGraph ¶
func (sme *StateMutationEngine) DumpGraph()
DumpGraph FIXME: REMOVE -- for debugging LOCKS: graphMutex (R)
func (*StateMutationEngine) DumpJSONGraph ¶
func (sme *StateMutationEngine) DumpJSONGraph(nodes []*mutationNode, edges []*mutationEdge)
DumpJSONGraph for debugging the graph !!!IMPORTANT!!! DumpJSONGraph assumes you already hold a lock
func (*StateMutationEngine) Emit ¶
func (sme *StateMutationEngine) Emit(v []types.Event)
func (*StateMutationEngine) EmitOne ¶
func (sme *StateMutationEngine) EmitOne(v types.Event)
func (*StateMutationEngine) EventType ¶
func (sme *StateMutationEngine) EventType() types.EventType
func (*StateMutationEngine) Freeze ¶
func (sme *StateMutationEngine) Freeze()
func (*StateMutationEngine) Frozen ¶
func (sme *StateMutationEngine) Frozen() bool
func (*StateMutationEngine) GetLoggerLevel ¶
func (sme *StateMutationEngine) GetLoggerLevel() types.LoggerLevel
func (*StateMutationEngine) GetModule ¶
func (sme *StateMutationEngine) GetModule() string
func (*StateMutationEngine) IsEnabledFor ¶
func (sme *StateMutationEngine) IsEnabledFor(level types.LoggerLevel) bool
func (*StateMutationEngine) Log ¶
func (sme *StateMutationEngine) Log(level types.LoggerLevel, m string)
func (*StateMutationEngine) Logf ¶
func (sme *StateMutationEngine) Logf(level types.LoggerLevel, fmt string, v ...interface{})
func (*StateMutationEngine) NodeMatch ¶
func (sme *StateMutationEngine) NodeMatch(node types.Node) (i int)
NodeMatch determines how many compatable StateSpecs this node has in the graph
func (*StateMutationEngine) PathExists ¶
PathExists returns a boolean indicating whether or not a path exists in the graph between two nodes. If the path doesn't exist, it also returns the error. LOCKS: graphMutex (R) via findPath
func (*StateMutationEngine) QueryChan ¶
func (sme *StateMutationEngine) QueryChan() chan<- types.Query
QueryChan returns a chanel that Queries can be sent on
func (*StateMutationEngine) RegisterMutation ¶
func (sme *StateMutationEngine) RegisterMutation(si, id string, mut types.StateMutation) (e error)
RegisterMutation injects new mutaitons into the SME. muts[i] should match callback[i] We take a list so that we only call onUpdate once LOCKS: graphMutex (RW)
func (*StateMutationEngine) Run ¶
func (sme *StateMutationEngine) Run(ready chan<- interface{})
Run is a goroutine that listens for state changes and performs StateMutation magic LOCKS: all
func (*StateMutationEngine) SetLoggerLevel ¶
func (sme *StateMutationEngine) SetLoggerLevel(level types.LoggerLevel)
func (*StateMutationEngine) SetModule ¶
func (sme *StateMutationEngine) SetModule(name string)
func (*StateMutationEngine) Subscribe ¶
func (sme *StateMutationEngine) Subscribe(id string, c chan<- []types.Event) error
func (*StateMutationEngine) Thaw ¶
func (sme *StateMutationEngine) Thaw()
func (*StateMutationEngine) Unsubscribe ¶
func (sme *StateMutationEngine) Unsubscribe(id string) error
type StateSpec ¶
type StateSpec struct {
// contains filtered or unexported fields
}
A StateSpec is essentially a filter that determines if a given state falls within the spec or not. It currently systems of required and excluded values for specific URLs.
func NewStateSpec ¶
NewStateSpec creates a new initialized and fully specified StateSpec
func (*StateSpec) Equal ¶
Equal tests if two specs are identical. Note: DeepEqual doesn't work because it doesn't turn vals into interfaces.
func (*StateSpec) LeastCommon ¶
LeastCommon keeps only the values that are also in the supplied spec
func (*StateSpec) NodeCompatWithMutators ¶
NodeCompatWithMutators is how we find endpoints for mutation paths 1) For each mutator that is in the node, the spec must be equal 2) For each requires in the spec that is not a mutator, node must be equal 3) For each excludes in the spec that is not a mutator, node must not be equal
func (*StateSpec) NodeMatchWithMutators ¶
NodeMatchWithMutators is like NodeMatch, but requires any mutators be present and match if they are non-zero in the node
func (*StateSpec) SpecCompat ¶
SpecCompat determines if two specs are compatible. Note: this doesn't mean that a Node that matches one will match
the other; it's just possible that they would.
func (*StateSpec) SpecMerge ¶
SpecMerge is the same as SpecMergeMust, but don't assume compat, and return an error if not
func (*StateSpec) SpecMergeMust ¶
SpecMergeMust makes the most specified version of two compbined StateSpecs
func (*StateSpec) StripZeros ¶
func (s *StateSpec) StripZeros()
StripZeros removes any reqs/excs that are equal to zero value
type StateSyncEngine ¶
type StateSyncEngine struct {
// contains filtered or unexported fields
}
StateSyncEngine manages tree-style, eventual consistency state synchronization
func NewStateSyncEngine ¶
func NewStateSyncEngine(ctx Context) *StateSyncEngine
NewStateSyncEngine creates a new initialized StateSyncEngine
func (*StateSyncEngine) Emit ¶
func (sse *StateSyncEngine) Emit(v []types.Event)
func (*StateSyncEngine) EmitOne ¶
func (sse *StateSyncEngine) EmitOne(v types.Event)
func (*StateSyncEngine) EventType ¶
func (sse *StateSyncEngine) EventType() types.EventType
func (*StateSyncEngine) GetLoggerLevel ¶
func (sse *StateSyncEngine) GetLoggerLevel() types.LoggerLevel
func (*StateSyncEngine) GetModule ¶
func (sse *StateSyncEngine) GetModule() string
func (*StateSyncEngine) GetState ¶
func (sse *StateSyncEngine) GetState() types.ServiceState
func (*StateSyncEngine) ID ¶
func (sse *StateSyncEngine) ID() string
implement types.ServiceInstance this is a bit of a hack
func (*StateSyncEngine) IsEnabledFor ¶
func (sse *StateSyncEngine) IsEnabledFor(level types.LoggerLevel) bool
func (*StateSyncEngine) Log ¶
func (sse *StateSyncEngine) Log(level types.LoggerLevel, m string)
func (*StateSyncEngine) Logf ¶
func (sse *StateSyncEngine) Logf(level types.LoggerLevel, fmt string, v ...interface{})
func (*StateSyncEngine) Module ¶
func (sse *StateSyncEngine) Module() string
func (*StateSyncEngine) RPCPhoneHome ¶
func (sse *StateSyncEngine) RPCPhoneHome(ctx context.Context, in *pb.PhoneHomeRequest) (out *pb.PhoneHomeReply, e error)
RPCPhoneHome is a gRPC call. It establishes state sync properties with a child.
func (*StateSyncEngine) Run ¶
func (sse *StateSyncEngine) Run(ready chan<- interface{})
Run is a goroutine that makes StateSyncEngine active
func (*StateSyncEngine) SetCtl ¶
func (sse *StateSyncEngine) SetCtl(chan<- types.ServiceControl)
func (*StateSyncEngine) SetLoggerLevel ¶
func (sse *StateSyncEngine) SetLoggerLevel(level types.LoggerLevel)
func (*StateSyncEngine) SetModule ¶
func (sse *StateSyncEngine) SetModule(name string)
func (*StateSyncEngine) SetSock ¶
func (sse *StateSyncEngine) SetSock(string)
func (*StateSyncEngine) Start ¶
func (sse *StateSyncEngine) Start()
func (*StateSyncEngine) Stop ¶
func (sse *StateSyncEngine) Stop()
func (*StateSyncEngine) Subscribe ¶
func (sse *StateSyncEngine) Subscribe(id string, c chan<- []types.Event) error
func (*StateSyncEngine) Unsubscribe ¶
func (sse *StateSyncEngine) Unsubscribe(id string) error
func (*StateSyncEngine) UpdateConfig ¶
func (sse *StateSyncEngine) UpdateConfig()
func (*StateSyncEngine) Watch ¶
func (sse *StateSyncEngine) Watch(chan<- types.ServiceInstanceUpdate)
type WriterLogger ¶
type WriterLogger struct { DisablePrefix bool // contains filtered or unexported fields }
A WriterLogger writes to any io.Writer interface, e.g. stdout, stderr, or an open file NOTE: Does not close the interface
func (*WriterLogger) GetLoggerLevel ¶
func (l *WriterLogger) GetLoggerLevel() types.LoggerLevel
GetLoggerLevel gets the log filtering level
func (*WriterLogger) GetModule ¶
func (l *WriterLogger) GetModule() string
GetModule gets the current module string
func (*WriterLogger) IsEnabledFor ¶
func (l *WriterLogger) IsEnabledFor(lv types.LoggerLevel) (r bool)
IsEnabledFor determines if this Logger would send a message at a particular level
func (*WriterLogger) Log ¶
func (l *WriterLogger) Log(lv types.LoggerLevel, m string)
Log submits a Log message with a LoggerLevel
func (*WriterLogger) Logf ¶
func (l *WriterLogger) Logf(lv types.LoggerLevel, f string, v ...interface{})
Logf is the same as Log but with sprintf formatting
func (*WriterLogger) RegisterWriter ¶
func (l *WriterLogger) RegisterWriter(w io.Writer)
RegisterWriter sets the writer interface this logger will use
func (*WriterLogger) SetLoggerLevel ¶
func (l *WriterLogger) SetLoggerLevel(lv types.LoggerLevel)
SetLoggerLevel sets the log filtering level
func (*WriterLogger) SetModule ¶
func (l *WriterLogger) SetModule(m string)
SetModule sets an identifier string for the component that will use this Logger
Source Files ¶
- Event.go
- EventDispatchEngine.go
- EventEmitter.go
- EventListener.go
- Kraken.go
- Logger.go
- ModuleAPIClient.go
- ModuleAPIServer.go
- Node.go
- Query.go
- QueryEngine.go
- Registry.go
- ServiceInstance.go
- ServiceManager.go
- State.go
- StateDifferenceEngine.go
- StateMutation.go
- StateMutationEngine.go
- StateSpec.go
- StateSyncEngine.go