common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventScopeDaemon = types.EventScope("daemon")
)
View Source
const (
	SpaceDaemon = "daemon"
)

Variables

This section is empty.

Functions

func PublishDaemonEvent

func PublishDaemonEvent(event DaemonEvent)

func SubscribeDaemonEvent

func SubscribeDaemonEvent(path types.EventPath, name string, handler types.EventHandler) error

func UnsubscribeDaemonEvent

func UnsubscribeDaemonEvent(path types.EventPath, name string)

Types

type ClusterState

type ClusterState interface {
	IsLeader() bool
	GetAliveMemberIDs() []string
}

type Context

type Context interface {
	log.Logger
	LastBlockTime() time.Time
	LastBlockIndex() int64
	GetNodeID() string
	GetClient() types.Client
	GetTMConfig() *cfg.Config
	GetConfig() DaemonConfig
	GetClusterState() ClusterState
	SetClusterState(state ClusterState)
}

func NewContext

func NewContext(tmCfg *cfg.Config, logger log.Logger, tmNode *node.Node, config DaemonConfig) Context

type DaemonConfig

type DaemonConfig struct {
	ChainID  string
	NodeID   string
	NodeName string
	// HeartbeatInterval Heartbeat Interval
	HeartbeatInterval uint

	// AliveThreasholdSecond Heartbeat time Threshold
	AliveThresholdSeconds uint
}

type DaemonEvent

type DaemonEvent types.Event

type DefaultContext

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

func (*DefaultContext) Debug

func (ctx *DefaultContext) Debug(msg string, keyvals ...interface{})

Info log info

func (*DefaultContext) Error

func (ctx *DefaultContext) Error(msg string, keyvals ...interface{})

Info log info

func (*DefaultContext) GetClient

func (ctx *DefaultContext) GetClient() types.Client

func (*DefaultContext) GetClusterState

func (ctx *DefaultContext) GetClusterState() ClusterState

func (*DefaultContext) GetConfig

func (ctx *DefaultContext) GetConfig() DaemonConfig

func (*DefaultContext) GetNodeID

func (ctx *DefaultContext) GetNodeID() string

func (*DefaultContext) GetTMConfig

func (ctx *DefaultContext) GetTMConfig() *cfg.Config

func (*DefaultContext) Info

func (ctx *DefaultContext) Info(msg string, keyvals ...interface{})

Info log info

func (*DefaultContext) LastBlockIndex

func (ctx *DefaultContext) LastBlockIndex() int64

func (*DefaultContext) LastBlockTime

func (ctx *DefaultContext) LastBlockTime() time.Time

func (*DefaultContext) SetClusterState

func (ctx *DefaultContext) SetClusterState(state ClusterState)

func (*DefaultContext) With

func (ctx *DefaultContext) With(keyvals ...interface{}) log.Logger

Info log info

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL