Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrZeroDelegate indicates seeing 0 delegates in the network ErrZeroDelegate = errors.New("zero delegates in the network") )
Functions ¶
This section is empty.
Types ¶
type ConfigBasedPool ¶
type ConfigBasedPool struct { service.AbstractService // contains filtered or unexported fields }
ConfigBasedPool is the simple delegate pool implementing Pool interface
func NewConfigBasedPool ¶
func NewConfigBasedPool(cfg *config.Delegate) *ConfigBasedPool
NewConfigBasedPool creates an instance of config-based delegate pool
func (*ConfigBasedPool) AllDelegates ¶
func (cbdp *ConfigBasedPool) AllDelegates() ([]net.Addr, error)
AllDelegates implements getting the delegates from config
func (*ConfigBasedPool) AnotherDelegate ¶
func (cbdp *ConfigBasedPool) AnotherDelegate(self string) net.Addr
AnotherDelegate return the first delegate that is not the passed-in address
func (*ConfigBasedPool) NumDelegatesPerEpoch ¶ added in v0.2.0
func (cbdp *ConfigBasedPool) NumDelegatesPerEpoch() (uint, error)
NumDelegatesPerEpoch returns the configured rolling delegates number or all delegates number if 0
func (*ConfigBasedPool) RollDelegates ¶ added in v0.2.0
func (cbdp *ConfigBasedPool) RollDelegates(epochNum uint64) ([]net.Addr, error)
RollDelegates implements getting the rolling delegates per epoch
type Pool ¶
type Pool interface { // AllDelegates returns all delegates AllDelegates() ([]net.Addr, error) // RollDelegates returns rolling delegates RollDelegates(uint64) ([]net.Addr, error) // AnotherDelegate return another delegate that is not the passed-in address AnotherDelegate(self string) net.Addr // NumDelegatesPerEpoch returns number of delegates per epoch NumDelegatesPerEpoch() (uint, error) }
Pool is the interface
Click to show internal directories.
Click to hide internal directories.