common

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cases = []struct {
	Name string
	Fn   func(*testing.T, driver.KeyValueStore)
}{
	{"RangeQueries", TTestRangeQueries},
	{"SimpleReadWrite", TTestSimpleReadWrite},
	{"GetNonExistent", TTestGetNonExistent},
	{"DB1", TTestDB1},
	{"DB2", TTestDB2},
	{"RangeQueries1", TTestRangeQueries1},
	{"MultiWritesAndRangeQueries", TTestMultiWritesAndRangeQueries},
	{"TTestMultiWrites", TTestMultiWrites},
	{"CompositeKeys", TTestCompositeKeys},
}
View Source
var ErrorCases = []struct {
	Name string
	Fn   func(t *testing.T, readDB *sql.DB, writeDB common.WriteDB, errorWrapper driver.SQLErrorWrapper, table string)
}{
	{"Duplicate", TTestDuplicate},
}
View Source
var UnversionedCases = []struct {
	Name string
	Fn   func(*testing.T, driver.KeyValueStore)
}{
	{"UnversionedSimple", TTestUnversionedSimple},
	{"UnversionedRange", TTestUnversionedRange},
	{"NonUTF8keys", TTestNonUTF8keys},
}
View Source
var UnversionedNotifierCases = []struct {
	Name string
	Fn   func(*testing.T, driver.UnversionedNotifier)
}{
	{"UnversionedNotifierSimple", TTestUnversionedNotifierSimple},
}

Functions

func BenchmarkBuilder

func BenchmarkBuilder(b *testing.B)

func BenchmarkConcatenation

func BenchmarkConcatenation(b *testing.B)

func FromBytes

func FromBytes(data driver3.RawVersion) (driver3.BlockNum, driver3.TxNum, error)

func IsLast

func IsLast(tableName common4.TableName) *isLast

func TTestCompositeKeys

func TTestCompositeKeys(t *testing.T, db driver.KeyValueStore)

func TTestDB1

func TTestDB1(t *testing.T, db driver.KeyValueStore)

func TTestDB2

func TTestDB2(t *testing.T, db driver.KeyValueStore)

func TTestDuplicate

func TTestDuplicate(t *testing.T, _ *sql.DB, writeDB common.WriteDB, errorWrapper driver.SQLErrorWrapper, table string)

func TTestGetNonExistent

func TTestGetNonExistent(t *testing.T, db driver.KeyValueStore)

func TTestMultiWrites

func TTestMultiWrites(t *testing.T, db driver.KeyValueStore)

func TTestMultiWritesAndRangeQueries

func TTestMultiWritesAndRangeQueries(t *testing.T, db driver.KeyValueStore)

func TTestNonUTF8keys

func TTestNonUTF8keys(t *testing.T, db driver.KeyValueStore)

Postgres doesn't like non-utf8 in TEXT fields, so we made it a BYTEA. cannot check if key exists: pq: invalid byte sequence for encoding "UTF8": 0xc2 0x32]

func TTestRangeQueries

func TTestRangeQueries(t *testing.T, db driver.KeyValueStore)

func TTestRangeQueries1

func TTestRangeQueries1(t *testing.T, db driver.KeyValueStore)

func TTestSimpleReadWrite

func TTestSimpleReadWrite(t *testing.T, db driver.KeyValueStore)

func TTestUnversionedNotifierSimple

func TTestUnversionedNotifierSimple(t *testing.T, db driver.UnversionedNotifier)

func TTestUnversionedRange

func TTestUnversionedRange(t *testing.T, db driver.KeyValueStore)

func TTestUnversionedSimple

func TTestUnversionedSimple(t *testing.T, db driver.KeyValueStore)

func ToBytes

func ToBytes(Block driver3.BlockNum, TxNum driver3.TxNum) []byte

Types

type EndorseTxStore

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

func NewEndorseTxStore

func NewEndorseTxStore(writeDB common3.WriteDB, readDB *sql.DB, table string, errorWrapper driver.SQLErrorWrapper, ci common.CondInterpreter) *EndorseTxStore

func (*EndorseTxStore) CreateSchema

func (db *EndorseTxStore) CreateSchema() error

func (*EndorseTxStore) ExistsEndorseTx

func (db *EndorseTxStore) ExistsEndorseTx(ctx context.Context, key string) (bool, error)

func (*EndorseTxStore) GetEndorseTx

func (db *EndorseTxStore) GetEndorseTx(ctx context.Context, key string) ([]byte, error)

func (*EndorseTxStore) PutEndorseTx

func (db *EndorseTxStore) PutEndorseTx(ctx context.Context, key string, data []byte) error

type EnvelopeStore

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

func NewEnvelopeStore

func NewEnvelopeStore(writeDB common3.WriteDB, readDB *sql.DB, table string, errorWrapper driver.SQLErrorWrapper, ci common.CondInterpreter) *EnvelopeStore

func (*EnvelopeStore) CreateSchema

func (db *EnvelopeStore) CreateSchema() error

func (*EnvelopeStore) ExistsEnvelope

