nodes

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package nodes contains node storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accessor

type Accessor interface {
	All(pulse core.PulseNumber) ([]insolar.Node, error)
	InRole(pulse core.PulseNumber, role core.StaticRole) ([]insolar.Node, error)
}

Accessor provides info about active nodes.

type AccessorMock

type AccessorMock struct {
	AllFunc       func(p core.PulseNumber) (r []insolar.Node, r1 error)
	AllCounter    uint64
	AllPreCounter uint64
	AllMock       mAccessorMockAll

	InRoleFunc       func(p core.PulseNumber, p1 core.StaticRole) (r []insolar.Node, r1 error)
	InRoleCounter    uint64
	InRolePreCounter uint64
	InRoleMock       mAccessorMockInRole
	// contains filtered or unexported fields
}

AccessorMock implements github.com/insolar/insolar/ledger/storage/nodes.Accessor

func NewAccessorMock

func NewAccessorMock(t minimock.Tester) *AccessorMock

NewAccessorMock returns a mock for github.com/insolar/insolar/ledger/storage/nodes.Accessor

func (*AccessorMock) All

func (m *AccessorMock) All(p core.PulseNumber) (r []insolar.Node, r1 error)

All implements github.com/insolar/insolar/ledger/storage/nodes.Accessor interface

func (*AccessorMock) AllFinished

func (m *AccessorMock) AllFinished() bool

AllFinished returns true if mock invocations count is ok

func (*AccessorMock) AllMinimockCounter

func (m *AccessorMock) AllMinimockCounter() uint64

AllMinimockCounter returns a count of AccessorMock.AllFunc invocations

func (*AccessorMock) AllMinimockPreCounter

func (m *AccessorMock) AllMinimockPreCounter() uint64

AllMinimockPreCounter returns the value of AccessorMock.All invocations

func (*AccessorMock) AllMocksCalled

func (m *AccessorMock) AllMocksCalled() bool

AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled, it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())

func (*AccessorMock) CheckMocksCalled

func (m *AccessorMock) CheckMocksCalled()

CheckMocksCalled checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller

func (*AccessorMock) Finish

func (m *AccessorMock) Finish()

Finish checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish or use Finish method of minimock.Controller

func (*AccessorMock) InRole

func (m *AccessorMock) InRole(p core.PulseNumber, p1 core.StaticRole) (r []insolar.Node, r1 error)

InRole implements github.com/insolar/insolar/ledger/storage/nodes.Accessor interface

func (*AccessorMock) InRoleFinished

func (m *AccessorMock) InRoleFinished() bool

InRoleFinished returns true if mock invocations count is ok

func (*AccessorMock) InRoleMinimockCounter

func (m *AccessorMock) InRoleMinimockCounter() uint64

InRoleMinimockCounter returns a count of AccessorMock.InRoleFunc invocations

func (*AccessorMock) InRoleMinimockPreCounter

func (m *AccessorMock) InRoleMinimockPreCounter() uint64

InRoleMinimockPreCounter returns the value of AccessorMock.InRole invocations

func (*AccessorMock) MinimockFinish

func (m *AccessorMock) MinimockFinish()

MinimockFinish checks that all mocked methods of the interface have been called at least once

func (*AccessorMock) MinimockWait

func (m *AccessorMock) MinimockWait(timeout time.Duration)

MinimockWait waits for all mocked methods to be called at least once this method is called by minimock.Controller

func (*AccessorMock) ValidateCallCounters

func (m *AccessorMock) ValidateCallCounters()

ValidateCallCounters checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller

func (*AccessorMock) Wait

func (m *AccessorMock) Wait(timeout time.Duration)

Wait waits for all mocked methods to be called at least once Deprecated: please use MinimockWait or use Wait method of minimock.Controller

type AccessorMockAllExpectation

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

func (*AccessorMockAllExpectation) Return

func (e *AccessorMockAllExpectation) Return(r []insolar.Node, r1 error)

type AccessorMockAllInput

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

type AccessorMockAllResult

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

type AccessorMockInRoleExpectation

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

func (*AccessorMockInRoleExpectation) Return

func (e *AccessorMockInRoleExpectation) Return(r []insolar.Node, r1 error)

type AccessorMockInRoleInput

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

type AccessorMockInRoleResult

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

type Setter

type Setter interface {
	Set(pulse core.PulseNumber, nodes []insolar.Node) error
	Delete(pulse core.PulseNumber)
}

Setter provides methods for setting active nodes.

type SetterMock

