bundle

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryEntry

type DirectoryEntry struct {
	Key reference.Global
	Loc ledger.StorageLocator
	// Fil is a temporary field and it is not preserved
	Fil FilamentInfo
}

func (DirectoryEntry) IsZero

func (v DirectoryEntry) IsZero() bool

type DirectorySection

type DirectorySection interface {
	// GetNextDirectoryIndex provides an index for the next to-be-added directory entry.
	GetNextDirectoryIndex() ledger.DirectoryIndex
	// AppendDirectoryEntry adds a new item to the directory at the given index.
	AppendDirectoryEntry(index ledger.DirectoryIndex, entry DirectoryEntry) error

	// AllocateEntryStorage MUST be called as the last per record and MUST guarantee that the allocated storage is
	// located after any other data of the same record within the same section.
	AllocateEntryStorage(size int) (PayloadReceptacle, ledger.StorageLocator, error)
}

type DirectorySectionMock

type DirectorySectionMock struct {
	AllocateEntryStorageMock mDirectorySectionMockAllocateEntryStorage

	AppendDirectoryEntryMock mDirectorySectionMockAppendDirectoryEntry

	GetNextDirectoryIndexMock mDirectorySectionMockGetNextDirectoryIndex
	// contains filtered or unexported fields
}

DirectorySectionMock implements DirectorySection

func NewDirectorySectionMock

func NewDirectorySectionMock(t minimock.Tester) *DirectorySectionMock

NewDirectorySectionMock returns a mock for DirectorySection

func (*DirectorySectionMock) AllocateEntryStorage

func (mmAllocateEntryStorage *DirectorySectionMock) AllocateEntryStorage(size int) (p1 PayloadReceptacle, s1 ledger.StorageLocator, err error)

AllocateEntryStorage implements DirectorySection

func (*DirectorySectionMock) AllocateEntryStorageAfterCounter

func (mmAllocateEntryStorage *DirectorySectionMock) AllocateEntryStorageAfterCounter() uint64

AllocateEntryStorageAfterCounter returns a count of finished DirectorySectionMock.AllocateEntryStorage invocations

func (*DirectorySectionMock) AllocateEntryStorageBeforeCounter

func (mmAllocateEntryStorage *DirectorySectionMock) AllocateEntryStorageBeforeCounter() uint64

AllocateEntryStorageBeforeCounter returns a count of DirectorySectionMock.AllocateEntryStorage invocations

func (*DirectorySectionMock) AppendDirectoryEntry

func (mmAppendDirectoryEntry *DirectorySectionMock) AppendDirectoryEntry(index ledger.DirectoryIndex, entry DirectoryEntry) (err error)

AppendDirectoryEntry implements DirectorySection

func (*DirectorySectionMock) AppendDirectoryEntryAfterCounter

func (mmAppendDirectoryEntry *DirectorySectionMock) AppendDirectoryEntryAfterCounter() uint64

AppendDirectoryEntryAfterCounter returns a count of finished DirectorySectionMock.AppendDirectoryEntry invocations

func (*DirectorySectionMock) AppendDirectoryEntryBeforeCounter

func (mmAppendDirectoryEntry *DirectorySectionMock) AppendDirectoryEntryBeforeCounter() uint64

AppendDirectoryEntryBeforeCounter returns a count of DirectorySectionMock.AppendDirectoryEntry invocations

func (*DirectorySectionMock) GetNextDirectoryIndex

func (mmGetNextDirectoryIndex *DirectorySectionMock) GetNextDirectoryIndex() (d1 ledger.DirectoryIndex)

GetNextDirectoryIndex implements DirectorySection

func (*DirectorySectionMock) GetNextDirectoryIndexAfterCounter

func (mmGetNextDirectoryIndex *DirectorySectionMock) GetNextDirectoryIndexAfterCounter() uint64

GetNextDirectoryIndexAfterCounter returns a count of finished DirectorySectionMock.GetNextDirectoryIndex invocations

func (*DirectorySectionMock) GetNextDirectoryIndexBeforeCounter

func (mmGetNextDirectoryIndex *DirectorySectionMock) GetNextDirectoryIndexBeforeCounter() uint64

GetNextDirectoryIndexBeforeCounter returns a count of DirectorySectionMock.GetNextDirectoryIndex invocations

func (*DirectorySectionMock) MinimockAllocateEntryStorageDone

func (m *DirectorySectionMock) MinimockAllocateEntryStorageDone() bool

MinimockAllocateEntryStorageDone returns true if the count of the AllocateEntryStorage invocations corresponds the number of defined expectations

func (*DirectorySectionMock) MinimockAllocateEntryStorageInspect

func (m *DirectorySectionMock) MinimockAllocateEntryStorageInspect()

MinimockAllocateEntryStorageInspect logs each unmet expectation

func (*DirectorySectionMock) MinimockAppendDirectoryEntryDone

func (m *DirectorySectionMock) MinimockAppendDirectoryEntryDone() bool

MinimockAppendDirectoryEntryDone returns true if the count of the AppendDirectoryEntry invocations corresponds the number of defined expectations

func (*DirectorySectionMock) MinimockAppendDirectoryEntryInspect

func (m *DirectorySectionMock) MinimockAppendDirectoryEntryInspect()

MinimockAppendDirectoryEntryInspect logs each unmet expectation

func (*DirectorySectionMock) MinimockFinish

func (m *DirectorySectionMock) MinimockFinish()

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

