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 UtxoBlobKey(txId []byte, outputIdx uint32) []byte
- func UtxoDelete(db Database, utxo Utxo) error
- func UtxosDelete(db Database, utxos []Utxo) error
- type BaseDatabase
- func (b *BaseDatabase) Blob() blob.BlobStore
- func (b *BaseDatabase) Close() error
- func (b *BaseDatabase) Metadata() metadata.MetadataStore
- func (b *BaseDatabase) Transaction(readWrite bool) *Txn
- func (d *BaseDatabase) UtxoByRef(txId []byte, outputIdx uint32, txn *Txn) (Utxo, error)
- func (d *BaseDatabase) UtxoDelete(utxo Utxo, txn *Txn) error
- func (d *BaseDatabase) UtxosByAddress(addr ledger.Address, txn *Txn) ([]Utxo, error)
- func (d *BaseDatabase) UtxosDelete(utxos []Utxo, txn *Txn) 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
- type InMemoryDatabase
- type PersistentDatabase
- type Rat
- type Txn
- type Uint64
- type Utxo
Constants ¶
This section is empty.
Variables ¶
View Source
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 UtxoBlobKey ¶ added in v0.4.2
func UtxoDelete ¶ added in v0.4.2
func UtxosDelete ¶ added in v0.4.2
Types ¶
type BaseDatabase ¶
type BaseDatabase struct {
// contains filtered or unexported fields
}
func (*BaseDatabase) Blob ¶
func (b *BaseDatabase) Blob() blob.BlobStore
Blob returns the underling blob store instance
func (*BaseDatabase) Close ¶
func (b *BaseDatabase) Close() error
Close cleans up the database connections
func (*BaseDatabase) Metadata ¶
func (b *BaseDatabase) Metadata() metadata.MetadataStore
Metadata returns the underlying metadata store instance
func (*BaseDatabase) Transaction ¶
func (b *BaseDatabase) Transaction(readWrite bool) *Txn
Transaction starts a new database transaction and returns a handle to it
func (*BaseDatabase) UtxoDelete ¶ added in v0.4.2
func (d *BaseDatabase) UtxoDelete( utxo Utxo, txn *Txn, ) error
func (*BaseDatabase) UtxosByAddress ¶ added in v0.4.2
func (*BaseDatabase) UtxosDelete ¶ added in v0.4.2
func (d *BaseDatabase) UtxosDelete( utxos []Utxo, txn *Txn, ) error
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 InMemoryDatabase ¶
type InMemoryDatabase struct {
*BaseDatabase
}
InMemoryDatabase stores all data in memory. Data will not be persisted
func NewInMemory ¶
func NewInMemory(logger *slog.Logger) (*InMemoryDatabase, error)
NewInMemory creates a new in-memory database
type PersistentDatabase ¶
type PersistentDatabase struct { *BaseDatabase // contains filtered or unexported fields }
PersistentDatabase stores its data on disk, providing persistence across restarts
func NewPersistent ¶
func NewPersistent( dataDir string, logger *slog.Logger, ) (*PersistentDatabase, error)
NewPersistent creates a new persistent database instance using the provided data directory
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn is a wrapper around the transaction objects for the underlying DB engines
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 }
func UtxosByAddress ¶ added in v0.4.2
Click to show internal directories.
Click to hide internal directories.