drop

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 22 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthDrop = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDrop   = fmt.Errorf("proto: integer overflow")
)
View Source
var (
	// ErrNotFound is returned when value was not found.
	ErrNotFound = errors.New("value not found")

	// ErrOverride is returned if something tries to update existing record.
	ErrOverride = errors.New("records override is forbidden")
)

Functions

func NewStorageMemory

func NewStorageMemory() *dropStorageMemory

NewStorageMemory creates a new storage, that holds data in a memory.

Types

type Accessor

type Accessor interface {
	ForPulse(ctx context.Context, jetID insolar.JetID, pulse insolar.PulseNumber) (Drop, error)
}

Accessor provides an interface for accessing jetdrops.

type AccessorMock

type AccessorMock struct {
	ForPulseMock mAccessorMockForPulse
	// contains filtered or unexported fields
}

AccessorMock implements Accessor

func NewAccessorMock

func NewAccessorMock(t minimock.Tester) *AccessorMock

NewAccessorMock returns a mock for Accessor

func (*AccessorMock) ForPulse

func (mmForPulse *AccessorMock) ForPulse(ctx context.Context, jetID insolar.JetID, pulse insolar.PulseNumber) (d1 Drop, err error)

ForPulse implements Accessor

func (*AccessorMock) ForPulseAfterCounter

func (mmForPulse *AccessorMock) ForPulseAfterCounter() uint64

ForPulseAfterCounter returns a count of finished AccessorMock.ForPulse invocations

func (*AccessorMock) ForPulseBeforeCounter

func (mmForPulse *AccessorMock) ForPulseBeforeCounter() uint64

ForPulseBeforeCounter returns a count of AccessorMock.ForPulse invocations

func (*AccessorMock) MinimockFinish

func (m *AccessorMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*AccessorMock) MinimockForPulseDone

func (m *AccessorMock) MinimockForPulseDone() bool

MinimockForPulseDone returns true if the count of the ForPulse invocations corresponds the number of defined expectations

func (*AccessorMock) MinimockForPulseInspect

func (m *AccessorMock) MinimockForPulseInspect()

MinimockForPulseInspect 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 AccessorMockForPulseExpectation

type AccessorMockForPulseExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

AccessorMockForPulseExpectation specifies expectation struct of the Accessor.ForPulse

func (*AccessorMockForPulseExpectation) Then

Then sets up Accessor.ForPulse return parameters for the expectation previously defined by the When method

type AccessorMockForPulseParams

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

AccessorMockForPulseParams contains parameters of the Accessor.ForPulse

type AccessorMockForPulseResults

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

AccessorMockForPulseResults contains results of the Accessor.ForPulse

type Cleaner

type Cleaner interface {
	DeleteForPN(ctx context.Context, pulse insolar.PulseNumber)
}

Cleaner provides an interface for removing jetdrops from a storage.

type CleanerMock

type CleanerMock struct {
	DeleteForPNMock mCleanerMockDeleteForPN
	// contains filtered or unexported fields
}

CleanerMock implements Cleaner

func NewCleanerMock

func NewCleanerMock(t minimock.Tester) *CleanerMock

NewCleanerMock returns a mock for Cleaner

func (*CleanerMock) DeleteForPN

func (mmDeleteForPN *CleanerMock) DeleteForPN(ctx context.Context, pulse insolar.PulseNumber)

DeleteForPN implements Cleaner

func (*CleanerMock) DeleteForPNAfterCounter

func (mmDeleteForPN *CleanerMock) DeleteForPNAfterCounter() uint64

DeleteForPNAfterCounter returns a count of finished CleanerMock.DeleteForPN invocations

func (*CleanerMock) DeleteForPNBeforeCounter

func (mmDeleteForPN *CleanerMock) DeleteForPNBeforeCounter() uint64

DeleteForPNBeforeCounter returns a count of CleanerMock.DeleteForPN invocations

func (*CleanerMock) MinimockDeleteForPNDone

func (m *CleanerMock) MinimockDeleteForPNDone() bool

MinimockDeleteForPNDone returns true if the count of the DeleteForPN invocations corresponds the number of defined expectations

func (*CleanerMock) MinimockDeleteForPNInspect