func (*DirectorySectionMock) MinimockGetNextDirectoryIndexDone

func (m *DirectorySectionMock) MinimockGetNextDirectoryIndexDone() bool

MinimockGetNextDirectoryIndexDone returns true if the count of the GetNextDirectoryIndex invocations corresponds the number of defined expectations

func (*DirectorySectionMock) MinimockGetNextDirectoryIndexInspect

func (m *DirectorySectionMock) MinimockGetNextDirectoryIndexInspect()

MinimockGetNextDirectoryIndexInspect logs each unmet expectation

func (*DirectorySectionMock) MinimockWait

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

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

type DirectorySectionMockAllocateEntryStorageExpectation

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

DirectorySectionMockAllocateEntryStorageExpectation specifies expectation struct of the DirectorySection.AllocateEntryStorage

func (*DirectorySectionMockAllocateEntryStorageExpectation) Then

Then sets up DirectorySection.AllocateEntryStorage return parameters for the expectation previously defined by the When method

type DirectorySectionMockAllocateEntryStorageParams

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

DirectorySectionMockAllocateEntryStorageParams contains parameters of the DirectorySection.AllocateEntryStorage

type DirectorySectionMockAllocateEntryStorageResults

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

DirectorySectionMockAllocateEntryStorageResults contains results of the DirectorySection.AllocateEntryStorage

type DirectorySectionMockAppendDirectoryEntryExpectation

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

DirectorySectionMockAppendDirectoryEntryExpectation specifies expectation struct of the DirectorySection.AppendDirectoryEntry

func (*DirectorySectionMockAppendDirectoryEntryExpectation) Then

Then sets up DirectorySection.AppendDirectoryEntry return parameters for the expectation previously defined by the When method

type DirectorySectionMockAppendDirectoryEntryParams

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

DirectorySectionMockAppendDirectoryEntryParams contains parameters of the DirectorySection.AppendDirectoryEntry

type DirectorySectionMockAppendDirectoryEntryResults

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

DirectorySectionMockAppendDirectoryEntryResults contains results of the DirectorySection.AppendDirectoryEntry

type DirectorySectionMockGetNextDirectoryIndexExpectation

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

DirectorySectionMockGetNextDirectoryIndexExpectation specifies expectation struct of the DirectorySection.GetNextDirectoryIndex

type DirectorySectionMockGetNextDirectoryIndexResults

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

DirectorySectionMockGetNextDirectoryIndexResults contains results of the DirectorySection.GetNextDirectoryIndex

type DirtyReader

type DirtyReader interface {
	readbundle.BasicReader

	// GetDirectoryEntry returns key and entry's locator for the given index. Invalid index will return (nil, 0)
	// RACE! Caller MUST ensure that the data to be read was fully written.
	GetDirectoryEntry(ledger.DirectoryIndex) DirectoryEntry
	// GetDirectoryEntries returns all known entries.
	// RACE! Caller MUST ensure that the data to be read was fully written.
	// WARNING! Caller MUST NOT change the slices.
	GetDirectoryEntries(ledger.SectionID) [][]DirectoryEntry
}

DirtyReader provides dirty read access to SnapshotWriter. Use with EXTREME caution. RACE! Caller MUST ensure that the data to be read was fully written. WARNING! Caller MUST NOT change the byte slice.

type FilamentInfo

type FilamentInfo struct {
	Link  ledger.Ordinal
	JetID jet.ID
	Flags ledger.DirectoryEntryFlags
}

type MarshalerTo

type MarshalerTo interface {
	// optional io.WriterTo
	ProtoSize() int
	MarshalTo([]byte) (int, error)
}

MarshalerTo is interface to write data into storage Implementation may also use io.WriterTo behavior.

type PayloadReceptacle

type PayloadReceptacle interface {
	io.WriterTo
	ApplyMarshalTo(MarshalerTo) error
	ApplyFixedReader(longbits.FixedReader) error
}

type PayloadReceptacleMock

type PayloadReceptacleMock struct {
	ApplyFixedReaderMock mPayloadReceptacleMockApplyFixedReader

	ApplyMarshalToMock mPayloadReceptacleMockApplyMarshalTo

	WriteToMock mPayloadReceptacleMockWriteTo
	// contains filtered or unexported fields
}

PayloadReceptacleMock implements PayloadReceptacle

func NewPayloadReceptacleMock

func NewPayloadReceptacleMock(t minimock.Tester) *PayloadReceptacleMock

NewPayloadReceptacleMock returns a mock for PayloadReceptacle

func (*PayloadReceptacleMock) ApplyFixedReader

func (mmApplyFixedReader *PayloadReceptacleMock) ApplyFixedReader(f1 longbits.FixedReader) (err error)

ApplyFixedReader implements PayloadReceptacle

func (*PayloadReceptacleMock) ApplyFixedReaderAfterCounter

func (mmApplyFixedReader *PayloadReceptacleMock) ApplyFixedReaderAfterCounter() uint64

ApplyFixedReaderAfterCounter returns a count of finished PayloadReceptacleMock.ApplyFixedReader invocations

func (*PayloadReceptacleMock) ApplyFixedReaderBeforeCounter

func (mmApplyFixedReader *PayloadReceptacleMock) ApplyFixedReaderBeforeCounter() uint64

ApplyFixedReaderBeforeCounter returns a count of PayloadReceptacleMock.ApplyFixedReader invocations

