writecontroller

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWriteClosed = errors.New("requested pulse is closed for writing")
)

Functions

This section is empty.

Types

type Accessor

type Accessor interface {
	// Begin requests writing access for pulse number. If requested pulse is closed, ErrWriteClosed will be returned.
	// The caller must call returned "done" function when finished writing.
	Begin(context.Context, insolar.PulseNumber) (done func(), err error)

	// Wait for Open to be called after CloseAndWait
	WaitOpened(ctx context.Context)
}

type AccessorMock

type AccessorMock struct {
	BeginMock mAccessorMockBegin

	WaitOpenedMock mAccessorMockWaitOpened
	// contains filtered or unexported fields
}

AccessorMock implements Accessor

func NewAccessorMock

func NewAccessorMock(t minimock.Tester) *AccessorMock

NewAccessorMock returns a mock for Accessor

func (*AccessorMock) Begin

func (mmBegin *AccessorMock) Begin(ctx context.Context, p1 insolar.PulseNumber) (done func(), err error)

Begin implements Accessor

func (*AccessorMock) BeginAfterCounter

func (mmBegin *AccessorMock) BeginAfterCounter() uint64

BeginAfterCounter returns a count of finished AccessorMock.Begin invocations

func (*AccessorMock) BeginBeforeCounter

func (mmBegin *AccessorMock) BeginBeforeCounter() uint64

BeginBeforeCounter returns a count of AccessorMock.Begin invocations

func (*AccessorMock) MinimockBeginDone

func (m *AccessorMock) MinimockBeginDone() bool

MinimockBeginDone returns true if the count of the Begin invocations corresponds the number of defined expectations

func (*AccessorMock) MinimockBeginInspect

func (m *AccessorMock) MinimockBeginInspect()

MinimockBeginInspect 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) MinimockWait

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

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

func (*AccessorMock) MinimockWaitOpenedDone

func (m *AccessorMock) MinimockWaitOpenedDone() bool

MinimockWaitOpenedDone returns true if the count of the WaitOpened invocations corresponds the number of defined expectations

func (*AccessorMock) MinimockWaitOpenedInspect

func (m *AccessorMock) MinimockWaitOpenedInspect()

MinimockWaitOpenedInspect logs each unmet expectation

func (*AccessorMock) WaitOpened

func (mmWaitOpened *AccessorMock) WaitOpened(ctx context.Context)

WaitOpened implements Accessor

func (*AccessorMock) WaitOpenedAfterCounter

func (mmWaitOpened *AccessorMock) WaitOpenedAfterCounter() uint64

WaitOpenedAfterCounter returns a count of finished AccessorMock.WaitOpened invocations

func (*AccessorMock) WaitOpenedBeforeCounter

func (mmWaitOpened *AccessorMock) WaitOpenedBeforeCounter() uint64

WaitOpenedBeforeCounter returns a count of AccessorMock.WaitOpened invocations

type AccessorMockBeginExpectation

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

AccessorMockBeginExpectation specifies expectation struct of the Accessor.Begin

func (*AccessorMockBeginExpectation) Then

func (e *AccessorMockBeginExpectation) Then(done func(), err error) *AccessorMock

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

type AccessorMockBeginParams

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

AccessorMockBeginParams contains parameters of the Accessor.Begin

type AccessorMockBeginResults

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

AccessorMockBeginResults contains results of the Accessor.Begin

type AccessorMockWaitOpenedExpectation

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

AccessorMockWaitOpenedExpectation specifies expectation struct of the Accessor.WaitOpened

type AccessorMockWaitOpenedParams

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

AccessorMockWaitOpenedParams contains parameters of the Accessor.WaitOpened

type Manager

type Manager interface {
	// Open marks pulse number as opened for writing. It can be used later by Begin from accessor.
	Open(context.Context, insolar.PulseNumber) error
	// CloseAndWait immediately marks pulse number as closed for writing and blocks until all writes are done.
	CloseAndWait(context.Context, insolar.PulseNumber) error
}

type ManagerMock

type ManagerMock struct {
	CloseAndWaitMock mManagerMockCloseAndWait

	OpenMock mManagerMockOpen
	// contains filtered or unexported fields
}

ManagerMock implements Manager

func NewManagerMock

func NewManagerMock(t minimock.Tester) *ManagerMock

NewManagerMock returns a mock for Manager

func (*ManagerMock) CloseAndWait

func (mmCloseAndWait *ManagerMock) CloseAndWait(ctx context.Context, p1 insolar.PulseNumber) (err error)

CloseAndWait implements Manager

func (*ManagerMock) CloseAndWaitAfterCounter

func (mmCloseAndWait *ManagerMock) CloseAndWaitAfterCounter() uint64

CloseAndWaitAfterCounter returns a count of finished ManagerMock.CloseAndWait invocations

func (*ManagerMock) CloseAndWaitBeforeCounter

func (mmCloseAndWait *ManagerMock) CloseAndWaitBeforeCounter() uint64

