sqlite

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConditionInterpreter

func NewConditionInterpreter() common2.CondInterpreter

func NewNamedDriver

func NewNamedDriver(config driver3.Config, dbProvider fscSqlite.DbProvider) driver3.NamedDriver

func NewPaginationInterpreter

func NewPaginationInterpreter() common.PagInterpreter

Types

type AuditTransactionStore

type AuditTransactionStore = common3.TransactionStore

func NewAuditTransactionStore

func NewAuditTransactionStore(dbs *common2.RWDB, tableNames common3.TableNames) (*AuditTransactionStore, error)

type BusyRetryWriteDB added in v0.24.0

type BusyRetryWriteDB struct {
	*sql.DB
	// contains filtered or unexported fields
}

BusyRetryWriteDB decorates a SQLite write pool so that a statement rejected with SQLITE_BUSY is retried a bounded number of times instead of surfacing to the caller.

Without it, write contention beyond busy_timeout reaches Panurus as a raw SQLITE_BUSY: FSC wraps its own stores this way but nothing wrapped Panurus's, so the token, token-lock, wallet, identity, keystore, transaction and endorser stores all propagated it. That bites single-node deployments under concurrent writes, and the in-memory driver most of all - it is this driver, on file::memory:?cache=shared, where every store's write pool contends for one shared cache.

It differs from FSC's retryWriteDB in being bounded: that one recurses on every SQLITE_BUSY with no limit and no backoff, so a lock held for good turns into an unbounded retry loop growing the stack.

Only Exec and ExecContext are decorated. Begin and BeginTx are promoted from the embedded pool and hand out a raw *sql.Tx, so statements inside a transaction still see SQLITE_BUSY: replaying those means replaying the whole transaction, which only the caller can decide to do.

func NewBusyRetryWriteDB added in v0.24.0

func NewBusyRetryWriteDB(db *sql.DB) *BusyRetryWriteDB

NewBusyRetryWriteDB wraps a SQLite write pool with a bounded SQLITE_BUSY retry.

func (*BusyRetryWriteDB) Exec added in v0.24.0

func (db *BusyRetryWriteDB) Exec(query string, args ...any) (sql.Result, error)

Exec runs the statement with the retry policy, outside any context.

func (*BusyRetryWriteDB) ExecContext added in v0.24.0

func (db *BusyRetryWriteDB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

ExecContext runs the statement, retrying while SQLite reports the database as busy. It gives up on the first non-busy outcome, once maxRetries retries are spent, or as soon as ctx is done - in which case the busy error is returned rather than the context's, since that is what actually failed the statement.

type Driver

func NewDriver

func NewDriver(config driver3.Config) *Driver

func NewDriverWithDbProvider

func NewDriverWithDbProvider(config driver3.Config, dbProvider fscSqlite.DbProvider) *Driver

func (*Driver) NewAuditTransaction

func (d *Driver) NewAuditTransaction(name driver2.PersistenceName, params ...string) (driver3.AuditTransactionStore, error)

func (*Driver) NewEndorser

func (d *Driver) NewEndorser(name driver2.PersistenceName, params ...string) (driver3.EndorserStore, error)

func (*Driver) NewIdentity

func (d *Driver) NewIdentity(name driver2.PersistenceName, params ...string) (driver3.IdentityStore, error)

func (*Driver) NewKeyStore

func (d *Driver) NewKeyStore(name driver2.PersistenceName, params ...string) (driver3.KeyStore, error)

func (*Driver) NewOwnerTransaction

func (d *Driver) NewOwnerTransaction(name driver2.PersistenceName, params ...string) (driver3.TokenTransactionStore, error)

func (*Driver) NewToken

func (d *Driver) NewToken(name driver2.PersistenceName, params ...string) (driver3.TokenStore, error)

func (*Driver) NewTokenLock

func (d *Driver) NewTokenLock(name driver2.PersistenceName, params ...string) (driver3.TokenLockStore, error)

func (*Driver) NewWallet

func (d *Driver) NewWallet(name driver2.PersistenceName, params ...string) (driver3.WalletStore, error)

type EndorserStore

type EndorserStore = common.EndorserStore

func NewEndorserStore

func NewEndorserStore(dbs *common2.RWDB, tables common.TableNames) (*EndorserStore, error)

NewEndorserStore creates a new EndorserStore for SQLite

type IdentityStore

type IdentityStore = sqlcommon.IdentityStore

type KeystoreStore

type KeystoreStore = common3.KeystoreStore

func NewKeystoreStore

func NewKeystoreStore(dbs *common2.RWDB, tableNames common3.TableNames) (*KeystoreStore, error)

type OwnerTransactionStore

type OwnerTransactionStore = common3.TransactionStore

func NewTransactionStore

func NewTransactionStore(dbs *common2.RWDB, tableNames common3.TableNames) (*OwnerTransactionStore, error)

type TokenLockStore

type TokenLockStore struct {
	*common4.TokenLockStore
}

TokenLockStore implements the token lock storage for SQLite. Cleanup is inherited from the embedded store, so lease expiry is identical to the other SQL backends.

func NewTokenLockStore

func NewTokenLockStore(dbs *common3.RWDB, tableNames common4.TableNames) (*TokenLockStore, error)

NewTokenLockStore returns a new TokenLockStore for the given RWDB and table names.

func (*TokenLockStore) AcquireCleanupLeadership added in v0.17.0

func (db *TokenLockStore) AcquireCleanupLeadership(_ context.Context) (driver.CleanupLeadership, bool, error)

AcquireCleanupLeadership always grants leadership locally - sqlite is a non-distributed backend with only one instance, so there is nothing to coordinate. See #1798.

type TokenStore

type TokenStore = sqlcommon.TokenStore

func NewTokenStore

func NewTokenStore(
	dbs *scommon.RWDB,
	tableNames sqlcommon.TableNames,
) (*TokenStore, error)

type WalletStore

type WalletStore = common3.WalletStore

func NewWalletStore

func NewWalletStore(dbs *common2.RWDB, tableNames common3.TableNames) (*WalletStore, error)

Jump to

Keyboard shortcuts

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