Documentation
¶
Index ¶
- Variables
- func BlockBlobHeightKey(blockNumber uint64) []byte
- func BlockBlobKey(slot uint64, hash []byte) []byte
- func BlockBlobKeyHashHex(slot uint64, hashHex string) ([]byte, error)
- func BlockBlobMetadataKey(baseKey []byte) []byte
- func BlockCreateTxn(txn *Txn, block Block) error
- func BlockDeleteTxn(txn *Txn, block Block) error
- func GetTip(db *Database) (ochainsync.Tip, error)
- func SetTip(db *Database, tip ochainsync.Tip) error
- func UtxoBlobKey(txId []byte, outputIdx uint32) []byte
- func UtxoDelete(db *Database, utxo Utxo) error
- func UtxosDelete(db *Database, utxos []Utxo) error
- func UtxosUnspend(db *Database, slot uint64) error
- type Block
- func BlockBeforeSlot(db *Database, slotNumber uint64) (Block, error)
- func BlockBeforeSlotTxn(txn *Txn, slotNumber uint64) (Block, error)
- func BlockByNumber(db *Database, blockNumber uint64) (Block, error)
- func BlockByNumberTxn(txn *Txn, blockNumber uint64) (Block, error)
- func BlockByPoint(db *Database, point ocommon.Point) (Block, error)
- func BlockByPointTxn(txn *Txn, point ocommon.Point) (Block, error)
- func BlocksAfterSlotTxn(txn *Txn, slotNumber uint64) ([]Block, error)
- func BlocksRecent(db *Database, count int) ([]Block, error)
- func BlocksRecentTxn(txn *Txn, count int) ([]Block, error)
- type BlockBlobMetadata
- type CommitTimestampError
- type Database
- func (d *Database) Blob() blob.BlobStore
- func (d *Database) BlobTxn(readWrite bool) *Txn
- func (d *Database) Close() error
- func (d *Database) DataDir() string
- func (d *Database) GetEpochLatest(txn *Txn) (Epoch, error)
- func (d *Database) GetEpochsByEra(eraId uint, txn *Txn) ([]Epoch, error)
- func (d *Database) GetPoolRegistrations(poolKeyHash lcommon.PoolKeyHash, txn *Txn) ([]lcommon.PoolRegistrationCertificate, error)
- func (d *Database) GetStakeRegistrations(stakingKey []byte, txn *Txn) ([]lcommon.StakeRegistrationCertificate, error)
- func (d *Database) GetTip(txn *Txn) (ochainsync.Tip, error)
- func (d *Database) Logger() *slog.Logger
- func (d *Database) Metadata() metadata.MetadataStore
- func (d *Database) MetadataTxn(readWrite bool) *Txn
- func (d *Database) SetEpoch(slot, epoch uint64, nonce []byte, era, slotLength, lengthInSlots uint, ...) error
- func (d *Database) SetPoolRegistration(cert *lcommon.PoolRegistrationCertificate, slot, deposit uint64, txn *Txn) error
- func (d *Database) SetPoolRetirement(cert *lcommon.PoolRetirementCertificate, slot uint64, txn *Txn) error
- func (d *Database) SetStakeDelegation(cert *lcommon.StakeDelegationCertificate, slot uint64, txn *Txn) error
- func (d *Database) SetStakeDeregistration(cert *lcommon.StakeDeregistrationCertificate, slot uint64, txn *Txn) error
- func (d *Database) SetStakeRegistration(cert *lcommon.StakeRegistrationCertificate, slot, deposit uint64, txn *Txn) error
- func (d *Database) SetTip(tip ochainsync.Tip, txn *Txn) error
- func (d *Database) Transaction(readWrite bool) *Txn
- func (d *Database) UtxoByRef(txId []byte, outputIdx uint32, txn *Txn) (Utxo, error)
- func (d *Database) UtxoDelete(utxo Utxo, txn *Txn) error
- func (d *Database) UtxosByAddress(addr ledger.Address, txn *Txn) ([]Utxo, error)
- func (d *Database) UtxosDelete(utxos []Utxo, txn *Txn) error
- func (d *Database) UtxosDeleteRolledback(slot uint64, txn *Txn) error
- func (d *Database) UtxosDeleted(slot uint64, txn *Txn) ([]Utxo, error)
- func (d *Database) UtxosUnspend(slot uint64, txn *Txn) error
- type Epoch
- type Txn
- type Utxo
Constants ¶
This section is empty.
Variables ¶
var ErrBlockNotFound = errors.New("block not found")
Functions ¶
func BlockBlobHeightKey ¶ added in v0.4.2
func BlockBlobKey ¶ added in v0.4.2
func BlockBlobKeyHashHex ¶ added in v0.4.2
func BlockBlobMetadataKey ¶ added in v0.4.2
func BlockCreateTxn ¶ added in v0.4.2
func BlockDeleteTxn ¶ added in v0.4.2
func SetTip ¶ added in v0.4.3
func SetTip(db *Database, tip ochainsync.Tip) error
SetTip saves the current tip
func UtxoBlobKey ¶ added in v0.4.2
func UtxoDelete ¶ added in v0.4.2
func UtxosDelete ¶ added in v0.4.2
func UtxosUnspend ¶ added in v0.4.3
Types ¶
type Block ¶ added in v0.4.2
type Block struct { Slot uint64 Number uint64 Hash []byte Type uint PrevHash []byte Nonce []byte Cbor []byte }
func BlockBeforeSlot ¶ added in v0.4.2
func BlockBeforeSlotTxn ¶ added in v0.4.2
func BlockByNumber ¶ added in v0.4.2
func BlockByNumberTxn ¶ added in v0.4.2
func BlockByPoint ¶ added in v0.4.2
func BlockByPointTxn ¶ added in v0.4.2
func BlocksAfterSlotTxn ¶ added in v0.4.2
type BlockBlobMetadata ¶ added in v0.4.2
type CommitTimestampError ¶
func (CommitTimestampError) Error ¶
func (e CommitTimestampError) Error() string
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func New ¶ added in v0.4.3
New creates a new database instance with optional persistence using the provided data directory
func (*Database) BlobTxn ¶ added in v0.4.3
BlobTxn starts a new blob-only database transaction and returns a handle to it
func (*Database) DataDir ¶ added in v0.4.3
DataDir returns the path to the data directory used for storage
func (*Database) GetEpochLatest ¶ added in v0.4.3
func (*Database) GetEpochsByEra ¶ added in v0.4.3
func (*Database) GetPoolRegistrations ¶ added in v0.4.3
func (d *Database) GetPoolRegistrations( poolKeyHash lcommon.PoolKeyHash, txn *Txn, ) ([]lcommon.PoolRegistrationCertificate, error)
GetPoolRegistrations returns a list of pool registration certificates
func (*Database) GetStakeRegistrations ¶ added in v0.4.3
func (d *Database) GetStakeRegistrations( stakingKey []byte, txn *Txn, ) ([]lcommon.StakeRegistrationCertificate, error)
GetStakeRegistrations returns a list of stake registration certificates
func (*Database) GetTip ¶ added in v0.4.3
func (d *Database) GetTip(txn *Txn) (ochainsync.Tip, error)
func (*Database) Metadata ¶
func (d *Database) Metadata() metadata.MetadataStore
Metadata returns the underlying metadata store instance
func (*Database) MetadataTxn ¶ added in v0.4.3
MetadataTxn starts a new metadata-only database transaction and returns a handle to it
func (*Database) SetPoolRegistration ¶ added in v0.4.3
func (d *Database) SetPoolRegistration( cert *lcommon.PoolRegistrationCertificate, slot, deposit uint64, txn *Txn, ) error
SetPoolRegistration saves a pool registration certificate
func (*Database) SetPoolRetirement ¶ added in v0.4.3
func (d *Database) SetPoolRetirement( cert *lcommon.PoolRetirementCertificate, slot uint64, txn *Txn, ) error
SetPoolRetirement saves a pool retirement certificate
func (*Database) SetStakeDelegation ¶ added in v0.4.3
func (d *Database) SetStakeDelegation( cert *lcommon.StakeDelegationCertificate, slot uint64, txn *Txn, ) error
SetStakeDelegation saves a stake delegation certificate
func (*Database) SetStakeDeregistration ¶ added in v0.4.3
func (d *Database) SetStakeDeregistration( cert *lcommon.StakeDeregistrationCertificate, slot uint64, txn *Txn, ) error
SetStakeDeregistration saves a stake deregistration certificate
func (*Database) SetStakeRegistration ¶ added in v0.4.3
func (d *Database) SetStakeRegistration( cert *lcommon.StakeRegistrationCertificate, slot, deposit uint64, txn *Txn, ) error
SetStakeRegistration saves a stake registration certificate
func (*Database) SetTip ¶ added in v0.4.3
func (d *Database) SetTip(tip ochainsync.Tip, txn *Txn) error
func (*Database) Transaction ¶
Transaction starts a new database transaction and returns a handle to it
func (*Database) UtxoDelete ¶ added in v0.4.3
func (*Database) UtxosByAddress ¶ added in v0.4.3
func (*Database) UtxosDelete ¶ added in v0.4.3
func (*Database) UtxosDeleteRolledback ¶ added in v0.4.3
func (*Database) UtxosDeleted ¶ added in v0.4.3
type Epoch ¶ added in v0.4.3
type Epoch struct { ID uint `gorm:"primarykey"` // NOTE: we would normally use this as the primary key, but GORM doesn't // like a primary key value of 0 EpochId uint64 `gorm:"uniqueIndex"` StartSlot uint64 Nonce []byte EraId uint SlotLength uint LengthInSlots uint }
func GetEpochLatest ¶ added in v0.4.3
func GetEpochsByEra ¶ added in v0.4.3
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn is a wrapper around the transaction objects for the underlying DB engines
func NewBlobOnlyTxn ¶ added in v0.4.3
func NewMetadataOnlyTxn ¶ added in v0.4.3
type Utxo ¶ added in v0.4.2
type Utxo struct { ID uint `gorm:"primarykey"` TxId []byte `gorm:"index:tx_id_output_idx"` OutputIdx uint32 `gorm:"index:tx_id_output_idx"` AddedSlot uint64 `gorm:"index"` DeletedSlot uint64 `gorm:"index"` PaymentKey []byte `gorm:"index"` StakingKey []byte `gorm:"index"` Cbor []byte `gorm:"-"` // This is not represented in the metadata DB }