multiversion

package
v0.45.10 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeletedItem

func NewDeletedItem(index int, incarnation int) *valueItem

func NewEstimateItem

func NewEstimateItem(index int, incarnation int) *valueItem

func NewIterationTracker

func NewIterationTracker(startKey, endKey []byte, ascending bool, writeset WriteSet) iterationTracker

func NewMVSMergeIterator

func NewMVSMergeIterator(
	parent, cache types.Iterator,
	ascending bool,
	readsetHandler ReadsetHandler,
) *mvsMergeIterator

func NewMultiVersionItem

func NewMultiVersionItem() *multiVersionItem

func NewTrackedIterator

func NewTrackedIterator(iter types.Iterator, iterationTracker *iterationTracker) *trackedIterator

func NewValueItem

func NewValueItem(index int, incarnation int, value []byte) *valueItem

Types

type IterateSetHandler

type IterateSetHandler interface {
	UpdateIterateSet(*iterationTracker)
}

exposes a handler for adding items to iterateset, to be called upon iterator close

type Iterateset

type Iterateset []*iterationTracker

type MultiVersionStore

type MultiVersionStore interface {
	GetLatest(key []byte) (value MultiVersionValueItem)
	GetLatestBeforeIndex(index int, key []byte) (value MultiVersionValueItem)
	Has(index int, key []byte) bool
	WriteLatestToStore()
	SetWriteset(index int, incarnation int, writeset WriteSet)
	InvalidateWriteset(index int, incarnation int)
	SetEstimatedWriteset(index int, incarnation int, writeset WriteSet)
	GetAllWritesetKeys() map[int][]string
	CollectIteratorItems(index int) *db.MemDB
	SetReadset(index int, readset ReadSet)
	GetReadset(index int) ReadSet
	ClearReadset(index int)
	VersionedIndexedStore(index int, incarnation int, abortChannel chan occ.Abort) *VersionIndexedStore
	SetIterateset(index int, iterateset Iterateset)
	GetIterateset(index int) Iterateset
	ClearIterateset(index int)
	ValidateTransactionState(index int) (bool, []int)
}

type MultiVersionValue

type MultiVersionValue interface {
	GetLatest() (value MultiVersionValueItem, found bool)
	GetLatestNonEstimate() (value MultiVersionValueItem, found bool)
	GetLatestBeforeIndex(index int) (value MultiVersionValueItem, found bool)
	Set(index int, incarnation int, value []byte)
	SetEstimate(index int, incarnation int)
	Delete(index int, incarnation int)
	Remove(index int)
}

type MultiVersionValueItem

type MultiVersionValueItem interface {
	IsDeleted() bool
	IsEstimate() bool
	Value() []byte
	Incarnation() int
	Index() int
}

type NoOpHandler

type NoOpHandler struct{}

func (NoOpHandler) UpdateReadSet

func (NoOpHandler) UpdateReadSet(key []byte, value []byte)

type ReadSet

type ReadSet map[string][][]byte

type ReadsetHandler

type ReadsetHandler interface {
	UpdateReadSet(key []byte, value []byte)
}

exposes a handler for adding items to readset, useful for iterators

type Store

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

func NewMultiVersionStore

func NewMultiVersionStore(parentStore types.KVStore) *Store

func (*Store) ClearIterateset

func (s *Store) ClearIterateset(index int)

func (*Store) ClearReadset

func (s *Store) ClearReadset(index int)

func (*Store) CollectIteratorItems

func (s *Store) CollectIteratorItems(index int) *db.MemDB

CollectIteratorItems implements MultiVersionStore. It will return a memDB containing all of the keys present in the multiversion store within the iteration range prior to (exclusive of) the index.

func (*Store) GetAllWritesetKeys

func (s *Store) GetAllWritesetKeys() map[int][]string

GetAllWritesetKeys implements MultiVersionStore.

func (*Store) GetIterateset

func (s *Store) GetIterateset(index int) Iterateset

func (*Store) GetLatest

func (s *Store) GetLatest(key []byte) (value MultiVersionValueItem)

GetLatest implements MultiVersionStore.

func (*Store) GetLatestBeforeIndex

func (s *Store) GetLatestBeforeIndex(index int, key []byte) (value MultiVersionValueItem)

GetLatestBeforeIndex implements MultiVersionStore.

func (*Store) GetReadset

func (s *Store) GetReadset(index int) ReadSet

func (*Store) Has

func (s *Store) Has(index int, key []byte) bool

Has implements MultiVersionStore. It checks if the key exists in the multiversion store at or before the specified index.

func (*Store) InvalidateWriteset

func (s *Store) InvalidateWriteset(index int, incarnation int)

InvalidateWriteset iterates over the keys for the given index and incarnation writeset and replaces with ESTIMATEs

func (*Store) SetEstimatedWriteset

func (s *Store) SetEstimatedWriteset(index int, incarnation int, writeset WriteSet)

SetEstimatedWriteset is used to directly write estimates instead of writing a writeset and later invalidating

func (*Store) SetIterateset

func (s *Store) SetIterateset(index int, iterateset Iterateset)

func (*Store) SetReadset

func (s *Store) SetReadset(index int, readset ReadSet)

func (*Store) SetWriteset

func (s *Store) SetWriteset(index int, incarnation int, writeset WriteSet)

SetWriteset sets a writeset for a transaction index, and also writes all of the multiversion items in the writeset to the multiversion store. TODO: returns a list of NEW keys added

func (*Store) ValidateTransactionState

