sqlite

package
v0.0.0-...-9307437 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

A Store is a persistent store that uses a SQL database as its backend.

func OpenDatabase

func OpenDatabase(fp string, log *zap.Logger) (*Store, error)

OpenDatabase creates a new SQLite store and initializes the database. If the database does not exist, it is created.

func (*Store) AddHostScans

func (s *Store) AddHostScans(scans []explorer.HostScan) error

AddHostScans implements explorer.Store

func (*Store) AddressEvents

func (s *Store) AddressEvents(address types.Address, offset, limit uint64) (events []explorer.Event, err error)

AddressEvents returns the events of a single address.

func (*Store) Balance

func (s *Store) Balance(address types.Address) (sc types.Currency, immatureSC types.Currency, sf uint64, err error)

Balance implements explorer.Store.

func (*Store) BestTip

func (s *Store) BestTip(height uint64) (result types.ChainIndex, err error)

BestTip implements explorer.Store.

func (*Store) Block

func (s *Store) Block(id types.BlockID) (result explorer.Block, err error)

Block implements explorer.Store.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying database.

func (*Store) ContractRevisions

func (s *Store) ContractRevisions(id types.FileContractID) (revisions []explorer.ExtendedFileContract, err error)

ContractRevisions implements explorer.Store.

func (*Store) Contracts

func (s *Store) Contracts(ids []types.FileContractID) (result []explorer.ExtendedFileContract, err error)

Contracts implements explorer.Store.

func (*Store) ContractsKey

func (s *Store) ContractsKey(key types.PublicKey) (result []explorer.ExtendedFileContract, err error)

ContractsKey implements explorer.Store.

func (*Store) HostMetrics

func (s *Store) HostMetrics() (result explorer.HostMetrics, err error)

HostMetrics implements explorer.Store

func (*Store) Hosts

func (st *Store) Hosts(pks []types.PublicKey) (result []explorer.Host, err error)

Hosts returns the hosts with the given public keys.

func (*Store) HostsForScanning

func (s *Store) HostsForScanning(maxLastScan, minLastAnnouncement time.Time, offset, limit uint64) (result []explorer.Host, err error)

HostsForScanning returns hosts ordered by the transaction they were created in. Note that only the PublicKey, NetAddress, and V2NetAddresses fields are populated.

func (*Store) MerkleProof

func (s *Store) MerkleProof(leafIndex uint64) (proof []types.Hash256, err error)

MerkleProof implements explorer.Store.

func (*Store) Metrics

func (s *Store) Metrics(id types.BlockID) (result explorer.Metrics, err error)

Metrics implements explorer.Store

func (*Store) SiacoinElements

func (s *Store) SiacoinElements(ids []types.SiacoinOutputID) (result []explorer.SiacoinOutput, err error)

SiacoinElements implements explorer.Store.

func (*Store) SiafundElements

func (s *Store) SiafundElements(ids []types.SiafundOutputID) (result []explorer.SiafundOutput, err error)

SiafundElements implements explorer.Store.

func (*Store) Tip

func (s *Store) Tip() (result types.ChainIndex, err error)

Tip implements explorer.Store.

func (*Store) TransactionChainIndices

func (s *Store) TransactionChainIndices(txnID types.TransactionID, offset, limit uint64) (indices []types.ChainIndex, err error)

TransactionChainIndices returns the chain indices of the blocks the transaction was included in. If the transaction has not been included in any blocks, the result will be nil,nil.

func (*Store) Transactions

func (s *Store) Transactions(ids []types.TransactionID) (results []explorer.Transaction, err error)

Transactions implements explorer.Store.

func (*Store) UnspentSiacoinOutputs

func (s *Store) UnspentSiacoinOutputs(address types.Address, offset, limit uint64) (result []explorer.SiacoinOutput, err error)

UnspentSiacoinOutputs implements explorer.Store.

func (*Store) UnspentSiafundOutputs

func (s *Store) UnspentSiafundOutputs(address types.Address, offset, limit uint64) (result []explorer.SiafundOutput, err error)

UnspentSiafundOutputs implements explorer.Store.

func (*Store) UpdateChainState

func (s *Store) UpdateChainState(reverted []chain.RevertUpdate, applied []chain.ApplyUpdate) error

UpdateChainState implements explorer.Store

func (*Store) V2ContractRevisions

func (s *Store) V2ContractRevisions(id types.FileContractID) (revisions []explorer.V2FileContract, err error)

V2ContractRevisions implements explorer.Store.

func (*Store) V2Contracts

func (s *Store) V2Contracts(ids []types.FileContractID) (result []explorer.V2FileContract, err error)

V2Contracts implements explorer.Store.

func (*Store) V2ContractsKey

func (s *Store) V2ContractsKey(key types.PublicKey) (result []explorer.V2FileContract, err error)

V2ContractsKey implements explorer.Store.

func (*Store) V2TransactionChainIndices

func (s *Store) V2TransactionChainIndices(txnID types.TransactionID, offset, limit uint64) (indices []types.ChainIndex, err error)

V2TransactionChainIndices returns the chain indices of the blocks the v2 transaction was included in. If the transaction has not been included in any blocks, the result will be nil,nil.

func (*Store) V2Transactions

func (s *Store) V2Transactions(ids []types.TransactionID) (results []explorer.V2Transaction, err error)

V2Transactions implements explorer.Store.

Jump to

Keyboard shortcuts

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