func (*PayloadReceptacleMock) ApplyMarshalTo

func (mmApplyMarshalTo *PayloadReceptacleMock) ApplyMarshalTo(m1 MarshalerTo) (err error)

ApplyMarshalTo implements PayloadReceptacle

func (*PayloadReceptacleMock) ApplyMarshalToAfterCounter

func (mmApplyMarshalTo *PayloadReceptacleMock) ApplyMarshalToAfterCounter() uint64

ApplyMarshalToAfterCounter returns a count of finished PayloadReceptacleMock.ApplyMarshalTo invocations

func (*PayloadReceptacleMock) ApplyMarshalToBeforeCounter

func (mmApplyMarshalTo *PayloadReceptacleMock) ApplyMarshalToBeforeCounter() uint64

ApplyMarshalToBeforeCounter returns a count of PayloadReceptacleMock.ApplyMarshalTo invocations

func (*PayloadReceptacleMock) MinimockApplyFixedReaderDone

func (m *PayloadReceptacleMock) MinimockApplyFixedReaderDone() bool

MinimockApplyFixedReaderDone returns true if the count of the ApplyFixedReader invocations corresponds the number of defined expectations

func (*PayloadReceptacleMock) MinimockApplyFixedReaderInspect

func (m *PayloadReceptacleMock) MinimockApplyFixedReaderInspect()

MinimockApplyFixedReaderInspect logs each unmet expectation

func (*PayloadReceptacleMock) MinimockApplyMarshalToDone

func (m *PayloadReceptacleMock) MinimockApplyMarshalToDone() bool

MinimockApplyMarshalToDone returns true if the count of the ApplyMarshalTo invocations corresponds the number of defined expectations

func (*PayloadReceptacleMock) MinimockApplyMarshalToInspect

func (m *PayloadReceptacleMock) MinimockApplyMarshalToInspect()

MinimockApplyMarshalToInspect logs each unmet expectation

func (*PayloadReceptacleMock) MinimockFinish

func (m *PayloadReceptacleMock) MinimockFinish()

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

func (*PayloadReceptacleMock) MinimockWait

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

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

func (*PayloadReceptacleMock) MinimockWriteToDone

func (m *PayloadReceptacleMock) MinimockWriteToDone() bool

MinimockWriteToDone returns true if the count of the WriteTo invocations corresponds the number of defined expectations

func (*PayloadReceptacleMock) MinimockWriteToInspect

func (m *PayloadReceptacleMock) MinimockWriteToInspect()

MinimockWriteToInspect logs each unmet expectation

func (*PayloadReceptacleMock) WriteTo

func (mmWriteTo *PayloadReceptacleMock) WriteTo(w io.Writer) (n int64, err error)

WriteTo implements PayloadReceptacle

func (*PayloadReceptacleMock) WriteToAfterCounter

func (mmWriteTo *PayloadReceptacleMock) WriteToAfterCounter() uint64

WriteToAfterCounter returns a count of finished PayloadReceptacleMock.WriteTo invocations

func (*PayloadReceptacleMock) WriteToBeforeCounter

func (mmWriteTo *PayloadReceptacleMock) WriteToBeforeCounter() uint64

WriteToBeforeCounter returns a count of PayloadReceptacleMock.WriteTo invocations

type PayloadReceptacleMockApplyFixedReaderExpectation

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

PayloadReceptacleMockApplyFixedReaderExpectation specifies expectation struct of the PayloadReceptacle.ApplyFixedReader

func (*PayloadReceptacleMockApplyFixedReaderExpectation) Then

Then sets up PayloadReceptacle.ApplyFixedReader return parameters for the expectation previously defined by the When method

type PayloadReceptacleMockApplyFixedReaderParams

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

PayloadReceptacleMockApplyFixedReaderParams contains parameters of the PayloadReceptacle.ApplyFixedReader

type PayloadReceptacleMockApplyFixedReaderResults

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

PayloadReceptacleMockApplyFixedReaderResults contains results of the PayloadReceptacle.ApplyFixedReader

type PayloadReceptacleMockApplyMarshalToExpectation

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

PayloadReceptacleMockApplyMarshalToExpectation specifies expectation struct of the PayloadReceptacle.ApplyMarshalTo

func (*PayloadReceptacleMockApplyMarshalToExpectation) Then

Then sets up PayloadReceptacle.ApplyMarshalTo return parameters for the expectation previously defined by the When method

type PayloadReceptacleMockApplyMarshalToParams

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

PayloadReceptacleMockApplyMarshalToParams contains parameters of the PayloadReceptacle.ApplyMarshalTo

type PayloadReceptacleMockApplyMarshalToResults

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

PayloadReceptacleMockApplyMarshalToResults contains results of the PayloadReceptacle.ApplyMarshalTo

type PayloadReceptacleMockWriteToExpectation

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

PayloadReceptacleMockWriteToExpectation specifies expectation struct of the PayloadReceptacle.WriteTo

func (*PayloadReceptacleMockWriteToExpectation) Then

Then sets up PayloadReceptacle.WriteTo return parameters for the expectation previously defined by the When method

type PayloadReceptacleMockWriteToParams

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

PayloadReceptacleMockWriteToParams contains parameters of the PayloadReceptacle.WriteTo

type PayloadReceptacleMockWriteToResults

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

PayloadReceptacleMockWriteToResults contains results of the PayloadReceptacle.WriteTo

type PayloadSection

