Documentation ¶
Overview ¶
Package node contains node storage
Index ¶
- Variables
- type Accessor
- type AccessorMock
- func (mmAll *AccessorMock) All(pulse insolar.PulseNumber) (na1 []insolar.Node, err error)
- func (mmAll *AccessorMock) AllAfterCounter() uint64
- func (mmAll *AccessorMock) AllBeforeCounter() uint64
- func (mmInRole *AccessorMock) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) (na1 []insolar.Node, err error)
- func (mmInRole *AccessorMock) InRoleAfterCounter() uint64
- func (mmInRole *AccessorMock) InRoleBeforeCounter() uint64
- func (m *AccessorMock) MinimockAllDone() bool
- func (m *AccessorMock) MinimockAllInspect()
- func (m *AccessorMock) MinimockFinish()
- func (m *AccessorMock) MinimockInRoleDone() bool
- func (m *AccessorMock) MinimockInRoleInspect()
- func (m *AccessorMock) MinimockWait(timeout mm_time.Duration)
- type AccessorMockAllExpectation
- type AccessorMockAllParams
- type AccessorMockAllResults
- type AccessorMockInRoleExpectation
- type AccessorMockInRoleParams
- type AccessorMockInRoleResults
- type Modifier
- type ModifierMock
- func (mmDeleteForPN *ModifierMock) DeleteForPN(pulse insolar.PulseNumber)
- func (mmDeleteForPN *ModifierMock) DeleteForPNAfterCounter() uint64
- func (mmDeleteForPN *ModifierMock) DeleteForPNBeforeCounter() uint64
- func (m *ModifierMock) MinimockDeleteForPNDone() bool
- func (m *ModifierMock) MinimockDeleteForPNInspect()
- func (m *ModifierMock) MinimockFinish()
- func (m *ModifierMock) MinimockSetDone() bool
- func (m *ModifierMock) MinimockSetInspect()
- func (m *ModifierMock) MinimockWait(timeout mm_time.Duration)
- func (mmSet *ModifierMock) Set(pulse insolar.PulseNumber, nodes []insolar.Node) (err error)
- func (mmSet *ModifierMock) SetAfterCounter() uint64
- func (mmSet *ModifierMock) SetBeforeCounter() uint64
- type ModifierMockDeleteForPNExpectation
- type ModifierMockDeleteForPNParams
- type ModifierMockSetExpectation
- type ModifierMockSetParams
- type ModifierMockSetResults
- type Storage
- func (a *Storage) All(pulse insolar.PulseNumber) ([]insolar.Node, error)
- func (a *Storage) DeleteForPN(pulse insolar.PulseNumber)
- func (a *Storage) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) ([]insolar.Node, error)
- func (a *Storage) Set(pulse insolar.PulseNumber, nodes []insolar.Node) error
- type StorageDB
- func (s *StorageDB) All(pulse insolar.PulseNumber) ([]insolar.Node, error)
- func (s *StorageDB) DeleteForPN(pulse insolar.PulseNumber)
- func (s *StorageDB) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) ([]insolar.Node, error)
- func (s *StorageDB) Set(pulse insolar.PulseNumber, nodes []insolar.Node) error
- func (s *StorageDB) TruncateHead(ctx context.Context, from insolar.PulseNumber) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOverride is returned when trying to set nodes for non-empty pulse. ErrOverride = errors.New("node override is forbidden") // ErrNoNodes is returned when nodes for specified criteria could not be found. ErrNoNodes = errors.New("matching nodes not found") )
Functions ¶
This section is empty.
Types ¶
type Accessor ¶
type Accessor interface { All(pulse insolar.PulseNumber) ([]insolar.Node, error) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) ([]insolar.Node, error) }
Accessor provides info about active nodes.
type AccessorMock ¶
type AccessorMock struct { AllMock mAccessorMockAll InRoleMock mAccessorMockInRole // contains filtered or unexported fields }
AccessorMock implements Accessor
func NewAccessorMock ¶
func NewAccessorMock(t minimock.Tester) *AccessorMock
NewAccessorMock returns a mock for Accessor
func (*AccessorMock) All ¶
func (mmAll *AccessorMock) All(pulse insolar.PulseNumber) (na1 []insolar.Node, err error)
All implements Accessor
func (*AccessorMock) AllAfterCounter ¶
func (mmAll *AccessorMock) AllAfterCounter() uint64
AllAfterCounter returns a count of finished AccessorMock.All invocations
func (*AccessorMock) AllBeforeCounter ¶
func (mmAll *AccessorMock) AllBeforeCounter() uint64
AllBeforeCounter returns a count of AccessorMock.All invocations
func (*AccessorMock) InRole ¶
func (mmInRole *AccessorMock) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) (na1 []insolar.Node, err error)
InRole implements Accessor
func (*AccessorMock) InRoleAfterCounter ¶
func (mmInRole *AccessorMock) InRoleAfterCounter() uint64
InRoleAfterCounter returns a count of finished AccessorMock.InRole invocations
func (*AccessorMock) InRoleBeforeCounter ¶
func (mmInRole *AccessorMock) InRoleBeforeCounter() uint64
InRoleBeforeCounter returns a count of AccessorMock.InRole invocations
func (*AccessorMock) MinimockAllDone ¶
func (m *AccessorMock) MinimockAllDone() bool
MinimockAllDone returns true if the count of the All invocations corresponds the number of defined expectations
func (*AccessorMock) MinimockAllInspect ¶
func (m *AccessorMock) MinimockAllInspect()
MinimockAllInspect logs each unmet expectation
func (*AccessorMock) MinimockFinish ¶
func (m *AccessorMock) MinimockFinish()
MinimockFinish checks that all mocked methods have been called the expected number of times
func (*AccessorMock) MinimockInRoleDone ¶
func (m *AccessorMock) MinimockInRoleDone() bool
MinimockInRoleDone returns true if the count of the InRole invocations corresponds the number of defined expectations
func (*AccessorMock) MinimockInRoleInspect ¶
func (m *AccessorMock) MinimockInRoleInspect()
MinimockInRoleInspect logs each unmet expectation
func (*AccessorMock) MinimockWait ¶
func (m *AccessorMock) MinimockWait(timeout mm_time.Duration)
MinimockWait waits for all mocked methods to be called the expected number of times
type AccessorMockAllExpectation ¶
type AccessorMockAllExpectation struct { Counter uint64 // contains filtered or unexported fields }
AccessorMockAllExpectation specifies expectation struct of the Accessor.All
func (*AccessorMockAllExpectation) Then ¶
func (e *AccessorMockAllExpectation) Then(na1 []insolar.Node, err error) *AccessorMock
Then sets up Accessor.All return parameters for the expectation previously defined by the When method
type AccessorMockAllParams ¶
type AccessorMockAllParams struct {
// contains filtered or unexported fields
}
AccessorMockAllParams contains parameters of the Accessor.All
type AccessorMockAllResults ¶
type AccessorMockAllResults struct {
// contains filtered or unexported fields
}
AccessorMockAllResults contains results of the Accessor.All
type AccessorMockInRoleExpectation ¶
type AccessorMockInRoleExpectation struct { Counter uint64 // contains filtered or unexported fields }
AccessorMockInRoleExpectation specifies expectation struct of the Accessor.InRole
func (*AccessorMockInRoleExpectation) Then ¶
func (e *AccessorMockInRoleExpectation) Then(na1 []insolar.Node, err error) *AccessorMock
Then sets up Accessor.InRole return parameters for the expectation previously defined by the When method
type AccessorMockInRoleParams ¶
type AccessorMockInRoleParams struct {
// contains filtered or unexported fields
}
AccessorMockInRoleParams contains parameters of the Accessor.InRole
type AccessorMockInRoleResults ¶
type AccessorMockInRoleResults struct {
// contains filtered or unexported fields
}
AccessorMockInRoleResults contains results of the Accessor.InRole
type Modifier ¶
type Modifier interface { Set(pulse insolar.PulseNumber, nodes []insolar.Node) error DeleteForPN(pulse insolar.PulseNumber) }
Modifier provides methods for setting active nodes.
type ModifierMock ¶
type ModifierMock struct { DeleteForPNMock mModifierMockDeleteForPN SetMock mModifierMockSet // contains filtered or unexported fields }
ModifierMock implements Modifier
func NewModifierMock ¶
func NewModifierMock(t minimock.Tester) *ModifierMock
NewModifierMock returns a mock for Modifier
func (*ModifierMock) DeleteForPN ¶
func (mmDeleteForPN *ModifierMock) DeleteForPN(pulse insolar.PulseNumber)
DeleteForPN implements Modifier
func (*ModifierMock) DeleteForPNAfterCounter ¶
func (mmDeleteForPN *ModifierMock) DeleteForPNAfterCounter() uint64
DeleteForPNAfterCounter returns a count of finished ModifierMock.DeleteForPN invocations
func (*ModifierMock) DeleteForPNBeforeCounter ¶
func (mmDeleteForPN *ModifierMock) DeleteForPNBeforeCounter() uint64
DeleteForPNBeforeCounter returns a count of ModifierMock.DeleteForPN invocations
func (*ModifierMock) MinimockDeleteForPNDone ¶
func (m *ModifierMock) MinimockDeleteForPNDone() bool
MinimockDeleteForPNDone returns true if the count of the DeleteForPN invocations corresponds the number of defined expectations
func (*ModifierMock) MinimockDeleteForPNInspect ¶
func (m *ModifierMock) MinimockDeleteForPNInspect()
MinimockDeleteForPNInspect logs each unmet expectation
func (*ModifierMock) MinimockFinish ¶
func (m *ModifierMock) MinimockFinish()
MinimockFinish checks that all mocked methods have been called the expected number of times
func (*ModifierMock) MinimockSetDone ¶
func (m *ModifierMock) MinimockSetDone() bool
MinimockSetDone returns true if the count of the Set invocations corresponds the number of defined expectations
func (*ModifierMock) MinimockSetInspect ¶
func (m *ModifierMock) MinimockSetInspect()
MinimockSetInspect logs each unmet expectation
func (*ModifierMock) MinimockWait ¶
func (m *ModifierMock) MinimockWait(timeout mm_time.Duration)
MinimockWait waits for all mocked methods to be called the expected number of times
func (*ModifierMock) Set ¶
func (mmSet *ModifierMock) Set(pulse insolar.PulseNumber, nodes []insolar.Node) (err error)
Set implements Modifier
func (*ModifierMock) SetAfterCounter ¶
func (mmSet *ModifierMock) SetAfterCounter() uint64
SetAfterCounter returns a count of finished ModifierMock.Set invocations
func (*ModifierMock) SetBeforeCounter ¶
func (mmSet *ModifierMock) SetBeforeCounter() uint64
SetBeforeCounter returns a count of ModifierMock.Set invocations
type ModifierMockDeleteForPNExpectation ¶
type ModifierMockDeleteForPNExpectation struct { Counter uint64 // contains filtered or unexported fields }
ModifierMockDeleteForPNExpectation specifies expectation struct of the Modifier.DeleteForPN
type ModifierMockDeleteForPNParams ¶
type ModifierMockDeleteForPNParams struct {
// contains filtered or unexported fields
}
ModifierMockDeleteForPNParams contains parameters of the Modifier.DeleteForPN
type ModifierMockSetExpectation ¶
type ModifierMockSetExpectation struct { Counter uint64 // contains filtered or unexported fields }
ModifierMockSetExpectation specifies expectation struct of the Modifier.Set
func (*ModifierMockSetExpectation) Then ¶
func (e *ModifierMockSetExpectation) Then(err error) *ModifierMock
Then sets up Modifier.Set return parameters for the expectation previously defined by the When method
type ModifierMockSetParams ¶
type ModifierMockSetParams struct {
// contains filtered or unexported fields
}
ModifierMockSetParams contains parameters of the Modifier.Set
type ModifierMockSetResults ¶
type ModifierMockSetResults struct {
// contains filtered or unexported fields
}
ModifierMockSetResults contains results of the Modifier.Set
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is an in-memory active node storage for each pulse. It's required to calculate node roles for past pulses to locate data. It should only contain previous N pulses. It should be stored on disk.
func (*Storage) DeleteForPN ¶
func (a *Storage) DeleteForPN(pulse insolar.PulseNumber)
DeleteForPN erases nodes for specified pulse.
func (*Storage) InRole ¶
func (a *Storage) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) ([]insolar.Node, error)
InRole return active nodes for specified pulse and role.
type StorageDB ¶ added in v0.9.5
type StorageDB struct {
// contains filtered or unexported fields
}
StorageDB is a badger-based impl of a node storage.
func NewStorageDB ¶ added in v0.9.5
NewStorageDB create new instance of StorageDB.
func (*StorageDB) DeleteForPN ¶ added in v0.9.5
func (s *StorageDB) DeleteForPN(pulse insolar.PulseNumber)
DeleteForPN erases nodes for specified pulse.
func (*StorageDB) InRole ¶ added in v0.9.5
func (s *StorageDB) InRole(pulse insolar.PulseNumber, role insolar.StaticRole) ([]insolar.Node, error)
InRole return active nodes for specified pulse and role.
func (*StorageDB) TruncateHead ¶ added in v0.9.7
TruncateHead remove all records after lastPulse