Documentation
¶
Overview ¶
Package validators is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶ added in v0.8.0
type Connector interface { Connected(id ids.NodeID, nodeVersion *version.Application) error Disconnected(id ids.NodeID) error }
Connector represents a handler that is called when a connection is marked as connected or disconnected
type Manager ¶
type Manager interface { fmt.Stringer // Set a subnet's validator set Set(ids.ID, Set) error // AddWeight adds weight to a given validator on the given subnet AddWeight(ids.ID, ids.NodeID, uint64) error // RemoveWeight removes weight from a given validator on a given subnet RemoveWeight(ids.ID, ids.NodeID, uint64) error // GetValidators returns the validator set for the given subnet // Returns false if the subnet doesn't exist GetValidators(ids.ID) (Set, bool) // Contains returns true if there is a validator with the specified ID // currently in the set. Contains(ids.ID, ids.NodeID) bool }
Manager holds the validator set of each subnet
type MockState ¶ added in v1.9.2
type MockState struct {
// contains filtered or unexported fields
}
MockState is a mock of State interface.
func NewMockState ¶ added in v1.9.2
func NewMockState(ctrl *gomock.Controller) *MockState
NewMockState creates a new mock instance.
func (*MockState) EXPECT ¶ added in v1.9.2
func (m *MockState) EXPECT() *MockStateMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockState) GetCurrentHeight ¶ added in v1.9.2
GetCurrentHeight mocks base method.
func (*MockState) GetMinimumHeight ¶ added in v1.9.2
GetMinimumHeight mocks base method.
type MockStateMockRecorder ¶ added in v1.9.2
type MockStateMockRecorder struct {
// contains filtered or unexported fields
}
MockStateMockRecorder is the mock recorder for MockState.
func (*MockStateMockRecorder) GetCurrentHeight ¶ added in v1.9.2
func (mr *MockStateMockRecorder) GetCurrentHeight() *gomock.Call
GetCurrentHeight indicates an expected call of GetCurrentHeight.
func (*MockStateMockRecorder) GetMinimumHeight ¶ added in v1.9.2
func (mr *MockStateMockRecorder) GetMinimumHeight() *gomock.Call
GetMinimumHeight indicates an expected call of GetMinimumHeight.
func (*MockStateMockRecorder) GetValidatorSet ¶ added in v1.9.2
func (mr *MockStateMockRecorder) GetValidatorSet(arg0, arg1 interface{}) *gomock.Call
GetValidatorSet indicates an expected call of GetValidatorSet.
type Set ¶
type Set interface { formatting.PrefixedStringer // Set removes all the current validators and adds all the provided // validators to the set. Set([]Validator) error // AddWeight to a staker. AddWeight(ids.NodeID, uint64) error // GetWeight retrieves the validator weight from the set. GetWeight(ids.NodeID) (uint64, bool) // SubsetWeight returns the sum of the weights of the validators. SubsetWeight(ids.NodeIDSet) (uint64, error) // RemoveWeight from a staker. RemoveWeight(ids.NodeID, uint64) error // Contains returns true if there is a validator with the specified ID // currently in the set. Contains(ids.NodeID) bool // Len returns the number of validators currently in the set. Len() int // List all the validators in this group List() []Validator // Weight returns the cumulative weight of all validators in the set. Weight() uint64 // Sample returns a collection of validators, potentially with duplicates. // If sampling the requested size isn't possible, an error will be returned. Sample(size int) ([]Validator, error) // When a validator's weight changes, or a validator is added/removed, // this listener is called. RegisterCallbackListener(SetCallbackListener) }
Set of validators that can be sampled
func NewBestSet ¶ added in v0.8.0
NewBestSet returns a new, empty set of validators.
type SetCallbackListener ¶ added in v1.7.11
type State ¶ added in v1.6.0
type State interface { // GetMinimumHeight returns the minimum height of the block still in the // proposal window. GetMinimumHeight() (uint64, error) // GetCurrentHeight returns the current height of the P-chain. GetCurrentHeight() (uint64, error) // GetValidatorSet returns the weights of the nodeIDs for the provided // subnet at the requested P-chain height. // The returned map should not be modified. GetValidatorSet(height uint64, subnetID ids.ID) (map[ids.NodeID]uint64, error) }
State allows the lookup of validator sets on specified subnets at the requested P-chain height.
func NewNoValidatorsState ¶ added in v1.7.14
type TestState ¶ added in v1.6.0
type TestState struct { T *testing.T CantGetMinimumHeight, CantGetCurrentHeight, CantGetValidatorSet bool GetMinimumHeightF func() (uint64, error) GetCurrentHeightF func() (uint64, error) GetValidatorSetF func(height uint64, subnetID ids.ID) (map[ids.NodeID]uint64, error) }
func (*TestState) GetCurrentHeight ¶ added in v1.6.0
func (*TestState) GetMinimumHeight ¶ added in v1.7.10
type Validator ¶
type Validator interface { // ID returns the node ID of this validator ID() ids.NodeID // Weight that can be used for weighted sampling. If this validator is // validating the primary network, returns the amount of AVAX staked. Weight() uint64 }
Validator is the minimal description of someone that can be sampled.