type PayloadSection interface {
	// AllocatePayloadStorage is called to allocate a storage area for any payload of a record.
	AllocatePayloadStorage(size int, extID ledger.ExtensionID) (PayloadReceptacle, ledger.StorageLocator, error)
}

type PayloadSectionMock

type PayloadSectionMock struct {
	AllocatePayloadStorageMock mPayloadSectionMockAllocatePayloadStorage
	// contains filtered or unexported fields
}

PayloadSectionMock implements PayloadSection

func NewPayloadSectionMock

func NewPayloadSectionMock(t minimock.Tester) *PayloadSectionMock

NewPayloadSectionMock returns a mock for PayloadSection

func (*PayloadSectionMock) AllocatePayloadStorage

func (mmAllocatePayloadStorage *PayloadSectionMock) AllocatePayloadStorage(size int, extID ledger.ExtensionID) (p1 PayloadReceptacle, s1 ledger.StorageLocator, err error)

AllocatePayloadStorage implements PayloadSection

func (*PayloadSectionMock) AllocatePayloadStorageAfterCounter

func (mmAllocatePayloadStorage *PayloadSectionMock) AllocatePayloadStorageAfterCounter() uint64

AllocatePayloadStorageAfterCounter returns a count of finished PayloadSectionMock.AllocatePayloadStorage invocations

func (*PayloadSectionMock) AllocatePayloadStorageBeforeCounter

func (mmAllocatePayloadStorage *PayloadSectionMock) AllocatePayloadStorageBeforeCounter() uint64

AllocatePayloadStorageBeforeCounter returns a count of PayloadSectionMock.AllocatePayloadStorage invocations

func (*PayloadSectionMock) MinimockAllocatePayloadStorageDone

func (m *PayloadSectionMock) MinimockAllocatePayloadStorageDone() bool

MinimockAllocatePayloadStorageDone returns true if the count of the AllocatePayloadStorage invocations corresponds the number of defined expectations

func (*PayloadSectionMock) MinimockAllocatePayloadStorageInspect

func (m *PayloadSectionMock) MinimockAllocatePayloadStorageInspect()

MinimockAllocatePayloadStorageInspect logs each unmet expectation

func (*PayloadSectionMock) MinimockFinish

func (m *PayloadSectionMock) MinimockFinish()

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

func (*PayloadSectionMock) MinimockWait

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

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

type PayloadSectionMockAllocatePayloadStorageExpectation

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

PayloadSectionMockAllocatePayloadStorageExpectation specifies expectation struct of the PayloadSection.AllocatePayloadStorage

func (*PayloadSectionMockAllocatePayloadStorageExpectation) Then

Then sets up PayloadSection.AllocatePayloadStorage return parameters for the expectation previously defined by the When method

type PayloadSectionMockAllocatePayloadStorageParams

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

PayloadSectionMockAllocatePayloadStorageParams contains parameters of the PayloadSection.AllocatePayloadStorage

type PayloadSectionMockAllocatePayloadStorageResults

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

PayloadSectionMockAllocatePayloadStorageResults contains results of the PayloadSection.AllocatePayloadStorage

type ResultFunc

type ResultFunc = func([]ledger.DirectoryIndex, error) bool

type Snapshot

type Snapshot interface {
	// Prepared indicates that all allocations are made, but data were not written yet. Called once per Snapshot.
	// Implementation should NOT delay return from Prepared().
	// It is guaranteed that there will be no new TakeSnapshot() call until Prepared() is invoked on the last one.
	// Not concurrent with SnapshotWriter.TakeSnapshot().
	Prepared() error
	// Completed indicates that all data were written into the allocations made. Called once per Snapshot after Prepared().
	// Implementation can delay return from Completed() e.g. to do multiple copies of data.
	// Concurrent.
	Completed() error
	// Commit is invoked after Completed().
	// Is guaranteed to be invoked in the same sequence as snapshots were taken by TakeSnapshot().
	// Not concurrent with SnapshotWriter.TakeSnapshot().
	Commit() error
	// Rollback is invoked on any errors, including errors of Commit().
	// Is guaranteed to be invoked in the same sequence as snapshots were taken by TakeSnapshot().
	// Arg (chained) indicates that rollback was initiated by an earlier snapshot.
	// Not concurrent with SnapshotWriter.TakeSnapshot().
	// WARNING! Rollback's panic will be ignored.
	Rollback(chained bool) error

	// GetPayloadSection returns PayloadSection for the given id or error.
	// Happens between TakeSnapshot() and Prepared().
	// Not concurrent with SnapshotWriter.TakeSnapshot().
	GetPayloadSection(ledger.SectionID) (PayloadSection, error)

	// GetDirectorySection returns DirectorySection for the given id or error
	// Happens between TakeSnapshot() and Prepared().
	// Not concurrent with SnapshotWriter.TakeSnapshot().
	GetDirectorySection(ledger.SectionID) (DirectorySection, error)
}

Snapshot represents a written bundle / transaction.

type SnapshotMock

type SnapshotMock struct {
	CommitMock mSnapshotMockCommit

	CompletedMock mSnapshotMockCompleted

	GetDirectorySectionMock mSnapshotMockGetDirectorySection

	GetPayloadSectionMock mSnapshotMockGetPayloadSection

	PreparedMock mSnapshotMockPrepared

	RollbackMock mSnapshotMockRollback
	// contains filtered or unexported fields
}

SnapshotMock implements Snapshot

