models

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func BlockBlobKey

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

func BlockBlobKeyHashHex

func BlockBlobKeyHashHex(slot uint64, hashHex string) ([]byte, 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 {
	ID     uint   `gorm:"primarykey"`
	Slot   uint64 `gorm:"index:slot_hash"`
	Number uint64 `gorm:"index"`
	Hash   []byte `gorm:"index:slot_hash"`
	Type   uint
	Cbor   []byte `gorm:"-"` // This is here for convenience but not represented in the metadata DB
}

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 (Block) Decode

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

func (Block) TableName

func (Block) TableName() string

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
}

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 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