utils

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyncNode      NodeRole = iota
	CandidateNode          = iota
	ConsensusNode          = iota
)
View Source
const GovNodeCacheTime = time.Minute * 10
View Source
const HostsResolverCacheTime = time.Minute * 10

Variables

This section is empty.

Functions

func GetGovernanceView

func GetGovernanceView(backend *ledger.Ledger) (*governance.GovernanceView, error)

Types

type GovCache

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

type GovNodeInfo

type GovNodeInfo struct {
	ConsNode bool
	*config.VBFTPeerStakeInfo
}

func GetPeersConfig

func GetPeersConfig(backend *ledger.Ledger, view uint32) ([]*GovNodeInfo, uint32, error)

type GovNodeLedgerResolver

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

func NewGovNodeResolver

func NewGovNodeResolver(db *ledger.Ledger) *GovNodeLedgerResolver

func (*GovNodeLedgerResolver) GetNodeRoleAndView

func (self *GovNodeLedgerResolver) GetNodeRoleAndView(pubKey string) (NodeRole, uint32)

func (*GovNodeLedgerResolver) IsGovNode

func (self *GovNodeLedgerResolver) IsGovNode(pubKey string) bool

func (*GovNodeLedgerResolver) IsGovNodePubKey

func (self *GovNodeLedgerResolver) IsGovNodePubKey(key keypair.PublicKey) bool

type GovNodeMockResolver

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

func NewGovNodeMockResolver

func NewGovNodeMockResolver(gov []string) *GovNodeMockResolver

func (*GovNodeMockResolver) GetNodeRoleAndView

func (self *GovNodeMockResolver) GetNodeRoleAndView(key string) (NodeRole, uint32)

func (*GovNodeMockResolver) IsGovNode

func (self *GovNodeMockResolver) IsGovNode(key string) bool

func (*GovNodeMockResolver) IsGovNodePubKey

func (self *GovNodeMockResolver) IsGovNodePubKey(key keypair.PublicKey) bool

type GovNodeResolver

type GovNodeResolver interface {
	IsGovNodePubKey(key keypair.PublicKey) bool
	IsGovNode(key string) bool
	GetNodeRoleAndView(key string) (NodeRole, uint32)
}

type HostsCache

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

type HostsResolver

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

host resolver with cache

func NewHostsResolver

func NewHostsResolver(hosts []string) (*HostsResolver, []string)

func (*HostsResolver) GetHostAddrs

func (self *HostsResolver) GetHostAddrs() []string

type NodeRole

type NodeRole byte

type Parker

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

func NewParker

func NewParker() *Parker

func (*Parker) ParkTimeout

func (self *Parker) ParkTimeout(d time.Duration)

func (*Parker) Unpark

func (self *Parker) Unpark()

Jump to

Keyboard shortcuts

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