func NewSnapshotMock

func NewSnapshotMock(t minimock.Tester) *SnapshotMock

NewSnapshotMock returns a mock for Snapshot

func (*SnapshotMock) Commit

func (mmCommit *SnapshotMock) Commit() (err error)

Commit implements Snapshot

func (*SnapshotMock) CommitAfterCounter

func (mmCommit *SnapshotMock) CommitAfterCounter() uint64

CommitAfterCounter returns a count of finished SnapshotMock.Commit invocations

func (*SnapshotMock) CommitBeforeCounter

func (mmCommit *SnapshotMock) CommitBeforeCounter() uint64

CommitBeforeCounter returns a count of SnapshotMock.Commit invocations

func (*SnapshotMock) Completed

func (mmCompleted *SnapshotMock) Completed() (err error)

Completed implements Snapshot

func (*SnapshotMock) CompletedAfterCounter

func (mmCompleted *SnapshotMock) CompletedAfterCounter() uint64

CompletedAfterCounter returns a count of finished SnapshotMock.Completed invocations

func (*SnapshotMock) CompletedBeforeCounter

func (mmCompleted *SnapshotMock) CompletedBeforeCounter() uint64

CompletedBeforeCounter returns a count of SnapshotMock.Completed invocations

func (*SnapshotMock) GetDirectorySection

func (mmGetDirectorySection *SnapshotMock) GetDirectorySection(s1 ledger.SectionID) (d1 DirectorySection, err error)

GetDirectorySection implements Snapshot

func (*SnapshotMock) GetDirectorySectionAfterCounter

func (mmGetDirectorySection *SnapshotMock) GetDirectorySectionAfterCounter() uint64

GetDirectorySectionAfterCounter returns a count of finished SnapshotMock.GetDirectorySection invocations

func (*SnapshotMock) GetDirectorySectionBeforeCounter

func (mmGetDirectorySection *SnapshotMock) GetDirectorySectionBeforeCounter() uint64

GetDirectorySectionBeforeCounter returns a count of SnapshotMock.GetDirectorySection invocations

func (*SnapshotMock) GetPayloadSection

func (mmGetPayloadSection *SnapshotMock) GetPayloadSection(s1 ledger.SectionID) (p1 PayloadSection, err error)

GetPayloadSection implements Snapshot

func (*SnapshotMock) GetPayloadSectionAfterCounter

func (mmGetPayloadSection *SnapshotMock) GetPayloadSectionAfterCounter() uint64

GetPayloadSectionAfterCounter returns a count of finished SnapshotMock.GetPayloadSection invocations

func (*SnapshotMock) GetPayloadSectionBeforeCounter

func (mmGetPayloadSection *SnapshotMock) GetPayloadSectionBeforeCounter() uint64

GetPayloadSectionBeforeCounter returns a count of SnapshotMock.GetPayloadSection invocations

func (*SnapshotMock) MinimockCommitDone

func (m *SnapshotMock) MinimockCommitDone() bool

MinimockCommitDone returns true if the count of the Commit invocations corresponds the number of defined expectations

func (*SnapshotMock) MinimockCommitInspect

func (m *SnapshotMock) MinimockCommitInspect()

MinimockCommitInspect logs each unmet expectation

func (*SnapshotMock) MinimockCompletedDone

func (m *SnapshotMock) MinimockCompletedDone() bool

MinimockCompletedDone returns true if the count of the Completed invocations corresponds the number of defined expectations

func (*SnapshotMock) MinimockCompletedInspect

func (m *SnapshotMock) MinimockCompletedInspect()

MinimockCompletedInspect logs each unmet expectation

func (*SnapshotMock) MinimockFinish

func (m *SnapshotMock) MinimockFinish()

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

func (*SnapshotMock) MinimockGetDirectorySectionDone

func (m *SnapshotMock) MinimockGetDirectorySectionDone() bool

MinimockGetDirectorySectionDone returns true if the count of the GetDirectorySection invocations corresponds the number of defined expectations

func (*SnapshotMock) MinimockGetDirectorySectionInspect

func (m *SnapshotMock) MinimockGetDirectorySectionInspect()

MinimockGetDirectorySectionInspect logs each unmet expectation

func (*SnapshotMock) MinimockGetPayloadSectionDone

func (m *SnapshotMock) MinimockGetPayloadSectionDone() bool

MinimockGetPayloadSectionDone returns true if the count of the GetPayloadSection invocations corresponds the number of defined expectations

func (*SnapshotMock) MinimockGetPayloadSectionInspect

func (m *SnapshotMock) MinimockGetPayloadSectionInspect()

MinimockGetPayloadSectionInspect logs each unmet expectation

func (*SnapshotMock) MinimockPreparedDone

func (m *SnapshotMock) MinimockPreparedDone() bool

MinimockPreparedDone returns true if the count of the Prepared invocations corresponds the number of defined expectations

func (*SnapshotMock) MinimockPreparedInspect

func (m *SnapshotMock) MinimockPreparedInspect()

MinimockPreparedInspect logs each unmet expectation

func (*SnapshotMock) MinimockRollbackDone

func (m *SnapshotMock) MinimockRollbackDone() bool

MinimockRollbackDone returns true if the count of the Rollback invocations corresponds the number of defined expectations

func (*SnapshotMock) MinimockRollbackInspect

func (m *SnapshotMock) MinimockRollbackInspect()