func (db *EnvelopeStore) ExistsEnvelope(ctx context.Context, key string) (bool, error)

func (*EnvelopeStore) GetEnvelope

func (db *EnvelopeStore) GetEnvelope(ctx context.Context, key string) ([]byte, error)

func (*EnvelopeStore) PutEnvelope

func (db *EnvelopeStore) PutEnvelope(ctx context.Context, key string, data []byte) error

type MetadataStore

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

func NewMetadataStore

func NewMetadataStore(writeDB common3.WriteDB, readDB *sql.DB, table string, errorWrapper driver.SQLErrorWrapper, ci common.CondInterpreter) *MetadataStore

func (*MetadataStore) CreateSchema

func (db *MetadataStore) CreateSchema() error

func (*MetadataStore) ExistMetadata

func (db *MetadataStore) ExistMetadata(ctx context.Context, key string) (bool, error)

func (*MetadataStore) GetMetadata

func (db *MetadataStore) GetMetadata(ctx context.Context, key string) ([]byte, error)

func (*MetadataStore) PutMetadata

func (db *MetadataStore) PutMetadata(ctx context.Context, key string, data []byte) error

type PersistenceConstructor

type PersistenceConstructor[V common.DBObject] func(*common.RWDB, TableNames) (V, error)

type Sanitizer

type Sanitizer interface {
	EncodeAll(params []common4.Param) ([]any, error)
	Encode(string) (string, error)
	Decode(string) (string, error)
}

type TableNames

type TableNames struct {
	EndorseTx string
	Metadata  string
	Envelope  string
	State     string
	Status    string
}

func GetTableNames

func GetTableNames(prefix string, params ...string) TableNames

type TracingConfig

type TracingConfig struct{}

type VaultStore

type VaultStore struct {
	GlobalLock sync.RWMutex
	// contains filtered or unexported fields
}

func NewVaultStore

func NewVaultStore(writeDB common3.WriteDB, readDB *sql.DB, tables VaultTables, errorWrapper driver2.SQLErrorWrapper, ci common4.CondInterpreter, pi common4.PagInterpreter, sanitizer sql2.Sanitizer, il common3.IsolationLevelMapper) *VaultStore

func (*VaultStore) Close

func (db *VaultStore) Close() error

func (VaultStore) GetAllStates

func (db VaultStore) GetAllStates(ctx context.Context, namespace driver.Namespace) (driver.TxStateIterator, error)

func (VaultStore) GetAllTxStatuses

func (db VaultStore) GetAllTxStatuses(ctx context.Context, p driver.Pagination) (*driver.PageIterator[*driver.TxStatus], error)

func (VaultStore) GetLast

func (db VaultStore) GetLast(ctx context.Context) (*driver.TxStatus, error)

func (VaultStore) GetState

func (db VaultStore) GetState(ctx context.Context, namespace driver.Namespace, key driver.PKey) (*driver.VaultRead, error)

func (VaultStore) GetStateMetadata

func (db VaultStore) GetStateMetadata(ctx context.Context, namespace driver.Namespace, key driver.PKey) (driver.Metadata, driver.RawVersion, error)

func (VaultStore) GetStateRange

func (db VaultStore) GetStateRange(ctx context.Context, namespace driver.Namespace, startKey, endKey driver.PKey) (driver.TxStateIterator, error)

func (VaultStore) GetStates

func (db VaultStore) GetStates(ctx context.Context, namespace driver.Namespace, keys ...driver.PKey) (driver.TxStateIterator, error)

func (VaultStore) GetTxStatus

func (db VaultStore) GetTxStatus(ctx context.Context, txID driver.TxID) (*driver.TxStatus, error)

func (VaultStore) GetTxStatuses

func (db VaultStore) GetTxStatuses(ctx context.Context, txIDs ...driver.TxID) (driver.TxStatusIterator, error)

func (*VaultStore) NewGlobalLockVaultReader

func (db *VaultStore) NewGlobalLockVaultReader(ctx context.Context) (driver.LockedVaultReader, error)

func (*VaultStore) NewTxLockVaultReader

func (db *VaultStore) NewTxLockVaultReader(ctx context.Context, txID driver.TxID, isolationLevel driver.IsolationLevel) (driver.LockedVaultReader, error)

func (*VaultStore) SetStatuses

func (db *VaultStore) SetStatuses(ctx context.Context, code driver.TxStatusCode, message string, txIDs ...driver.TxID) error

func (*VaultStore) SetStatusesBusy

func (db *VaultStore) SetStatusesBusy(txIDs []driver.TxID, sb common4.Builder)

func (*VaultStore) SetStatusesValid

func (db *VaultStore) SetStatusesValid(txIDs []driver.TxID, sb common4.Builder)

func (*VaultStore) UpsertStates

func (db *VaultStore) UpsertStates(writes driver.Writes, metaWrites driver.MetaWrites, sb common4.Builder) error

type VaultTables

type VaultTables struct {
	StateTable  string
	StatusTable string
}

Jump to

Keyboard shortcuts

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