func (s *Store) ValidateTransactionState(index int) (bool, []int)

TODO: do we want to return bool + []int where bool indicates whether it was valid and then []int indicates only ones for which we need to wait due to estimates? - yes i think so?

func (*Store) VersionedIndexedStore

func (s *Store) VersionedIndexedStore(index int, incarnation int, abortChannel chan occ.Abort) *VersionIndexedStore

VersionedIndexedStore creates a new versioned index store for a given incarnation and transaction index

func (*Store) WriteLatestToStore

func (s *Store) WriteLatestToStore()

type VersionIndexedStore

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

Version Indexed Store wraps the multiversion store in a way that implements the KVStore interface, but also stores the index of the transaction, and so store actions are applied to the multiversion store using that index

func NewVersionIndexedStore

func NewVersionIndexedStore(parent types.KVStore, multiVersionStore MultiVersionStore, transactionIndex, incarnation int, abortChannel chan scheduler.Abort) *VersionIndexedStore

func (*VersionIndexedStore) CacheWrap

func (*VersionIndexedStore) CacheWrap(storeKey types.StoreKey) types.CacheWrap

CacheWrap implements types.KVStore.

func (*VersionIndexedStore) CacheWrapWithListeners

func (*VersionIndexedStore) CacheWrapWithListeners(storeKey types.StoreKey, listeners []types.WriteListener) types.CacheWrap

CacheWrapWithListeners implements types.KVStore.

func (*VersionIndexedStore) CacheWrapWithTrace

func (*VersionIndexedStore) CacheWrapWithTrace(storeKey types.StoreKey, w io.Writer, tc types.TraceContext) types.CacheWrap

CacheWrapWithTrace implements types.KVStore.

func (*VersionIndexedStore) Delete

func (store *VersionIndexedStore) Delete(key []byte)

Delete implements types.KVStore.

func (*VersionIndexedStore) DeleteAll

func (v *VersionIndexedStore) DeleteAll(start, end []byte) error

func (*VersionIndexedStore) Get

func (store *VersionIndexedStore) Get(key []byte) []byte

Get implements types.KVStore.

func (*VersionIndexedStore) GetAllKeyStrsInRange

func (v *VersionIndexedStore) GetAllKeyStrsInRange(start, end []byte) (res []string)

func (*VersionIndexedStore) GetEvents

func (store *VersionIndexedStore) GetEvents() []abci.Event

GetEvents implements types.CacheWrap so this store can exist on the cache multi store

func (*VersionIndexedStore) GetReadset

func (store *VersionIndexedStore) GetReadset() map[string][][]byte

GetReadset returns the readset

func (*VersionIndexedStore) GetStoreType

func (v *VersionIndexedStore) GetStoreType() types.StoreType

GetStoreType implements types.KVStore.

func (*VersionIndexedStore) GetWorkingHash

func (v *VersionIndexedStore) GetWorkingHash() ([]byte, error)

GetWorkingHash implements types.KVStore.

func (*VersionIndexedStore) GetWriteset

func (store *VersionIndexedStore) GetWriteset() map[string][]byte

GetWriteset returns the writeset

func (*VersionIndexedStore) Has

func (store *VersionIndexedStore) Has(key []byte) bool

Has implements types.KVStore.

func (*VersionIndexedStore) Iterator

func (v *VersionIndexedStore) Iterator(start []byte, end []byte) dbm.Iterator

Iterator implements types.KVStore.

func (*VersionIndexedStore) ResetEvents

func (store *VersionIndexedStore) ResetEvents()

ResetEvents implements types.CacheWrap so this store can exist on the cache multi store

func (*VersionIndexedStore) ReverseIterator

func (v *VersionIndexedStore) ReverseIterator(start []byte, end []byte) dbm.Iterator

ReverseIterator implements types.KVStore.

func (*VersionIndexedStore) Set

func (store *VersionIndexedStore) Set(key []byte, value []byte)

Set implements types.KVStore.

func (*VersionIndexedStore) UpdateIterateSet

func (store *VersionIndexedStore) UpdateIterateSet(iterationTracker *iterationTracker)

func (*VersionIndexedStore) UpdateReadSet

func (store *VersionIndexedStore) UpdateReadSet(key []byte, value []byte)

func (*VersionIndexedStore) ValidateReadset

func (store *VersionIndexedStore) ValidateReadset() bool

This function iterates over the readset, validating that the values in the readset are consistent with the values in the multiversion store and underlying parent store, and returns a boolean indicating validity

func (*VersionIndexedStore) VersionExists

func (v *VersionIndexedStore) VersionExists(version int64) bool

func (*VersionIndexedStore) Write

func (store *VersionIndexedStore) Write()

Write implements types.CacheWrap so this store can exist on the cache multi store

func (*VersionIndexedStore) WriteAbort

func (store *VersionIndexedStore) WriteAbort(abort scheduler.Abort)

WriteAbort writes an abort to the store but only allows one abort to be written PER instance of mvkv. This is because we pair abort channel writes with panics, and if we hit this more than once, it means that the panic was swallowed, so we won't write any aborts after a first abort is written to prevent any potential for deadlocking due to full channels

func (*VersionIndexedStore) WriteEstimatesToMultiVersionStore

func (store *VersionIndexedStore) WriteEstimatesToMultiVersionStore()

func (*VersionIndexedStore) WriteToMultiVersionStore

func (store *VersionIndexedStore) WriteToMultiVersionStore()

type WriteSet

type WriteSet map[string][]byte

Jump to

Keyboard shortcuts

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