MinimockRollbackInspect logs each unmet expectation

func (*SnapshotMock) MinimockWait

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

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

func (*SnapshotMock) Prepared

func (mmPrepared *SnapshotMock) Prepared() (err error)

Prepared implements Snapshot

func (*SnapshotMock) PreparedAfterCounter

func (mmPrepared *SnapshotMock) PreparedAfterCounter() uint64

PreparedAfterCounter returns a count of finished SnapshotMock.Prepared invocations

func (*SnapshotMock) PreparedBeforeCounter

func (mmPrepared *SnapshotMock) PreparedBeforeCounter() uint64

PreparedBeforeCounter returns a count of SnapshotMock.Prepared invocations

func (*SnapshotMock) Rollback

func (mmRollback *SnapshotMock) Rollback(chained bool) (err error)

Rollback implements Snapshot

func (*SnapshotMock) RollbackAfterCounter

func (mmRollback *SnapshotMock) RollbackAfterCounter() uint64

RollbackAfterCounter returns a count of finished SnapshotMock.Rollback invocations

func (*SnapshotMock) RollbackBeforeCounter

func (mmRollback *SnapshotMock) RollbackBeforeCounter() uint64

RollbackBeforeCounter returns a count of SnapshotMock.Rollback invocations

type SnapshotMockCommitExpectation

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

SnapshotMockCommitExpectation specifies expectation struct of the Snapshot.Commit

type SnapshotMockCommitResults

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

SnapshotMockCommitResults contains results of the Snapshot.Commit

type SnapshotMockCompletedExpectation

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

SnapshotMockCompletedExpectation specifies expectation struct of the Snapshot.Completed

type SnapshotMockCompletedResults

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

SnapshotMockCompletedResults contains results of the Snapshot.Completed

type SnapshotMockGetDirectorySectionExpectation

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

SnapshotMockGetDirectorySectionExpectation specifies expectation struct of the Snapshot.GetDirectorySection

func (*SnapshotMockGetDirectorySectionExpectation) Then

Then sets up Snapshot.GetDirectorySection return parameters for the expectation previously defined by the When method

type SnapshotMockGetDirectorySectionParams

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

SnapshotMockGetDirectorySectionParams contains parameters of the Snapshot.GetDirectorySection

type SnapshotMockGetDirectorySectionResults

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

SnapshotMockGetDirectorySectionResults contains results of the Snapshot.GetDirectorySection

type SnapshotMockGetPayloadSectionExpectation

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

SnapshotMockGetPayloadSectionExpectation specifies expectation struct of the Snapshot.GetPayloadSection

func (*SnapshotMockGetPayloadSectionExpectation) Then

Then sets up Snapshot.GetPayloadSection return parameters for the expectation previously defined by the When method

type SnapshotMockGetPayloadSectionParams

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

SnapshotMockGetPayloadSectionParams contains parameters of the Snapshot.GetPayloadSection

type SnapshotMockGetPayloadSectionResults

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

SnapshotMockGetPayloadSectionResults contains results of the Snapshot.GetPayloadSection

type SnapshotMockPreparedExpectation

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

SnapshotMockPreparedExpectation specifies expectation struct of the Snapshot.Prepared

type SnapshotMockPreparedResults

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

SnapshotMockPreparedResults contains results of the Snapshot.Prepared

type SnapshotMockRollbackExpectation

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

SnapshotMockRollbackExpectation specifies expectation struct of the Snapshot.Rollback

func (*SnapshotMockRollbackExpectation) Then

Then sets up Snapshot.Rollback return parameters for the expectation previously defined by the When method

type SnapshotMockRollbackParams

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

SnapshotMockRollbackParams contains parameters of the Snapshot.Rollback

type SnapshotMockRollbackResults

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

SnapshotMockRollbackResults contains results of the Snapshot.Rollback

type SnapshotWriter

type SnapshotWriter interface {
	// TakeSnapshot starts a new write operation and remembers a rollback point.
	// Not concurrent at SnapshotWriter, but can be called before commit of previous snapshot(s).
	TakeSnapshot() (Snapshot, error)
	MarkReadOnly() error

	DirtyReader() DirtyReader
}

SnapshotWriter is an interfaces to support a storage with simplified transactional paradigm for bundled writer. Writer can write data opportunistically and has to rollback transactions in the same sequence as bundles were written. Concurrency control for SnapshotWriter MUST be done by implementation of BundleWriter.

type SnapshotWriterMock

type SnapshotWriterMock struct {
	DirtyReaderMock mSnapshotWriterMockDirtyReader

	MarkReadOnlyMock mSnapshotWriterMockMarkReadOnly

	TakeSnapshotMock mSnapshotWriterMockTakeSnapshot
	// contains filtered or unexported fields
}

SnapshotWriterMock implements SnapshotWriter

func NewSnapshotWriterMock

func NewSnapshotWriterMock(t minimock.Tester) *SnapshotWriterMock

NewSnapshotWriterMock returns a mock for SnapshotWriter

func (*SnapshotWriterMock) DirtyReader

func (mmDirtyReader *SnapshotWriterMock) DirtyReader() (d1 DirtyReader)

DirtyReader implements SnapshotWriter

func (*SnapshotWriterMock) DirtyReaderAfterCounter

func (mmDirtyReader *SnapshotWriterMock) DirtyReaderAfterCounter() uint64

DirtyReaderAfterCounter returns a count of finished SnapshotWriterMock.DirtyReader invocations