CloseAndWaitBeforeCounter returns a count of ManagerMock.CloseAndWait invocations

func (*ManagerMock) MinimockCloseAndWaitDone

func (m *ManagerMock) MinimockCloseAndWaitDone() bool

MinimockCloseAndWaitDone returns true if the count of the CloseAndWait invocations corresponds the number of defined expectations

func (*ManagerMock) MinimockCloseAndWaitInspect

func (m *ManagerMock) MinimockCloseAndWaitInspect()

MinimockCloseAndWaitInspect logs each unmet expectation

func (*ManagerMock) MinimockFinish

func (m *ManagerMock) MinimockFinish()

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

func (*ManagerMock) MinimockOpenDone

func (m *ManagerMock) MinimockOpenDone() bool

MinimockOpenDone returns true if the count of the Open invocations corresponds the number of defined expectations

func (*ManagerMock) MinimockOpenInspect

func (m *ManagerMock) MinimockOpenInspect()

MinimockOpenInspect logs each unmet expectation

func (*ManagerMock) MinimockWait

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

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

func (*ManagerMock) Open

func (mmOpen *ManagerMock) Open(ctx context.Context, p1 insolar.PulseNumber) (err error)

Open implements Manager

func (*ManagerMock) OpenAfterCounter

func (mmOpen *ManagerMock) OpenAfterCounter() uint64

OpenAfterCounter returns a count of finished ManagerMock.Open invocations

func (*ManagerMock) OpenBeforeCounter

func (mmOpen *ManagerMock) OpenBeforeCounter() uint64

OpenBeforeCounter returns a count of ManagerMock.Open invocations

type ManagerMockCloseAndWaitExpectation

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

ManagerMockCloseAndWaitExpectation specifies expectation struct of the Manager.CloseAndWait

func (*ManagerMockCloseAndWaitExpectation) Then

Then sets up Manager.CloseAndWait return parameters for the expectation previously defined by the When method

type ManagerMockCloseAndWaitParams

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

ManagerMockCloseAndWaitParams contains parameters of the Manager.CloseAndWait

type ManagerMockCloseAndWaitResults

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

ManagerMockCloseAndWaitResults contains results of the Manager.CloseAndWait

type ManagerMockOpenExpectation

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

ManagerMockOpenExpectation specifies expectation struct of the Manager.Open

func (*ManagerMockOpenExpectation) Then

Then sets up Manager.Open return parameters for the expectation previously defined by the When method

type ManagerMockOpenParams

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

ManagerMockOpenParams contains parameters of the Manager.Open

type ManagerMockOpenResults

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

ManagerMockOpenResults contains results of the Manager.Open

type WriteController

type WriteController interface {
	Begin(ctx context.Context, pulse insolar.PulseNumber) (func(), error)
	Open(ctx context.Context, pulse insolar.PulseNumber) error
	WaitOpened(ctx context.Context)
	CloseAndWait(ctx context.Context, pulse insolar.PulseNumber) error
}

func NewWriteController

func NewWriteController() WriteController

type WriteControllerMock

type WriteControllerMock struct {
	BeginMock mWriteControllerMockBegin

	CloseAndWaitMock mWriteControllerMockCloseAndWait

	OpenMock mWriteControllerMockOpen

	WaitOpenedMock mWriteControllerMockWaitOpened
	// contains filtered or unexported fields
}

WriteControllerMock implements WriteController

func NewWriteControllerMock

func NewWriteControllerMock(t minimock.Tester) *WriteControllerMock

NewWriteControllerMock returns a mock for WriteController

func (*WriteControllerMock) Begin

func (mmBegin *WriteControllerMock) Begin(ctx context.Context, pulse insolar.PulseNumber) (f1 func(), err error)

Begin implements WriteController

func (*WriteControllerMock) BeginAfterCounter

func (mmBegin *WriteControllerMock) BeginAfterCounter() uint64

BeginAfterCounter returns a count of finished WriteControllerMock.Begin invocations

func (*WriteControllerMock) BeginBeforeCounter

func (mmBegin *WriteControllerMock) BeginBeforeCounter() uint64

BeginBeforeCounter returns a count of WriteControllerMock.Begin invocations

func (*WriteControllerMock) CloseAndWait

func (mmCloseAndWait *WriteControllerMock) CloseAndWait(ctx context.Context, pulse insolar.PulseNumber) (err error)

CloseAndWait implements WriteController

func (*WriteControllerMock) CloseAndWaitAfterCounter

func (mmCloseAndWait *WriteControllerMock) CloseAndWaitAfterCounter() uint64

CloseAndWaitAfterCounter returns a count of finished WriteControllerMock.CloseAndWait invocations

func (*WriteControllerMock) CloseAndWaitBeforeCounter

func (mmCloseAndWait *WriteControllerMock) CloseAndWaitBeforeCounter() uint64

CloseAndWaitBeforeCounter returns a count of WriteControllerMock.CloseAndWait invocations

func (*WriteControllerMock) MinimockBeginDone

func (m *WriteControllerMock) MinimockBeginDone() bool

