Documentation
¶
Index ¶
- type CommitTimestamp
- type MetadataStoreSqlite
- func (d *MetadataStoreSqlite) AddUtxos(utxos []types.UtxoSlot, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) AutoMigrate(dst ...any) error
- func (d *MetadataStoreSqlite) Close() error
- func (d *MetadataStoreSqlite) Create(value any) *gorm.DB
- func (d *MetadataStoreSqlite) DB() *gorm.DB
- func (d *MetadataStoreSqlite) DeleteBlockNoncesBeforeSlot(slotNumber uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) DeleteBlockNoncesBeforeSlotWithoutCheckpoints(slotNumber uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) DeleteUtxo(utxo any, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) DeleteUtxos(utxos []any, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) DeleteUtxosAfterSlot(slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) First(args any) *gorm.DB
- func (d *MetadataStoreSqlite) GetAccount(stakeKey []byte, txn *gorm.DB) (models.Account, error)
- func (d *MetadataStoreSqlite) GetBlockNonce(blockHash []byte, slotNumber uint64, txn *gorm.DB) ([]byte, error)
- func (d *MetadataStoreSqlite) GetCommitTimestamp() (int64, error)
- func (d *MetadataStoreSqlite) GetDatum(hash lcommon.Blake2b256, txn *gorm.DB) (models.Datum, error)
- func (d *MetadataStoreSqlite) GetDrep(cred []byte, txn *gorm.DB) (models.Drep, error)
- func (d *MetadataStoreSqlite) GetEpochLatest(txn *gorm.DB) (models.Epoch, error)
- func (d *MetadataStoreSqlite) GetEpochs(txn *gorm.DB) ([]models.Epoch, error)
- func (d *MetadataStoreSqlite) GetEpochsByEra(eraId uint, txn *gorm.DB) ([]models.Epoch, error)
- func (d *MetadataStoreSqlite) GetPParamUpdates(epoch uint64, txn *gorm.DB) ([]models.PParamUpdate, error)
- func (d *MetadataStoreSqlite) GetPParams(epoch uint64, txn *gorm.DB) ([]models.PParams, error)
- func (d *MetadataStoreSqlite) GetPool(pkh []byte, txn *gorm.DB) (models.Pool, error)
- func (d *MetadataStoreSqlite) GetPoolRegistrations(pkh lcommon.PoolKeyHash, txn *gorm.DB) ([]lcommon.PoolRegistrationCertificate, error)
- func (d *MetadataStoreSqlite) GetStakeRegistrations(stakingKey []byte, txn *gorm.DB) ([]lcommon.StakeRegistrationCertificate, error)
- func (d *MetadataStoreSqlite) GetTip(txn *gorm.DB) (ocommon.Tip, error)
- func (d *MetadataStoreSqlite) GetUtxo(txId []byte, idx uint32, txn *gorm.DB) (models.Utxo, error)
- func (d *MetadataStoreSqlite) GetUtxosAddedAfterSlot(slot uint64, txn *gorm.DB) ([]models.Utxo, error)
- func (d *MetadataStoreSqlite) GetUtxosByAddress(addr ledger.Address, txn *gorm.DB) ([]models.Utxo, error)
- func (d *MetadataStoreSqlite) GetUtxosDeletedBeforeSlot(slot uint64, limit int, txn *gorm.DB) ([]models.Utxo, error)
- func (d *MetadataStoreSqlite) Order(args any) *gorm.DB
- func (d *MetadataStoreSqlite) SetAccount(stakeKey, pkh, drep []byte, slot uint64, active bool, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetBlockNonce(blockHash []byte, slotNumber uint64, nonce []byte, isCheckpoint bool, ...) error
- func (d *MetadataStoreSqlite) SetCommitTimestamp(txn *gorm.DB, timestamp int64) error
- func (d *MetadataStoreSqlite) SetDatum(hash lcommon.Blake2b256, rawDatum []byte, addedSlot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetDeregistration(cert *lcommon.DeregistrationCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetDeregistrationDrep(cert *lcommon.DeregistrationDrepCertificate, slot, deposit uint64, ...) error
- func (d *MetadataStoreSqlite) SetDrep(cred []byte, slot uint64, url string, hash []byte, active bool, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetEpoch(slot, epoch uint64, nonce []byte, era, slotLength, lengthInSlots uint, ...) error
- func (d *MetadataStoreSqlite) SetPParamUpdate(genesis, update []byte, slot, epoch uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetPParams(params []byte, slot, epoch uint64, eraId uint, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetPoolRegistration(cert *lcommon.PoolRegistrationCertificate, slot, deposit uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetPoolRetirement(cert *lcommon.PoolRetirementCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetRegistration(cert *lcommon.RegistrationCertificate, slot, deposit uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetRegistrationDrep(cert *lcommon.RegistrationDrepCertificate, slot, deposit uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetStakeDelegation(cert *lcommon.StakeDelegationCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetStakeDeregistration(cert *lcommon.StakeDeregistrationCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetStakeRegistration(cert *lcommon.StakeRegistrationCertificate, slot, deposit uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetStakeRegistrationDelegation(cert *lcommon.StakeRegistrationDelegationCertificate, slot, deposit uint64, ...) error
- func (d *MetadataStoreSqlite) SetStakeVoteDelegation(cert *lcommon.StakeVoteDelegationCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetStakeVoteRegistrationDelegation(cert *lcommon.StakeVoteRegistrationDelegationCertificate, slot, deposit uint64, ...) error
- func (d *MetadataStoreSqlite) SetTip(tip ochainsync.Tip, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetUpdateDrep(cert *lcommon.UpdateDrepCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetUtxo(txId []byte, idx uint32, slot uint64, payment []byte, stake []byte, ...) error
- func (d *MetadataStoreSqlite) SetUtxoDeletedAtSlot(utxoId ledger.TransactionInput, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetUtxosNotDeletedAfterSlot(slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetVoteDelegation(cert *lcommon.VoteDelegationCertificate, slot uint64, txn *gorm.DB) error
- func (d *MetadataStoreSqlite) SetVoteRegistrationDelegation(cert *lcommon.VoteRegistrationDelegationCertificate, slot, deposit uint64, ...) error
- func (d *MetadataStoreSqlite) Transaction() *gorm.DB
- func (d *MetadataStoreSqlite) Where(query any, args ...any) *gorm.DB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommitTimestamp ¶ added in v0.4.0
CommitTimestamp represents the sqlite table used to track the current commit timestamp
func (CommitTimestamp) TableName ¶ added in v0.4.0
func (CommitTimestamp) TableName() string
type MetadataStoreSqlite ¶ added in v0.4.0
type MetadataStoreSqlite struct {
// contains filtered or unexported fields
}
MetadataStoreSqlite stores all data in sqlite. Data may not be persisted
func New ¶
func New( dataDir string, logger *slog.Logger, promRegistry prometheus.Registerer, ) (*MetadataStoreSqlite, error)
New creates a new database
func (*MetadataStoreSqlite) AutoMigrate ¶ added in v0.4.0
func (d *MetadataStoreSqlite) AutoMigrate(dst ...any) error
AutoMigrate wraps the gorm AutoMigrate
func (*MetadataStoreSqlite) Close ¶ added in v0.4.0
func (d *MetadataStoreSqlite) Close() error
Close gets the database handle from our MetadataStore and closes it
func (*MetadataStoreSqlite) Create ¶ added in v0.4.0
func (d *MetadataStoreSqlite) Create(value any) *gorm.DB
Create creates a record
func (*MetadataStoreSqlite) DB ¶ added in v0.4.0
func (d *MetadataStoreSqlite) DB() *gorm.DB
DB returns the database handle
func (*MetadataStoreSqlite) DeleteBlockNoncesBeforeSlot ¶ added in v0.11.0
func (d *MetadataStoreSqlite) DeleteBlockNoncesBeforeSlot( slotNumber uint64, txn *gorm.DB, ) error
DeleteBlockNoncesBeforeSlot deletes block_nonce records with slot_number less than the specified value
func (*MetadataStoreSqlite) DeleteBlockNoncesBeforeSlotWithoutCheckpoints ¶ added in v0.11.0
func (d *MetadataStoreSqlite) DeleteBlockNoncesBeforeSlotWithoutCheckpoints( slotNumber uint64, txn *gorm.DB, ) error
DeleteBlockNoncesBeforeSlotWithoutCheckpoints deletes block_nonce records with slot_number < given value AND is_checkpoint = false
func (*MetadataStoreSqlite) DeleteUtxo ¶ added in v0.4.2
func (d *MetadataStoreSqlite) DeleteUtxo( utxo any, txn *gorm.DB, ) error
func (*MetadataStoreSqlite) DeleteUtxos ¶ added in v0.4.2
func (d *MetadataStoreSqlite) DeleteUtxos( utxos []any, txn *gorm.DB, ) error
func (*MetadataStoreSqlite) DeleteUtxosAfterSlot ¶ added in v0.4.4
func (d *MetadataStoreSqlite) DeleteUtxosAfterSlot( slot uint64, txn *gorm.DB, ) error
func (*MetadataStoreSqlite) First ¶ added in v0.4.0
func (d *MetadataStoreSqlite) First(args any) *gorm.DB
First returns the first DB entry
func (*MetadataStoreSqlite) GetAccount ¶ added in v0.6.0
GetAccount gets an account
func (*MetadataStoreSqlite) GetBlockNonce ¶ added in v0.11.0
func (d *MetadataStoreSqlite) GetBlockNonce( blockHash []byte, slotNumber uint64, txn *gorm.DB, ) ([]byte, error)
GetBlockNonce retrieves the block nonce for a specific block
func (*MetadataStoreSqlite) GetCommitTimestamp ¶ added in v0.4.0
func (d *MetadataStoreSqlite) GetCommitTimestamp() (int64, error)
func (*MetadataStoreSqlite) GetDatum ¶ added in v0.9.0
func (d *MetadataStoreSqlite) GetDatum( hash lcommon.Blake2b256, txn *gorm.DB, ) (models.Datum, error)
GetDatum returns a datum by its hash
func (*MetadataStoreSqlite) GetEpochLatest ¶ added in v0.4.2
GetEpochLatest returns the latest epoch
func (*MetadataStoreSqlite) GetEpochsByEra ¶ added in v0.4.3
GetEpochsByEra returns the list of epochs by era
func (*MetadataStoreSqlite) GetPParamUpdates ¶ added in v0.4.2
func (d *MetadataStoreSqlite) GetPParamUpdates( epoch uint64, txn *gorm.DB, ) ([]models.PParamUpdate, error)
GetPParamUpdates returns a list of protocol parameter updates for a given epoch
func (*MetadataStoreSqlite) GetPParams ¶ added in v0.4.2
GetPParams returns a list of protocol parameters for a given epoch. If there are no pparams for the specified epoch, it will return the most recent pparams before the specified epoch
func (*MetadataStoreSqlite) GetPoolRegistrations ¶ added in v0.4.2
func (d *MetadataStoreSqlite) GetPoolRegistrations( pkh lcommon.PoolKeyHash, txn *gorm.DB, ) ([]lcommon.PoolRegistrationCertificate, error)
GetPoolRegistrations returns pool registration certificates
func (*MetadataStoreSqlite) GetStakeRegistrations ¶ added in v0.4.2
func (d *MetadataStoreSqlite) GetStakeRegistrations( stakingKey []byte, txn *gorm.DB, ) ([]lcommon.StakeRegistrationCertificate, error)
GetStakeRegistrations returns stake registration certificates
func (*MetadataStoreSqlite) GetTip ¶ added in v0.4.2
GetTip returns the current metadata Tip as ocommon.Tip
func (*MetadataStoreSqlite) GetUtxo ¶ added in v0.4.2
func (d *MetadataStoreSqlite) GetUtxo( txId []byte, idx uint32, txn *gorm.DB, ) (models.Utxo, error)
GetUtxo returns a Utxo by reference
func (*MetadataStoreSqlite) GetUtxosAddedAfterSlot ¶ added in v0.4.3
func (d *MetadataStoreSqlite) GetUtxosAddedAfterSlot( slot uint64, txn *gorm.DB, ) ([]models.Utxo, error)
GetUtxosAddedAfterSlot returns a list of Utxos added after a given slot
func (*MetadataStoreSqlite) GetUtxosByAddress ¶ added in v0.4.2
func (d *MetadataStoreSqlite) GetUtxosByAddress( addr ledger.Address, txn *gorm.DB, ) ([]models.Utxo, error)
GetUtxosByAddress returns a list of Utxos
func (*MetadataStoreSqlite) GetUtxosDeletedBeforeSlot ¶ added in v0.4.3
func (d *MetadataStoreSqlite) GetUtxosDeletedBeforeSlot( slot uint64, limit int, txn *gorm.DB, ) ([]models.Utxo, error)
GetUtxosDeletedBeforeSlot returns a list of Utxos marked as deleted before a given slot
func (*MetadataStoreSqlite) Order ¶ added in v0.4.0
func (d *MetadataStoreSqlite) Order(args any) *gorm.DB
Order orders a DB query
func (*MetadataStoreSqlite) SetAccount ¶ added in v0.6.0
func (d *MetadataStoreSqlite) SetAccount( stakeKey, pkh, drep []byte, slot uint64, active bool, txn *gorm.DB, ) error
SetAccount saves an account
func (*MetadataStoreSqlite) SetBlockNonce ¶ added in v0.11.0
func (d *MetadataStoreSqlite) SetBlockNonce( blockHash []byte, slotNumber uint64, nonce []byte, isCheckpoint bool, txn *gorm.DB, ) error
SetBlockNonce inserts a block nonce into the block_nonce table
func (*MetadataStoreSqlite) SetCommitTimestamp ¶ added in v0.4.0
func (d *MetadataStoreSqlite) SetCommitTimestamp( txn *gorm.DB, timestamp int64, ) error
func (*MetadataStoreSqlite) SetDatum ¶ added in v0.9.0
func (d *MetadataStoreSqlite) SetDatum( hash lcommon.Blake2b256, rawDatum []byte, addedSlot uint64, txn *gorm.DB, ) error
SetDatum saves a datum into the database, or updates it if it already exists
func (*MetadataStoreSqlite) SetDeregistration ¶ added in v0.6.0
func (d *MetadataStoreSqlite) SetDeregistration( cert *lcommon.DeregistrationCertificate, slot uint64, txn *gorm.DB, ) error
SetDeregistration saves a deregistration certificate
func (*MetadataStoreSqlite) SetDeregistrationDrep ¶ added in v0.7.0
func (d *MetadataStoreSqlite) SetDeregistrationDrep( cert *lcommon.DeregistrationDrepCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetDeregistrationDrep saves a deregistration drep certificate and drep
func (*MetadataStoreSqlite) SetDrep ¶ added in v0.7.0
func (d *MetadataStoreSqlite) SetDrep( cred []byte, slot uint64, url string, hash []byte, active bool, txn *gorm.DB, ) error
SetDrep saves a drep
func (*MetadataStoreSqlite) SetEpoch ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetEpoch( slot, epoch uint64, nonce []byte, era, slotLength, lengthInSlots uint, txn *gorm.DB, ) error
SetEpoch saves an epoch
func (*MetadataStoreSqlite) SetPParamUpdate ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetPParamUpdate( genesis, update []byte, slot, epoch uint64, txn *gorm.DB, ) error
SetPParamUpdate saves a protocol parameter update
func (*MetadataStoreSqlite) SetPParams ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetPParams( params []byte, slot, epoch uint64, eraId uint, txn *gorm.DB, ) error
SetPParams saves protocol parameters
func (*MetadataStoreSqlite) SetPoolRegistration ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetPoolRegistration( cert *lcommon.PoolRegistrationCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetPoolRegistration saves a pool registration certificate and pool
func (*MetadataStoreSqlite) SetPoolRetirement ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetPoolRetirement( cert *lcommon.PoolRetirementCertificate, slot uint64, txn *gorm.DB, ) error
SetPoolRetirement saves a pool retirement certificate
func (*MetadataStoreSqlite) SetRegistration ¶ added in v0.5.0
func (d *MetadataStoreSqlite) SetRegistration( cert *lcommon.RegistrationCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetRegistration saves a registration certificate and account
func (*MetadataStoreSqlite) SetRegistrationDrep ¶ added in v0.7.0
func (d *MetadataStoreSqlite) SetRegistrationDrep( cert *lcommon.RegistrationDrepCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetRegistrationDrep saves a registration drep certificate and drep
func (*MetadataStoreSqlite) SetStakeDelegation ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetStakeDelegation( cert *lcommon.StakeDelegationCertificate, slot uint64, txn *gorm.DB, ) error
SetStakeDelegation saves a stake delegation certificate
func (*MetadataStoreSqlite) SetStakeDeregistration ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetStakeDeregistration( cert *lcommon.StakeDeregistrationCertificate, slot uint64, txn *gorm.DB, ) error
SetStakeDeregistration saves a stake deregistration certificate
func (*MetadataStoreSqlite) SetStakeRegistration ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetStakeRegistration( cert *lcommon.StakeRegistrationCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetStakeRegistration saves a stake registration certificate and account
func (*MetadataStoreSqlite) SetStakeRegistrationDelegation ¶ added in v0.7.0
func (d *MetadataStoreSqlite) SetStakeRegistrationDelegation( cert *lcommon.StakeRegistrationDelegationCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetStakeRegistrationDelegation saves a stake registration delegation certificate and account
func (*MetadataStoreSqlite) SetStakeVoteDelegation ¶ added in v0.10.0
func (d *MetadataStoreSqlite) SetStakeVoteDelegation( cert *lcommon.StakeVoteDelegationCertificate, slot uint64, txn *gorm.DB, ) error
SetStakeVoteDelegation saves a stake and vote delegation certificate
func (*MetadataStoreSqlite) SetStakeVoteRegistrationDelegation ¶ added in v0.7.0
func (d *MetadataStoreSqlite) SetStakeVoteRegistrationDelegation( cert *lcommon.StakeVoteRegistrationDelegationCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetStakeVoteRegistrationDelegation saves a stake vote registration delegation certificate and account
func (*MetadataStoreSqlite) SetTip ¶ added in v0.4.2
func (d *MetadataStoreSqlite) SetTip( tip ochainsync.Tip, txn *gorm.DB, ) error
SetTip saves a tip
func (*MetadataStoreSqlite) SetUpdateDrep ¶ added in v0.10.0
func (d *MetadataStoreSqlite) SetUpdateDrep( cert *lcommon.UpdateDrepCertificate, slot uint64, txn *gorm.DB, ) error
SetUpdateDrep saves an update drep certificate and updates the Dreps anchor fields
func (*MetadataStoreSqlite) SetUtxo ¶ added in v0.4.4
func (d *MetadataStoreSqlite) SetUtxo( txId []byte, idx uint32, slot uint64, payment []byte, stake []byte, txn *gorm.DB, ) error
SetUtxo saves a UTxO
func (*MetadataStoreSqlite) SetUtxoDeletedAtSlot ¶ added in v0.4.4
func (d *MetadataStoreSqlite) SetUtxoDeletedAtSlot( utxoId ledger.TransactionInput, slot uint64, txn *gorm.DB, ) error
SetUtxoDeletedAtSlot marks a UTxO as deleted at a given slot
func (*MetadataStoreSqlite) SetUtxosNotDeletedAfterSlot ¶ added in v0.4.3
func (d *MetadataStoreSqlite) SetUtxosNotDeletedAfterSlot( slot uint64, txn *gorm.DB, ) error
SetUtxosNotDeletedAfterSlot marks a list of Utxos as not deleted after a given slot
func (*MetadataStoreSqlite) SetVoteDelegation ¶ added in v0.10.0
func (d *MetadataStoreSqlite) SetVoteDelegation( cert *lcommon.VoteDelegationCertificate, slot uint64, txn *gorm.DB, ) error
SetVoteDelegation saves a vote-only delegation certificate and updates the account.
func (*MetadataStoreSqlite) SetVoteRegistrationDelegation ¶ added in v0.7.0
func (d *MetadataStoreSqlite) SetVoteRegistrationDelegation( cert *lcommon.VoteRegistrationDelegationCertificate, slot, deposit uint64, txn *gorm.DB, ) error
SetVoteRegistrationDelegation saves a vote registration delegation certificate and account
func (*MetadataStoreSqlite) Transaction ¶ added in v0.4.0
func (d *MetadataStoreSqlite) Transaction() *gorm.DB
Transaction creates a gorm transaction