Documentation
¶
Index ¶
- Constants
- func NewNamedDriver(config driver.Config, dbProvider sqlite.DbProvider) fdbdriver.NamedDriver
- func NewPersistenceWithOpts[V drivercommon.DBObject](cfg *sqlite.ConfigProvider, dbProvider sqlite.DbProvider, ...) (V, error)
- type Driver
- func (d *Driver) NewEndorseTx(name driver.PersistenceName, params ...string) (fdbdriver.EndorseTxStore, error)
- func (d *Driver) NewEnvelope(name driver.PersistenceName, params ...string) (fdbdriver.EnvelopeStore, error)
- func (d *Driver) NewMetadata(name driver.PersistenceName, params ...string) (fdbdriver.MetadataStore, error)
- func (d *Driver) NewVault(name driver.PersistenceName, params ...string) (cdriver.VaultStore, error)
- type EndorseTxStore
- type EnvelopeStore
- type MetadataStore
- type VaultStore
Constants ¶
const (
Persistence cdriver.PersistenceType = "sqlite"
)
Variables ¶
This section is empty.
Functions ¶
func NewNamedDriver ¶
func NewNamedDriver(config driver.Config, dbProvider sqlite.DbProvider) fdbdriver.NamedDriver
func NewPersistenceWithOpts ¶
func NewPersistenceWithOpts[V drivercommon.DBObject](cfg *sqlite.ConfigProvider, dbProvider sqlite.DbProvider, name driver.PersistenceName, constructor fsqlcommon.PersistenceConstructor[V], params ...string) (V, error)
NewPersistenceWithOpts constructs a V backed by the sqlite persistence configured under name and params: it resolves the connection options and table names, opens the database, and invokes constructor to build the store, preparing its schema with migrate.CreateSchema. With skipCreateTable it runs no schema step and fails with migrate.ErrPending if the store has steps pending.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func NewDriverWithDbProvider ¶
func NewDriverWithDbProvider(config driver.Config, dbProvider sqlite.DbProvider) *Driver
func (*Driver) NewEndorseTx ¶
func (d *Driver) NewEndorseTx(name driver.PersistenceName, params ...string) (fdbdriver.EndorseTxStore, error)
func (*Driver) NewEnvelope ¶
func (d *Driver) NewEnvelope(name driver.PersistenceName, params ...string) (fdbdriver.EnvelopeStore, error)
func (*Driver) NewMetadata ¶
func (d *Driver) NewMetadata(name driver.PersistenceName, params ...string) (fdbdriver.MetadataStore, error)
func (*Driver) NewVault ¶
func (d *Driver) NewVault(name driver.PersistenceName, params ...string) (cdriver.VaultStore, error)
type EndorseTxStore ¶
type EndorseTxStore struct {
*common.EndorseTxStore
}
func NewEndorseTxStore ¶
func NewEndorseTxStore(dbs *drivercommon.RWDB, tables common.TableNames) (*EndorseTxStore, error)
type EnvelopeStore ¶
type EnvelopeStore struct {
*common.EnvelopeStore
}
func NewEnvelopeStore ¶
func NewEnvelopeStore(dbs *drivercommon.RWDB, tables common.TableNames) (*EnvelopeStore, error)
type MetadataStore ¶
type MetadataStore struct {
*common.MetadataStore
}
func NewMetadataStore ¶
func NewMetadataStore(dbs *drivercommon.RWDB, tables common.TableNames) (*MetadataStore, error)
type VaultStore ¶
type VaultStore struct {
*common.VaultStore
// contains filtered or unexported fields
}
func NewVaultStore ¶
func NewVaultStore(dbs *drivercommon.RWDB, tables common.TableNames) (*VaultStore, error)
func (*VaultStore) CreateSchema ¶
func (db *VaultStore) CreateSchema() error
CreateSchema creates the status and state tables if they do not exist. The state table's primary key is (ns, pkey). A table whose primary key is (pkey, ns) is rebuilt in one transaction, copying every row. The key order is read once before that transaction, so an upgraded table is left alone, and again after a write lock, so replicas sharing the file rebuild it once.
func (*VaultStore) Steps ¶ added in v0.28.0
func (db *VaultStore) Steps() []migrate.Step
Steps returns the vault's schema steps. Step 1 creates the status and state tables if they do not exist and rebuilds a state table keyed (pkey, ns). Step 2, a contract step, rewrites gob metadata as protobuf (see common.VaultStore.MetadataToProtobuf); binaries that read only gob refuse the vault afterwards.
func (*VaultStore) Store ¶
func (db *VaultStore) Store(ctx context.Context, txIDs []driver.TxID, writes driver.Writes, metaWrites driver.MetaWrites) error
Store marks txIDs busy, upserts writes and metaWrites, and marks txIDs valid, all in one database transaction, bounded as a whole by the store's query timeout. Database errors are mapped by sqlite.ErrorMapper.
func (*VaultStore) StoreName ¶ added in v0.28.0
func (db *VaultStore) StoreName() string
StoreName returns the state table name; it identifies the vault in the versions table.