func (*SnapshotWriterMock) DirtyReaderBeforeCounter

func (mmDirtyReader *SnapshotWriterMock) DirtyReaderBeforeCounter() uint64

DirtyReaderBeforeCounter returns a count of SnapshotWriterMock.DirtyReader invocations

func (*SnapshotWriterMock) MarkReadOnly

func (mmMarkReadOnly *SnapshotWriterMock) MarkReadOnly() (err error)

MarkReadOnly implements SnapshotWriter

func (*SnapshotWriterMock) MarkReadOnlyAfterCounter

func (mmMarkReadOnly *SnapshotWriterMock) MarkReadOnlyAfterCounter() uint64

MarkReadOnlyAfterCounter returns a count of finished SnapshotWriterMock.MarkReadOnly invocations

func (*SnapshotWriterMock) MarkReadOnlyBeforeCounter

func (mmMarkReadOnly *SnapshotWriterMock) MarkReadOnlyBeforeCounter() uint64

MarkReadOnlyBeforeCounter returns a count of SnapshotWriterMock.MarkReadOnly invocations

func (*SnapshotWriterMock) MinimockDirtyReaderDone

func (m *SnapshotWriterMock) MinimockDirtyReaderDone() bool

MinimockDirtyReaderDone returns true if the count of the DirtyReader invocations corresponds the number of defined expectations

func (*SnapshotWriterMock) MinimockDirtyReaderInspect

func (m *SnapshotWriterMock) MinimockDirtyReaderInspect()

MinimockDirtyReaderInspect logs each unmet expectation

func (*SnapshotWriterMock) MinimockFinish

func (m *SnapshotWriterMock) MinimockFinish()

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

func (*SnapshotWriterMock) MinimockMarkReadOnlyDone

func (m *SnapshotWriterMock) MinimockMarkReadOnlyDone() bool

MinimockMarkReadOnlyDone returns true if the count of the MarkReadOnly invocations corresponds the number of defined expectations

func (*SnapshotWriterMock) MinimockMarkReadOnlyInspect

func (m *SnapshotWriterMock) MinimockMarkReadOnlyInspect()

MinimockMarkReadOnlyInspect logs each unmet expectation

func (*SnapshotWriterMock) MinimockTakeSnapshotDone

func (m *SnapshotWriterMock) MinimockTakeSnapshotDone() bool

MinimockTakeSnapshotDone returns true if the count of the TakeSnapshot invocations corresponds the number of defined expectations

func (*SnapshotWriterMock) MinimockTakeSnapshotInspect

func (m *SnapshotWriterMock) MinimockTakeSnapshotInspect()

MinimockTakeSnapshotInspect logs each unmet expectation

func (*SnapshotWriterMock) MinimockWait

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

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

func (*SnapshotWriterMock) TakeSnapshot

func (mmTakeSnapshot *SnapshotWriterMock) TakeSnapshot() (s1 Snapshot, err error)

TakeSnapshot implements SnapshotWriter

func (*SnapshotWriterMock) TakeSnapshotAfterCounter

func (mmTakeSnapshot *SnapshotWriterMock) TakeSnapshotAfterCounter() uint64

TakeSnapshotAfterCounter returns a count of finished SnapshotWriterMock.TakeSnapshot invocations

func (*SnapshotWriterMock) TakeSnapshotBeforeCounter

func (mmTakeSnapshot *SnapshotWriterMock) TakeSnapshotBeforeCounter() uint64

TakeSnapshotBeforeCounter returns a count of SnapshotWriterMock.TakeSnapshot invocations

type SnapshotWriterMockDirtyReaderExpectation

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

SnapshotWriterMockDirtyReaderExpectation specifies expectation struct of the SnapshotWriter.DirtyReader

type SnapshotWriterMockDirtyReaderResults

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

SnapshotWriterMockDirtyReaderResults contains results of the SnapshotWriter.DirtyReader

type SnapshotWriterMockMarkReadOnlyExpectation

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

SnapshotWriterMockMarkReadOnlyExpectation specifies expectation struct of the SnapshotWriter.MarkReadOnly

type SnapshotWriterMockMarkReadOnlyResults

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

SnapshotWriterMockMarkReadOnlyResults contains results of the SnapshotWriter.MarkReadOnly

type SnapshotWriterMockTakeSnapshotExpectation

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

SnapshotWriterMockTakeSnapshotExpectation specifies expectation struct of the SnapshotWriter.TakeSnapshot

type SnapshotWriterMockTakeSnapshotResults

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

SnapshotWriterMockTakeSnapshotResults contains results of the SnapshotWriter.TakeSnapshot

type Writeable

type Writeable interface {
	PrepareWrite(Snapshot) error
	ApplyWrite() ([]ledger.DirectoryIndex, error)
	ApplyRollback()
}

type WriteableMock

type WriteableMock struct {
	ApplyRollbackMock mWriteableMockApplyRollback

	ApplyWriteMock mWriteableMockApplyWrite

	PrepareWriteMock mWriteableMockPrepareWrite
	// contains filtered or unexported fields
}

WriteableMock implements Writeable

func NewWriteableMock

func NewWriteableMock(t minimock.Tester) *WriteableMock

NewWriteableMock returns a mock for Writeable

func (*WriteableMock) ApplyRollback

func (mmApplyRollback *WriteableMock) ApplyRollback()

ApplyRollback implements Writeable

