Documentation
¶
Index ¶
- Constants
- func NewNamedDriver(config driver.Config, dbProvider postgres.DbProvider) fdbdriver.NamedDriver
- func NewPersistenceWithOpts[V drivercommon.DBObject](cfg *postgres.ConfigProvider, dbProvider postgres.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 = "postgres"
)
Variables ¶
This section is empty.
Functions ¶
func NewNamedDriver ¶
func NewNamedDriver(config driver.Config, dbProvider postgres.DbProvider) fdbdriver.NamedDriver
func NewPersistenceWithOpts ¶
func NewPersistenceWithOpts[V drivercommon.DBObject](cfg *postgres.ConfigProvider, dbProvider postgres.DbProvider, name driver.PersistenceName, constructor fsqlcommon.PersistenceConstructor[V], params ...string) (V, error)
NewPersistenceWithOpts constructs a V backed by the postgres persistence configured under name and params: it resolves the connection options and table names, opens the database, and invokes constructor to build the store, creating its schema unless configured to skip.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
func NewDriverWithDbProvider ¶
func NewDriverWithDbProvider(config driver.Config, dbProvider postgres.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 {
*fsqlcommon.VaultStore
// contains filtered or unexported fields
}
func NewVaultStore ¶
func NewVaultStore(dbs *drivercommon.RWDB, tables fsqlcommon.TableNames) (*VaultStore, error)
NewVaultStore creates a postgres-backed VaultStore for the given read/write database and table names.
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). An existing table is then brought to that layout: pkey is converted from TEXT to BYTEA when needed (see convertTextKeys), and a primary key of (pkey, ns) is reordered to (ns, pkey). Each step locks the table only when a change is required, and replicas sharing the database perform each change once.
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. Every statement is an upsert, so storing the same transactions again leaves the same rows; this makes a retry safe after a connection lost during COMMIT, when the outcome is unknown. Database errors are mapped by postgres.ErrorMapper.