models

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockNotFound = fmt.Errorf("block not found")

MigrateModels contains a list of model objects that should have DB migrations applied

Functions

func BlockBlobHeightKey added in v0.3.3

func BlockBlobHeightKey(blockNumber uint64) []byte

func BlockBlobKey

func BlockBlobKey(slot uint64, hash []byte) []byte

func BlockBlobKeyHashHex

func BlockBlobKeyHashHex(slot uint64, hashHex string) ([]byte, error)

func BlockBlobMetadataKey added in v0.3.3

func BlockBlobMetadataKey(baseKey []byte) []byte

func BlockCreateTxn added in v0.3.3

func BlockCreateTxn(txn *database.Txn, block Block) error

func BlockDeleteTxn added in v0.3.3

func BlockDeleteTxn(txn *database.Txn, block Block) error

func TipGet added in v0.3.1

func TipGet(db database.Database) (ochainsync.Tip, error)

func TipGetTxn added in v0.3.1

func TipGetTxn(txn *database.Txn) (ochainsync.Tip, error)

func TipUpdateTxn added in v0.3.1

func TipUpdateTxn(txn *database.Txn, tip ochainsync.Tip) error

func UtxoBlobKey

func UtxoBlobKey(txId []byte, outputIdx uint32) []byte

func UtxoDelete

func UtxoDelete(db database.Database, utxo Utxo) error

func UtxoDeleteTxn

func UtxoDeleteTxn(txn *database.Txn, utxo Utxo) error

func UtxosDeleteTxn

func UtxosDeleteTxn(txn *database.Txn, utxos []Utxo) error

Types

type Block

type Block struct {
	Slot     uint64
	Number   uint64
	Hash     []byte
	Type     uint
	PrevHash []byte
	Nonce    []byte
	Cbor     []byte
}

func BlockBeforeSlot added in v0.3.3

func BlockBeforeSlot(db database.Database, slotNumber uint64) (Block, error)

func BlockBeforeSlotTxn added in v0.3.3

func BlockBeforeSlotTxn(txn *database.Txn, slotNumber uint64) (Block, error)

func BlockByNumber

func BlockByNumber(db database.Database, blockNumber uint64) (Block, error)

func BlockByNumberTxn

func BlockByNumberTxn(txn *database.Txn, blockNumber uint64) (Block, error)

func BlockByPoint

func BlockByPoint(db database.Database, point ocommon.Point) (Block, error)

func BlockByPointTxn

func BlockByPointTxn(txn *database.Txn, point ocommon.Point) (Block, error)

func BlocksAfterSlotTxn added in v0.3.3

func BlocksAfterSlotTxn(txn *database.Txn, slotNumber uint64) ([]Block, error)

func BlocksRecent added in v0.3.3

func BlocksRecent(db database.Database, count int) ([]Block, error)

func BlocksRecentTxn added in v0.3.3

func BlocksRecentTxn(txn *database.Txn, count int) ([]Block, error)

func (Block) Decode

func (b Block) Decode() (ledger.Block, error)

type BlockBlobMetadata added in v0.3.3

type BlockBlobMetadata struct {
	cbor.StructAsArray
	Type     uint
	Height   uint64
	PrevHash []byte
	Nonce    []byte
}

type Epoch

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       uint `gorm:"uniqueIndex"`
	EraId         uint
	StartSlot     uint64
	SlotLength    uint
	LengthInSlots uint
	Nonce         []byte
}

func EpochLatest

func EpochLatest(db database.Database) (Epoch, error)

func EpochLatestTxn

func EpochLatestTxn(txn *database.Txn) (Epoch, error)

func (Epoch) TableName

func (Epoch) TableName() string

type PParamUpdate

type PParamUpdate struct {
	ID          uint `gorm:"primarykey"`
	AddedSlot   uint64
	Epoch       uint64
	GenesisHash []byte
	Cbor        []byte
}

func (PParamUpdate) TableName

func (PParamUpdate) TableName() string

type PParams

type PParams struct {
	ID        uint `gorm:"primarykey"`
	AddedSlot uint64
	Epoch     uint
	EraId     uint
	Cbor      []byte
}

func (PParams) TableName

func (PParams) TableName() string

type PoolRegistration

type PoolRegistration struct {
	ID           uint   `gorm:"primarykey"`
	PoolKeyHash  []byte `gorm:"index"`
	VrfKeyHash   []byte
	Pledge       database.Uint64
	Cost         database.Uint64
	Margin       *database.Rat
	Owners       []PoolRegistrationOwner
	Relays       []PoolRegistrationRelay
	MetadataUrl  string
	MetadataHash []byte
	AddedSlot    uint64
}

func (PoolRegistration) TableName

func (PoolRegistration) TableName() string

type PoolRegistrationOwner

type PoolRegistrationOwner struct {
	ID                 uint `gorm:"primarykey"`
	PoolRegistrationID uint
	KeyHash            []byte
}

func (PoolRegistrationOwner) TableName

func (PoolRegistrationOwner) TableName() string

type PoolRegistrationRelay

type PoolRegistrationRelay struct {
	ID                 uint `gorm:"primarykey"`
	PoolRegistrationID uint
	Port               uint
	Ipv4               *net.IP
	Ipv6               *net.IP
	Hostname           string
}

func (PoolRegistrationRelay) TableName

func (PoolRegistrationRelay) TableName() string

type PoolRetirement

type PoolRetirement struct {
	ID          uint   `gorm:"primarykey"`
	PoolKeyHash []byte `gorm:"index"`
	Epoch       uint
	AddedSlot   uint64
}

func (PoolRetirement) TableName

func (PoolRetirement) TableName() string

type StakeDelegation

type StakeDelegation struct {
	ID          uint   `gorm:"primarykey"`
	StakingKey  []byte `gorm:"index"`
	PoolKeyHash []byte `gorm:"index"`
	AddedSlot   uint64
}

func (StakeDelegation) TableName

func (StakeDelegation) TableName() string

type StakeDeregistration

type StakeDeregistration struct {
	ID         uint   `gorm:"primarykey"`
	StakingKey []byte `gorm:"index"`
	AddedSlot  uint64
}

func (StakeDeregistration) TableName

func (StakeDeregistration) TableName() string

type StakeRegistration

type StakeRegistration struct {
	ID         uint   `gorm:"primarykey"`
	StakingKey []byte `gorm:"index"`
	AddedSlot  uint64
}

func (StakeRegistration) TableName

func (StakeRegistration) TableName() string

type Tip added in v0.3.1

type Tip struct {
	ID          uint `gorm:"primarykey"`
	Slot        uint64
	Hash        []byte
	BlockNumber uint64
}

func (Tip) TableName added in v0.3.1

func (Tip) TableName() string

type Utxo

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 here for convenience but not represented in the metadata DB
}

func UtxoByRef

func UtxoByRef(
	db database.Database,
	txId []byte,
	outputIdx uint32,
) (Utxo, error)

func UtxoByRefTxn

func UtxoByRefTxn(
	txn *database.Txn,
	txId []byte,
	outputIdx uint32,
) (Utxo, error)

func UtxosByAddress

func UtxosByAddress(db database.Database, addr ledger.Address) ([]Utxo, error)

func UtxosByAddressTxn

func UtxosByAddressTxn(txn *database.Txn, addr ledger.Address) ([]Utxo, error)

func (Utxo) Decode

func (u Utxo) Decode() (ledger.TransactionOutput, error)

func (Utxo) TableName

func (Utxo) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL