Documentation ¶
Index ¶
- Variables
- func BlockTxIndexToBytes(Block driver2.BlockNum, TxNum driver2.TxNum) []byte
- func Equal(a, c driver2.RawVersion) bool
- func TTestDeadlock(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestInspector(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestInterceptorConcurrency(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestInterceptorErr(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestMerge(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestParallelVaults(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestQueryExecutor(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestRun(t *testing.T, db1, db2 VersionedPersistence, vp artifactsProvider)
- func TTestShardLikeCommit(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- func TTestVaultErr(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
- type BlockTxIndexVersionBuilder
- func (b *BlockTxIndexVersionBuilder) VersionedMetaValues(rws *ReadWriteSet, ns driver2.Namespace, writes KeyedMetaWrites, ...) (map[driver2.PKey]driver2.VersionedMetadataValue, error)
- func (b *BlockTxIndexVersionBuilder) VersionedValues(rws *ReadWriteSet, ns driver2.Namespace, writes NamespaceWrites, ...) (map[driver2.PKey]VersionedValue, error)
- type BlockTxIndexVersionComparator
- type BlockTxIndexVersionMarshaller
- type Inspector
- func (i *Inspector) AddReadAt(ns driver.Namespace, key string, version Version) error
- func (i *Inspector) AppendRWSet(driver.RawValue, ...driver.Namespace) error
- func (i *Inspector) Bytes() ([]byte, error)
- func (i *Inspector) Clear(driver.Namespace) error
- func (i *Inspector) DeleteState(driver.Namespace, driver.PKey) error
- func (i *Inspector) Done()
- func (i *Inspector) Equals(other interface{}, nss ...driver.Namespace) error
- func (i *Inspector) GetDirectState(driver.Namespace, driver.PKey) ([]byte, error)
- func (i *Inspector) GetReadAt(ns driver.Namespace, pos int) (driver.PKey, driver.RawValue, error)
- func (i *Inspector) GetReadKeyAt(ns driver.Namespace, pos int) (driver.PKey, error)
- func (i *Inspector) GetState(namespace driver.Namespace, key driver.PKey, _ ...driver.GetStateOpt) (driver.RawValue, error)
- func (i *Inspector) GetStateMetadata(namespace driver.Namespace, key driver.PKey, _ ...driver.GetStateOpt) (driver.Metadata, error)
- func (i *Inspector) GetWriteAt(ns driver.Namespace, pos int) (driver.PKey, driver.RawValue, error)
- func (i *Inspector) IsClosed() bool
- func (i *Inspector) IsValid() error
- func (i *Inspector) Namespaces() []driver.Namespace
- func (i *Inspector) NumReads(ns driver.Namespace) int
- func (i *Inspector) NumWrites(ns driver.Namespace) int
- func (i *Inspector) SetState(driver.Namespace, driver.PKey, driver.RawValue) error
- func (i *Inspector) SetStateMetadata(driver.Namespace, driver.PKey, driver.Metadata) error
- func (i *Inspector) SetStateMetadatas(ns driver.Namespace, kvs map[driver.PKey]driver.VersionedMetadataValue) map[driver.PKey]error
- type Interceptor
- func (i *Interceptor[V]) AddReadAt(ns driver.Namespace, key string, version Version) error
- func (i *Interceptor[V]) AppendRWSet(raw []byte, nss ...string) error
- func (i *Interceptor[V]) Bytes() ([]byte, error)
- func (i *Interceptor[V]) Clear(ns string) error
- func (i *Interceptor[V]) DeleteState(namespace string, key string) error
- func (i *Interceptor[V]) Done()
- func (i *Interceptor[V]) Equals(other interface{}, nss ...string) error
- func (i *Interceptor[V]) GetDirectState(namespace driver.Namespace, key string) ([]byte, error)
- func (i *Interceptor[V]) GetReadAt(ns string, pos int) (string, []byte, error)
- func (i *Interceptor[V]) GetReadKeyAt(ns string, pos int) (string, error)
- func (i *Interceptor[V]) GetState(namespace driver.Namespace, key driver.PKey, opts ...driver.GetStateOpt) ([]byte, error)
- func (i *Interceptor[V]) GetStateMetadata(namespace, key string, opts ...driver.GetStateOpt) (map[string][]byte, error)
- func (i *Interceptor[V]) GetWriteAt(ns string, pos int) (string, []byte, error)
- func (i *Interceptor[V]) IsClosed() bool
- func (i *Interceptor[V]) IsValid() error
- func (i *Interceptor[V]) Namespaces() []string
- func (i *Interceptor[V]) NumReads(ns string) int
- func (i *Interceptor[V]) NumWrites(ns string) int
- func (i *Interceptor[V]) RWs() *ReadWriteSet
- func (i *Interceptor[V]) Reopen(qe VersionedQueryExecutor) error
- func (i *Interceptor[V]) SetState(namespace string, key string, value []byte) error
- func (i *Interceptor[V]) SetStateMetadata(namespace string, key string, value map[string][]byte) error
- func (i *Interceptor[V]) SetStateMetadatas(ns driver.Namespace, kvs map[driver.PKey]driver.Metadata) map[driver.PKey]error
- type KeyedMetaWrites
- type Logger
- type Marshaller
- type MetaWriteSet
- type MetaWrites
- type Metrics
- type NamespaceKeyedMetaWrites
- type NamespaceReads
- type NamespaceWrites
- type NewInterceptorFunc
- type Populator
- type QueryExecutor
- type ReadSet
- type ReadWriteSet
- type Reads
- type TXIDStore
- type TXIDStoreReader
- type TxInterceptor
- type VCProvider
- func (p *VCProvider) Busy() ValidationCode
- func (p *VCProvider) FromInt32(code int32) ValidationCode
- func (p *VCProvider) Invalid() ValidationCode
- func (p *VCProvider) NotFound() ValidationCode
- func (p *VCProvider) ToInt32(code ValidationCode) int32
- func (p *VCProvider) Unknown() ValidationCode
- func (p *VCProvider) Valid() ValidationCode
- type ValidationCode
- type Vault
- func (db *Vault[V]) Close() error
- func (db *Vault[V]) CommitTX(ctx context.Context, txID driver.TxID, block driver.BlockNum, ...) error
- func (db *Vault[V]) DiscardTx(txID driver.TxID, message string) error
- func (db *Vault[V]) GetExistingRWSet(txID driver.TxID) (driver.RWSet, error)
- func (db *Vault[V]) GetRWSet(txID driver.TxID, rwsetBytes []byte) (driver.RWSet, error)
- func (db *Vault[V]) InspectRWSet(rwsetBytes []byte, namespaces ...driver.Namespace) (driver.RWSet, error)
- func (db *Vault[V]) Match(txID driver.TxID, rwsRaw []byte) error
- func (db *Vault[V]) NewInspector(txID driver.TxID) (TxInterceptor, error)
- func (db *Vault[V]) NewQueryExecutor() (QueryExecutor, error)
- func (db *Vault[V]) NewRWSet(txID driver.TxID) (driver.RWSet, error)
- func (db *Vault[V]) RWSExists(txID driver.TxID) bool
- func (db *Vault[V]) SetBusy(txID driver.TxID) error
- func (db *Vault[V]) SetDiscarded(txID driver.TxID, message string) error
- func (db *Vault[V]) SetStatus(txID driver.TxID, code V) error
- func (db *Vault[V]) Status(txID driver.TxID) (V, string, error)
- func (db *Vault[V]) Statuses(txIDs ...driver.TxID) ([]driver.TxValidationStatus[V], error)
- func (db *Vault[V]) UnmapInterceptor(txID driver.TxID) (TxInterceptor, error)
- type Version
- type VersionBuilder
- type VersionComparator
- type VersionedMetadataValue
- type VersionedPersistence
- type VersionedQueryExecutor
- type VersionedRead
- type VersionedResultsIterator
- type VersionedValue
- type WriteSet
- type Writes
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DeadlockDetected = dbdriver.DeadlockDetected UniqueKeyViolation = dbdriver.UniqueKeyViolation )
View Source
var DoubleDBCases = []struct { Name string Fn func(*testing.T, VersionedPersistence, VersionedPersistence, artifactsProvider) }{ {"Run", TTestRun}, }
View Source
var RemoveNils func(items []VersionedRead) []VersionedRead
View Source
var SingleDBCases = []struct { Name string Fn func(*testing.T, VersionedPersistence, artifactsProvider) }{ {"Merge", TTestMerge}, {"Inspector", TTestInspector}, {"InterceptorErr", TTestInterceptorErr}, {"InterceptorConcurrency", TTestInterceptorConcurrency}, {"QueryExecutor", TTestQueryExecutor}, {"ShardLikeCommit", TTestShardLikeCommit}, {"VaultErr", TTestVaultErr}, {"ParallelVaults", TTestParallelVaults}, {"Deadlock", TTestDeadlock}, }
Functions ¶
func BlockTxIndexToBytes ¶
func Equal ¶
func Equal(a, c driver2.RawVersion) bool
func TTestDeadlock ¶
func TTestDeadlock(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestInspector ¶
func TTestInspector(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestInterceptorConcurrency ¶
func TTestInterceptorConcurrency(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestInterceptorErr ¶
func TTestInterceptorErr(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestMerge ¶
func TTestMerge(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestParallelVaults ¶
func TTestParallelVaults(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestQueryExecutor ¶
func TTestQueryExecutor(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestRun ¶
func TTestRun(t *testing.T, db1, db2 VersionedPersistence, vp artifactsProvider)
func TTestShardLikeCommit ¶
func TTestShardLikeCommit(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
func TTestVaultErr ¶
func TTestVaultErr(t *testing.T, ddb VersionedPersistence, vp artifactsProvider)
Types ¶
type BlockTxIndexVersionBuilder ¶
type BlockTxIndexVersionBuilder struct{}
func (*BlockTxIndexVersionBuilder) VersionedMetaValues ¶
func (b *BlockTxIndexVersionBuilder) VersionedMetaValues(rws *ReadWriteSet, ns driver2.Namespace, writes KeyedMetaWrites, block driver2.BlockNum, indexInBloc driver2.TxNum) (map[driver2.PKey]driver2.VersionedMetadataValue, error)
func (*BlockTxIndexVersionBuilder) VersionedValues ¶
func (b *BlockTxIndexVersionBuilder) VersionedValues(rws *ReadWriteSet, ns driver2.Namespace, writes NamespaceWrites, block driver2.BlockNum, indexInBloc driver2.TxNum) (map[driver2.PKey]VersionedValue, error)
type BlockTxIndexVersionComparator ¶
type BlockTxIndexVersionComparator struct{}
func (*BlockTxIndexVersionComparator) Equal ¶
func (b *BlockTxIndexVersionComparator) Equal(a, c driver2.RawVersion) bool
type BlockTxIndexVersionMarshaller ¶
type BlockTxIndexVersionMarshaller struct{}
type Inspector ¶
type Inspector struct {
Rws ReadWriteSet
}
func (*Inspector) AppendRWSet ¶
func (*Inspector) DeleteState ¶
func (*Inspector) GetDirectState ¶
func (*Inspector) GetReadKeyAt ¶
func (*Inspector) GetStateMetadata ¶
func (*Inspector) GetWriteAt ¶
func (*Inspector) Namespaces ¶
func (*Inspector) SetStateMetadata ¶
type Interceptor ¶
type Interceptor[V driver.ValidationCode] struct { Logger Logger QE VersionedQueryExecutor TxIDStore TXIDStoreReader[V] Rws ReadWriteSet Marshaller Marshaller VersionComparator VersionComparator Closed bool TxID string sync.RWMutex // contains filtered or unexported fields }
func NewInterceptor ¶
func NewInterceptor[V driver.ValidationCode]( logger Logger, rwSet ReadWriteSet, qe VersionedQueryExecutor, txIDStore TXIDStoreReader[V], txID driver.TxID, vcProvider driver.ValidationCodeProvider[V], marshaller Marshaller, versionComparator VersionComparator, ) *Interceptor[V]
func (*Interceptor[V]) AppendRWSet ¶
func (i *Interceptor[V]) AppendRWSet(raw []byte, nss ...string) error
func (*Interceptor[V]) Bytes ¶
func (i *Interceptor[V]) Bytes() ([]byte, error)
func (*Interceptor[V]) Clear ¶
func (i *Interceptor[V]) Clear(ns string) error
func (*Interceptor[V]) DeleteState ¶
func (i *Interceptor[V]) DeleteState(namespace string, key string) error
func (*Interceptor[V]) Done ¶
func (i *Interceptor[V]) Done()
func (*Interceptor[V]) Equals ¶
func (i *Interceptor[V]) Equals(other interface{}, nss ...string) error
func (*Interceptor[V]) GetDirectState ¶
func (*Interceptor[V]) GetReadKeyAt ¶
func (i *Interceptor[V]) GetReadKeyAt(ns string, pos int) (string, error)
func (*Interceptor[V]) GetState ¶
func (i *Interceptor[V]) GetState(namespace driver.Namespace, key driver.PKey, opts ...driver.GetStateOpt) ([]byte, error)
func (*Interceptor[V]) GetStateMetadata ¶
func (i *Interceptor[V]) GetStateMetadata(namespace, key string, opts ...driver.GetStateOpt) (map[string][]byte, error)
func (*Interceptor[V]) GetWriteAt ¶
func (*Interceptor[V]) IsClosed ¶
func (i *Interceptor[V]) IsClosed() bool
func (*Interceptor[V]) IsValid ¶
func (i *Interceptor[V]) IsValid() error
func (*Interceptor[V]) Namespaces ¶
func (i *Interceptor[V]) Namespaces() []string
func (*Interceptor[V]) NumReads ¶
func (i *Interceptor[V]) NumReads(ns string) int
func (*Interceptor[V]) NumWrites ¶
func (i *Interceptor[V]) NumWrites(ns string) int
func (*Interceptor[V]) RWs ¶
func (i *Interceptor[V]) RWs() *ReadWriteSet
func (*Interceptor[V]) Reopen ¶
func (i *Interceptor[V]) Reopen(qe VersionedQueryExecutor) error
func (*Interceptor[V]) SetState ¶
func (i *Interceptor[V]) SetState(namespace string, key string, value []byte) error
func (*Interceptor[V]) SetStateMetadata ¶
type KeyedMetaWrites ¶
type KeyedMetaWrites map[string]MetaWrites
func (KeyedMetaWrites) Equals ¶
func (r KeyedMetaWrites) Equals(o KeyedMetaWrites) error
type Marshaller ¶
type Marshaller interface { Marshal(txID string, rws *ReadWriteSet) ([]byte, error) Append(destination *ReadWriteSet, raw []byte, nss ...string) error }
type MetaWriteSet ¶
type MetaWriteSet struct {
MetaWrites NamespaceKeyedMetaWrites
}
func (*MetaWriteSet) Clear ¶
func (w *MetaWriteSet) Clear(ns string)
func (*MetaWriteSet) In ¶
func (w *MetaWriteSet) In(ns, key string) bool
type MetaWrites ¶
type Metrics ¶
type Metrics struct { CommitDuration metrics.Histogram BatchedCommitDuration metrics.Histogram Vault trace.Tracer }
func NewMetrics ¶
func NewMetrics(m metrics.Provider, p trace.TracerProvider) *Metrics
type NamespaceKeyedMetaWrites ¶
type NamespaceKeyedMetaWrites map[driver.Namespace]KeyedMetaWrites
func (NamespaceKeyedMetaWrites) Equals ¶
func (r NamespaceKeyedMetaWrites) Equals(o NamespaceKeyedMetaWrites, nss ...string) error
type NamespaceReads ¶
func (NamespaceReads) Equals ¶
func (r NamespaceReads) Equals(o NamespaceReads) error
type NamespaceWrites ¶
func (NamespaceWrites) Equals ¶
func (r NamespaceWrites) Equals(o NamespaceWrites) error
func (NamespaceWrites) Keys ¶
func (r NamespaceWrites) Keys() []string
type NewInterceptorFunc ¶
type NewInterceptorFunc[V driver.ValidationCode] func(logger Logger, rwSet ReadWriteSet, qe VersionedQueryExecutor, txidStore TXIDStoreReader[V], txid driver.TxID) TxInterceptor
type Populator ¶
type Populator interface {
Populate(rwsetBytes []byte, namespaces ...driver.Namespace) (ReadWriteSet, error)
}
type QueryExecutor ¶
type QueryExecutor = dbdriver.QueryExecutor
type ReadWriteSet ¶
type ReadWriteSet struct { ReadSet WriteSet MetaWriteSet }
func EmptyRWSet ¶
func EmptyRWSet() ReadWriteSet
type Reads ¶
type Reads map[driver.Namespace]NamespaceReads
type TXIDStoreReader ¶
type TxInterceptor ¶
type TxInterceptor interface { driver.RWSet RWs() *ReadWriteSet Reopen(qe VersionedQueryExecutor) error }
type VCProvider ¶
type VCProvider struct{}
func (*VCProvider) Busy ¶
func (p *VCProvider) Busy() ValidationCode
func (*VCProvider) FromInt32 ¶
func (p *VCProvider) FromInt32(code int32) ValidationCode
func (*VCProvider) Invalid ¶
func (p *VCProvider) Invalid() ValidationCode
func (*VCProvider) NotFound ¶
func (p *VCProvider) NotFound() ValidationCode
func (*VCProvider) ToInt32 ¶
func (p *VCProvider) ToInt32(code ValidationCode) int32
func (*VCProvider) Unknown ¶
func (p *VCProvider) Unknown() ValidationCode
func (*VCProvider) Valid ¶
func (p *VCProvider) Valid() ValidationCode
type ValidationCode ¶
type ValidationCode = int
type Vault ¶
type Vault[V driver.ValidationCode] struct { Interceptors map[driver.TxID]TxInterceptor // contains filtered or unexported fields }
Vault models a key-value Store that can be modified by committing rwsets
func New ¶
func New[V driver.ValidationCode]( logger Logger, store VersionedPersistence, txIDStore TXIDStore[V], vcProvider driver.ValidationCodeProvider[V], newInterceptor NewInterceptorFunc[V], populator Populator, metricsProvider metrics.Provider, tracerProvider trace.TracerProvider, versionBuilder VersionBuilder, ) *Vault[V]
New returns a new instance of Vault
func (*Vault[V]) GetExistingRWSet ¶
func (*Vault[V]) InspectRWSet ¶
func (*Vault[V]) NewInspector ¶
func (db *Vault[V]) NewInspector(txID driver.TxID) (TxInterceptor, error)
func (*Vault[V]) NewQueryExecutor ¶
func (db *Vault[V]) NewQueryExecutor() (QueryExecutor, error)
func (*Vault[V]) SetDiscarded ¶
func (*Vault[V]) UnmapInterceptor ¶
func (db *Vault[V]) UnmapInterceptor(txID driver.TxID) (TxInterceptor, error)
type Version ¶
type Version = driver.RawVersion
type VersionBuilder ¶
type VersionBuilder interface { VersionedValues(rws *ReadWriteSet, ns driver.Namespace, writes NamespaceWrites, block driver.BlockNum, indexInBloc driver.TxNum) (map[driver.PKey]VersionedValue, error) VersionedMetaValues(rws *ReadWriteSet, ns driver.Namespace, writes KeyedMetaWrites, block driver.BlockNum, indexInBloc driver.TxNum) (map[driver.PKey]driver.VersionedMetadataValue, error) }
type VersionComparator ¶
type VersionComparator interface {
Equal(v1, v2 driver.RawVersion) bool
}
type VersionedMetadataValue ¶
type VersionedMetadataValue = dbdriver.VersionedMetadataValue
type VersionedPersistence ¶
type VersionedPersistence = dbdriver.VersionedPersistence
type VersionedQueryExecutor ¶
type VersionedQueryExecutor interface { GetStateMetadata(namespace, key string) (driver.Metadata, driver.RawVersion, error) GetState(namespace, key string) (VersionedValue, error) Done() }
type VersionedRead ¶
type VersionedRead = dbdriver.VersionedRead
type VersionedResultsIterator ¶
type VersionedResultsIterator = dbdriver.VersionedResultsIterator
type VersionedValue ¶
type VersionedValue = dbdriver.VersionedValue
Source Files ¶
Click to show internal directories.
Click to hide internal directories.