MinimockBeginDone returns true if the count of the Begin invocations corresponds the number of defined expectations

func (*WriteControllerMock) MinimockBeginInspect

func (m *WriteControllerMock) MinimockBeginInspect()

MinimockBeginInspect logs each unmet expectation

func (*WriteControllerMock) MinimockCloseAndWaitDone

func (m *WriteControllerMock) MinimockCloseAndWaitDone() bool

MinimockCloseAndWaitDone returns true if the count of the CloseAndWait invocations corresponds the number of defined expectations

func (*WriteControllerMock) MinimockCloseAndWaitInspect

func (m *WriteControllerMock) MinimockCloseAndWaitInspect()

MinimockCloseAndWaitInspect logs each unmet expectation

func (*WriteControllerMock) MinimockFinish

func (m *WriteControllerMock) MinimockFinish()

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

func (*WriteControllerMock) MinimockOpenDone

func (m *WriteControllerMock) MinimockOpenDone() bool

MinimockOpenDone returns true if the count of the Open invocations corresponds the number of defined expectations

func (*WriteControllerMock) MinimockOpenInspect

func (m *WriteControllerMock) MinimockOpenInspect()

MinimockOpenInspect logs each unmet expectation

func (*WriteControllerMock) MinimockWait

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

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

func (*WriteControllerMock) MinimockWaitOpenedDone

func (m *WriteControllerMock) MinimockWaitOpenedDone() bool

MinimockWaitOpenedDone returns true if the count of the WaitOpened invocations corresponds the number of defined expectations

func (*WriteControllerMock) MinimockWaitOpenedInspect

func (m *WriteControllerMock) MinimockWaitOpenedInspect()

MinimockWaitOpenedInspect logs each unmet expectation

func (*WriteControllerMock) Open

func (mmOpen *WriteControllerMock) Open(ctx context.Context, pulse insolar.PulseNumber) (err error)

Open implements WriteController

func (*WriteControllerMock) OpenAfterCounter

func (mmOpen *WriteControllerMock) OpenAfterCounter() uint64

OpenAfterCounter returns a count of finished WriteControllerMock.Open invocations

func (*WriteControllerMock) OpenBeforeCounter

func (mmOpen *WriteControllerMock) OpenBeforeCounter() uint64

OpenBeforeCounter returns a count of WriteControllerMock.Open invocations

func (*WriteControllerMock) WaitOpened

func (mmWaitOpened *WriteControllerMock) WaitOpened(ctx context.Context)

WaitOpened implements WriteController

func (*WriteControllerMock) WaitOpenedAfterCounter

func (mmWaitOpened *WriteControllerMock) WaitOpenedAfterCounter() uint64

WaitOpenedAfterCounter returns a count of finished WriteControllerMock.WaitOpened invocations

func (*WriteControllerMock) WaitOpenedBeforeCounter

func (mmWaitOpened *WriteControllerMock) WaitOpenedBeforeCounter() uint64

WaitOpenedBeforeCounter returns a count of WriteControllerMock.WaitOpened invocations

type WriteControllerMockBeginExpectation

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

WriteControllerMockBeginExpectation specifies expectation struct of the WriteController.Begin

func (*WriteControllerMockBeginExpectation) Then

Then sets up WriteController.Begin return parameters for the expectation previously defined by the When method

type WriteControllerMockBeginParams

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

WriteControllerMockBeginParams contains parameters of the WriteController.Begin

type WriteControllerMockBeginResults

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

WriteControllerMockBeginResults contains results of the WriteController.Begin

type WriteControllerMockCloseAndWaitExpectation

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

WriteControllerMockCloseAndWaitExpectation specifies expectation struct of the WriteController.CloseAndWait

func (*WriteControllerMockCloseAndWaitExpectation) Then

Then sets up WriteController.CloseAndWait return parameters for the expectation previously defined by the When method

type WriteControllerMockCloseAndWaitParams

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

WriteControllerMockCloseAndWaitParams contains parameters of the WriteController.CloseAndWait

type WriteControllerMockCloseAndWaitResults

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

WriteControllerMockCloseAndWaitResults contains results of the WriteController.CloseAndWait

type WriteControllerMockOpenExpectation

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

WriteControllerMockOpenExpectation specifies expectation struct of the WriteController.Open

func (*WriteControllerMockOpenExpectation) Then

Then sets up WriteController.Open return parameters for the expectation previously defined by the When method

type WriteControllerMockOpenParams

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

WriteControllerMockOpenParams contains parameters of the WriteController.Open

type WriteControllerMockOpenResults

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

WriteControllerMockOpenResults contains results of the WriteController.Open

type WriteControllerMockWaitOpenedExpectation

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

WriteControllerMockWaitOpenedExpectation specifies expectation struct of the WriteController.WaitOpened

type WriteControllerMockWaitOpenedParams

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

WriteControllerMockWaitOpenedParams contains parameters of the WriteController.WaitOpened

Jump to

Keyboard shortcuts

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