func (*WriteableMock) ApplyRollbackAfterCounter

func (mmApplyRollback *WriteableMock) ApplyRollbackAfterCounter() uint64

ApplyRollbackAfterCounter returns a count of finished WriteableMock.ApplyRollback invocations

func (*WriteableMock) ApplyRollbackBeforeCounter

func (mmApplyRollback *WriteableMock) ApplyRollbackBeforeCounter() uint64

ApplyRollbackBeforeCounter returns a count of WriteableMock.ApplyRollback invocations

func (*WriteableMock) ApplyWrite

func (mmApplyWrite *WriteableMock) ApplyWrite() (da1 []ledger.DirectoryIndex, err error)

ApplyWrite implements Writeable

func (*WriteableMock) ApplyWriteAfterCounter

func (mmApplyWrite *WriteableMock) ApplyWriteAfterCounter() uint64

ApplyWriteAfterCounter returns a count of finished WriteableMock.ApplyWrite invocations

func (*WriteableMock) ApplyWriteBeforeCounter

func (mmApplyWrite *WriteableMock) ApplyWriteBeforeCounter() uint64

ApplyWriteBeforeCounter returns a count of WriteableMock.ApplyWrite invocations

func (*WriteableMock) MinimockApplyRollbackDone

func (m *WriteableMock) MinimockApplyRollbackDone() bool

MinimockApplyRollbackDone returns true if the count of the ApplyRollback invocations corresponds the number of defined expectations

func (*WriteableMock) MinimockApplyRollbackInspect

func (m *WriteableMock) MinimockApplyRollbackInspect()

MinimockApplyRollbackInspect logs each unmet expectation

func (*WriteableMock) MinimockApplyWriteDone

func (m *WriteableMock) MinimockApplyWriteDone() bool

MinimockApplyWriteDone returns true if the count of the ApplyWrite invocations corresponds the number of defined expectations

func (*WriteableMock) MinimockApplyWriteInspect

func (m *WriteableMock) MinimockApplyWriteInspect()

MinimockApplyWriteInspect logs each unmet expectation

func (*WriteableMock) MinimockFinish

func (m *WriteableMock) MinimockFinish()

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

func (*WriteableMock) MinimockPrepareWriteDone

func (m *WriteableMock) MinimockPrepareWriteDone() bool

MinimockPrepareWriteDone returns true if the count of the PrepareWrite invocations corresponds the number of defined expectations

func (*WriteableMock) MinimockPrepareWriteInspect

func (m *WriteableMock) MinimockPrepareWriteInspect()

MinimockPrepareWriteInspect logs each unmet expectation

func (*WriteableMock) MinimockWait

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

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

func (*WriteableMock) PrepareWrite

func (mmPrepareWrite *WriteableMock) PrepareWrite(s1 Snapshot) (err error)

PrepareWrite implements Writeable

func (*WriteableMock) PrepareWriteAfterCounter

func (mmPrepareWrite *WriteableMock) PrepareWriteAfterCounter() uint64

PrepareWriteAfterCounter returns a count of finished WriteableMock.PrepareWrite invocations

func (*WriteableMock) PrepareWriteBeforeCounter

func (mmPrepareWrite *WriteableMock) PrepareWriteBeforeCounter() uint64

PrepareWriteBeforeCounter returns a count of WriteableMock.PrepareWrite invocations

type WriteableMockApplyRollbackExpectation

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

WriteableMockApplyRollbackExpectation specifies expectation struct of the Writeable.ApplyRollback

type WriteableMockApplyWriteExpectation

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

WriteableMockApplyWriteExpectation specifies expectation struct of the Writeable.ApplyWrite

type WriteableMockApplyWriteResults

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

WriteableMockApplyWriteResults contains results of the Writeable.ApplyWrite

type WriteableMockPrepareWriteExpectation

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

WriteableMockPrepareWriteExpectation specifies expectation struct of the Writeable.PrepareWrite

func (*WriteableMockPrepareWriteExpectation) Then

Then sets up Writeable.PrepareWrite return parameters for the expectation previously defined by the When method

type WriteableMockPrepareWriteParams

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

WriteableMockPrepareWriteParams contains parameters of the Writeable.PrepareWrite

type WriteableMockPrepareWriteResults

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

WriteableMockPrepareWriteResults contains results of the Writeable.PrepareWrite

type Writer

type Writer interface {
	// WriteBundle verifies the bundle and starts writing of it. Can return after validation, but before completion of write.
	// All bundle entries must be written atomically.
	// Callback (ResultFunc) is invoked either on error, or after completion of write of all copies, but before commit.
	// Rollback is initiated either on an error or by returning (false) from (ResultFunc).
	// Implementation MUST ensure on successful writes the same sequence of calls to (ResultFunc) as were for WriteBundle.
	WriteBundle(Writeable, ResultFunc) error

	// WaitWriteBundles will wait for all bundles invoked before WaitWriteBundles to be completed.
	// Arg (synckit.SignalChannel) can be used to interrupt waiting.
	WaitWriteBundles(cancel synckit.SignalChannel, fn func(cancelled bool)) bool

	WaitWriteBundlesAsync(cancel synckit.SignalChannel, fn func(cancelled bool))

	// MarkReadOnly applies read only status to the underlying storage. It may affect bundles being written.
	MarkReadOnly() error
}

func NewWriter

func NewWriter(snap SnapshotWriter) Writer

Jump to

Keyboard shortcuts

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