Versions in this module Expand all Collapse all v0 v0.1.0 Jan 12, 2022 Changes in this version + var ErrNoClientServerAddr = errors.New("client server address should not be empty") + var ErrNoImperiumAddr = errors.New("imperium addr should not be empty") + var ErrNoReplicaID = errors.New("replica ID config should not be empty") + var MessageReceiveEventType = "MessageReceive" + var MessageSendEventType = "MessageSend" + var TimeoutEndEventType = "TimeoutEnd" + var TimeoutStartEventType = "TimeoutStart" + func Init(config *Config, d DirectiveHandler, logger Logger) error + type Config struct + ClientAdvAddr string + ClientServerAddr string + ImperiumAddr string + Info map[string]interface{} + ReplicaID types.ReplicaID + type Counter struct + func NewCounter() *Counter + func (id *Counter) Next() int + func (id *Counter) NextID(from, to types.ReplicaID) string + func (id *Counter) Reset() + type DirectiveHandler interface + Restart func() error + Start func() error + Stop func() error + type Logger interface + Debug func(msg string, keyvals ...interface{}) + Error func(msg string, keyvals ...interface{}) + Info func(msg string, keyvals ...interface{}) + type MessageQueue struct + func NewMessageQueue() *MessageQueue + func (q *MessageQueue) Add(m *types.Message) + func (q *MessageQueue) Flush() + func (q *MessageQueue) Pop() (*types.Message, bool) + type ReplicaClient struct + func GetClient() (*ReplicaClient, error) + func NewReplicaClient(config *Config, directiveHandler DirectiveHandler, logger Logger) (*ReplicaClient, error) + func (c *ReplicaClient) IsReady() bool + func (c *ReplicaClient) IsRunning() bool + func (c *ReplicaClient) Log(params map[string]interface{}, message string) + func (c *ReplicaClient) LogAsync(params map[string]interface{}, message string) + func (c *ReplicaClient) NotReady() + func (c *ReplicaClient) PublishEvent(t string, params map[string]string) + func (c *ReplicaClient) PublishEventAsync(t string, params map[string]string) + func (c *ReplicaClient) Ready() + func (c *ReplicaClient) ReceiveMessage() (*types.Message, bool) + func (c *ReplicaClient) SendMessage(t string, to types.ReplicaID, msg []byte, intercept bool) error + func (c *ReplicaClient) Start() error + func (c *ReplicaClient) StartTimer(i TimeoutInfo) + func (c *ReplicaClient) Stop() error + func (c *ReplicaClient) TimeoutChan() chan TimeoutInfo + type TimeoutInfo interface + Duration func() time.Duration + Key func() string