func (m *CleanerMock) MinimockDeleteForPNInspect()

MinimockDeleteForPNInspect logs each unmet expectation

func (*CleanerMock) MinimockFinish

func (m *CleanerMock) MinimockFinish()

MinimockFinish checks that all mocked methods have been called the expected number of times

func (*CleanerMock) MinimockWait

func (m *CleanerMock) MinimockWait(timeout mm_time.Duration)

MinimockWait waits for all mocked methods to be called the expected number of times

type CleanerMockDeleteForPNExpectation

type CleanerMockDeleteForPNExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

CleanerMockDeleteForPNExpectation specifies expectation struct of the Cleaner.DeleteForPN

type CleanerMockDeleteForPNParams

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

CleanerMockDeleteForPNParams contains parameters of the Cleaner.DeleteForPN

type DB

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

func NewDB

func NewDB(db store.DB) *DB

NewDB creates a new storage, that holds data in a db.

func (*DB) ForPulse

func (ds *DB) ForPulse(ctx context.Context, jetID insolar.JetID, pulse insolar.PulseNumber) (Drop, error)

ForPulse returns a Drop for a provided pulse, that is stored in a db.

func (*DB) Set

func (ds *DB) Set(ctx context.Context, drop Drop) error

Set saves a provided Drop to a db.

func (*DB) TruncateHead

func (ds *DB) TruncateHead(ctx context.Context, from insolar.PulseNumber) error

TruncateHead remove all records after lastPulse

type Drop

type Drop struct {
	Polymorph              int32                                          `protobuf:"varint,16,opt,name=polymorph,proto3" json:"polymorph,omitempty"`
	Pulse                  github_com_insolar_insolar_insolar.PulseNumber `protobuf:"bytes,20,opt,name=Pulse,proto3,customtype=github.com/insolar/insolar/insolar.PulseNumber" json:"Pulse"`
	JetID                  github_com_insolar_insolar_insolar.JetID       `protobuf:"bytes,21,opt,name=JetID,proto3,customtype=github.com/insolar/insolar/insolar.JetID" json:"JetID"`
	SplitThresholdExceeded int64                                          `protobuf:"varint,22,opt,name=SplitThresholdExceeded,proto3" json:"SplitThresholdExceeded,omitempty"`
	Split                  bool                                           `protobuf:"varint,23,opt,name=Split,proto3" json:"Split,omitempty"`
}

func (*Drop) Descriptor

func (*Drop) Descriptor() ([]byte, []int)

func (*Drop) Equal

func (this *Drop) Equal(that interface{}) bool

func (*Drop) GoString

func (this *Drop) GoString() string

func (*Drop) Marshal

func (m *Drop) Marshal() (dAtA []byte, err error)

func (*Drop) MarshalTo

func (m *Drop) MarshalTo(dAtA []byte) (int, error)

func (*Drop) ProtoMessage

func (*Drop) ProtoMessage()

func (*Drop) Reset

func (m *Drop) Reset()

func (*Drop) Size

func (m *Drop) Size() (n int)

func (*Drop) String

func (this *Drop) String() string

func (*Drop) Unmarshal

func (m *Drop) Unmarshal(dAtA []byte) error

func (*Drop) XXX_DiscardUnknown

func (m *Drop) XXX_DiscardUnknown()

func (*Drop) XXX_Marshal

func (m *Drop) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Drop) XXX_Merge

func (m *Drop) XXX_Merge(src proto.Message)

func (*Drop) XXX_Size

func (m *Drop) XXX_Size() int

func (*Drop) XXX_Unmarshal

func (m *Drop) XXX_Unmarshal(b []byte) error

type Modifier

type Modifier interface {
	Set(ctx context.Context, drop Drop) error
}

Modifier provides an interface for modifying jetdrops.

type ModifierMock

type ModifierMock struct {
	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) 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(ctx context.Context, drop Drop) (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 ModifierMockSetExpectation

type ModifierMockSetExpectation struct {
	Counter uint64
	// contains filtered or unexported fields
}

ModifierMockSetExpectation specifies expectation struct of the Modifier.Set

func (*ModifierMockSetExpectation) Then

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

Jump to

Keyboard shortcuts

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