type SetterMock struct {
	DeleteFunc       func(p core.PulseNumber)
	DeleteCounter    uint64
	DeletePreCounter uint64
	DeleteMock       mSetterMockDelete

	SetFunc       func(p core.PulseNumber, p1 []insolar.Node) (r error)
	SetCounter    uint64
	SetPreCounter uint64
	SetMock       mSetterMockSet
	// contains filtered or unexported fields
}

SetterMock implements github.com/insolar/insolar/ledger/storage/nodes.Setter

func NewSetterMock

func NewSetterMock(t minimock.Tester) *SetterMock

NewSetterMock returns a mock for github.com/insolar/insolar/ledger/storage/nodes.Setter

func (*SetterMock) AllMocksCalled

func (m *SetterMock) AllMocksCalled() bool

AllMocksCalled returns true if all mocked methods were called before the execution of AllMocksCalled, it can be used with assert/require, i.e. assert.True(mock.AllMocksCalled())

func (*SetterMock) CheckMocksCalled

func (m *SetterMock) CheckMocksCalled()

CheckMocksCalled checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller

func (*SetterMock) Delete

func (m *SetterMock) Delete(p core.PulseNumber)

Delete implements github.com/insolar/insolar/ledger/storage/nodes.Setter interface

func (*SetterMock) DeleteFinished

func (m *SetterMock) DeleteFinished() bool

DeleteFinished returns true if mock invocations count is ok

func (*SetterMock) DeleteMinimockCounter

func (m *SetterMock) DeleteMinimockCounter() uint64

DeleteMinimockCounter returns a count of SetterMock.DeleteFunc invocations

func (*SetterMock) DeleteMinimockPreCounter

func (m *SetterMock) DeleteMinimockPreCounter() uint64

DeleteMinimockPreCounter returns the value of SetterMock.Delete invocations

func (*SetterMock) Finish

func (m *SetterMock) Finish()

Finish checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish or use Finish method of minimock.Controller

func (*SetterMock) MinimockFinish

func (m *SetterMock) MinimockFinish()

MinimockFinish checks that all mocked methods of the interface have been called at least once

func (*SetterMock) MinimockWait

func (m *SetterMock) MinimockWait(timeout time.Duration)

MinimockWait waits for all mocked methods to be called at least once this method is called by minimock.Controller

func (*SetterMock) Set

func (m *SetterMock) Set(p core.PulseNumber, p1 []insolar.Node) (r error)

Set implements github.com/insolar/insolar/ledger/storage/nodes.Setter interface

func (*SetterMock) SetFinished

func (m *SetterMock) SetFinished() bool

SetFinished returns true if mock invocations count is ok

func (*SetterMock) SetMinimockCounter

func (m *SetterMock) SetMinimockCounter() uint64

SetMinimockCounter returns a count of SetterMock.SetFunc invocations

func (*SetterMock) SetMinimockPreCounter

func (m *SetterMock) SetMinimockPreCounter() uint64

SetMinimockPreCounter returns the value of SetterMock.Set invocations

func (*SetterMock) ValidateCallCounters

func (m *SetterMock) ValidateCallCounters()

ValidateCallCounters checks that all mocked methods of the interface have been called at least once Deprecated: please use MinimockFinish method or use Finish method of minimock.Controller

func (*SetterMock) Wait

func (m *SetterMock) Wait(timeout time.Duration)

Wait waits for all mocked methods to be called at least once Deprecated: please use MinimockWait or use Wait method of minimock.Controller

type SetterMockDeleteExpectation

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

type SetterMockDeleteInput

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

type SetterMockSetExpectation

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

func (*SetterMockSetExpectation) Return

func (e *SetterMockSetExpectation) Return(r error)

type SetterMockSetInput

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

type SetterMockSetResult

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

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 NewStorage

func NewStorage() *Storage

NewStorage create new instance of Storage

func (*Storage) All

func (a *Storage) All(pulse core.PulseNumber) ([]insolar.Node, error)

All return active nodes for specified pulse.

func (*Storage) Delete

func (a *Storage) Delete(pulse core.PulseNumber)

Delete erases nodes for specified pulse.

func (*Storage) InRole

func (a *Storage) InRole(pulse core.PulseNumber, role core.StaticRole) ([]insolar.Node, error)

InRole return active nodes for specified pulse and role.

func (*Storage) Set

func (a *Storage) Set(pulse core.PulseNumber, nodes []insolar.Node) error

Set saves active nodes for pulse in memory.

Jump to

Keyboard shortcuts

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