Documentation ¶
Index ¶
- type ChainStats
- type Explorer
- func (e *Explorer) ChainStats(index types.ChainIndex) (ChainStats, error)
- func (e *Explorer) ChainStatsLatest() (ChainStats, error)
- func (e *Explorer) FileContractElement(id types.ElementID) (types.FileContractElement, error)
- func (e *Explorer) MerkleProof(id types.ElementID) ([]types.Hash256, error)
- func (e *Explorer) ProcessChainApplyUpdate(cau *chain.ApplyUpdate, mayCommit bool) error
- func (e *Explorer) ProcessChainRevertUpdate(cru *chain.RevertUpdate) error
- func (e *Explorer) SiacoinBalance(address types.Address) (types.Currency, error)
- func (e *Explorer) SiacoinElement(id types.ElementID) (types.SiacoinElement, error)
- func (e *Explorer) SiafundBalance(address types.Address) (uint64, error)
- func (e *Explorer) SiafundElement(id types.ElementID) (types.SiafundElement, error)
- func (e *Explorer) Size() (uint64, error)
- func (e *Explorer) State(index types.ChainIndex) (consensus.State, error)
- func (e *Explorer) Transaction(id types.TransactionID) (types.Transaction, error)
- func (e *Explorer) Transactions(address types.Address, amount, offset int) ([]types.TransactionID, error)
- func (e *Explorer) UnspentSiacoinElements(address types.Address) ([]types.ElementID, error)
- func (e *Explorer) UnspentSiafundElements(address types.Address) ([]types.ElementID, error)
- type HashStore
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainStats ¶
type ChainStats struct { Block types.Block // Transaction type counts. SpentSiacoinsCount uint64 SpentSiafundsCount uint64 // Facts about file contracts. ActiveContractCost types.Currency ActiveContractCount uint64 ActiveContractSize uint64 TotalContractCost types.Currency TotalContractSize uint64 TotalRevisionVolume uint64 }
ChainStats contains a bunch of statistics about the consensus set as they were at a specific block.
func (*ChainStats) DecodeFrom ¶
func (cs *ChainStats) DecodeFrom(d *types.Decoder)
DecodeFrom implements types.DecoderFrom.
func (ChainStats) EncodeTo ¶
func (cs ChainStats) EncodeTo(e *types.Encoder)
EncodeTo implements types.EncoderTo.
type Explorer ¶
type Explorer struct {
// contains filtered or unexported fields
}
An Explorer contains a database storing information about blocks, outputs, contracts.
func NewExplorer ¶
NewExplorer creates a new explorer.
func (*Explorer) ChainStats ¶
func (e *Explorer) ChainStats(index types.ChainIndex) (ChainStats, error)
ChainStats returns stats about the black at the the specified height.
func (*Explorer) ChainStatsLatest ¶
func (e *Explorer) ChainStatsLatest() (ChainStats, error)
ChainStatsLatest returns stats about the latest black.
func (*Explorer) FileContractElement ¶
FileContractElement returns the file contract element associated with the specified ID.
func (*Explorer) MerkleProof ¶
MerkleProof returns the current merkle proof for a given element.
func (*Explorer) ProcessChainApplyUpdate ¶
func (e *Explorer) ProcessChainApplyUpdate(cau *chain.ApplyUpdate, mayCommit bool) error
ProcessChainApplyUpdate implements chain.Subscriber.
func (*Explorer) ProcessChainRevertUpdate ¶
func (e *Explorer) ProcessChainRevertUpdate(cru *chain.RevertUpdate) error
ProcessChainRevertUpdate implements chain.Subscriber.
func (*Explorer) SiacoinBalance ¶
SiacoinBalance returns the siacoin balance of an address.
func (*Explorer) SiacoinElement ¶
SiacoinElement returns the siacoin element associated with the specified ID.
func (*Explorer) SiafundBalance ¶
SiafundBalance returns the siafund balance of an address.
func (*Explorer) SiafundElement ¶
SiafundElement returns the siafund element associated with the specified ID.
func (*Explorer) Size ¶
Size returns the combined size in bytes of the SQL store and the hash store.
func (*Explorer) Transaction ¶
func (e *Explorer) Transaction(id types.TransactionID) (types.Transaction, error)
Transaction returns the transaction with the given ID.
func (*Explorer) Transactions ¶
func (e *Explorer) Transactions(address types.Address, amount, offset int) ([]types.TransactionID, error)
Transactions returns the latest n transaction IDs associated with the specified address.
func (*Explorer) UnspentSiacoinElements ¶
UnspentSiacoinElements returns unspent siacoin elements associated with the specified address.
type HashStore ¶
type HashStore interface { Size() (uint64, error) Commit() error ModifyLeaf(elem types.StateElement) error MerkleProof(leafIndex uint64) ([]types.Hash256, error) }
A HashStore can read and write hashes for nodes in the log's tree structure.
type Store ¶
type Store interface { ChainStats(index types.ChainIndex) (ChainStats, error) SiacoinElement(id types.ElementID) (types.SiacoinElement, error) SiafundElement(id types.ElementID) (types.SiafundElement, error) FileContractElement(id types.ElementID) (types.FileContractElement, error) UnspentSiacoinElements(address types.Address) ([]types.ElementID, error) UnspentSiafundElements(address types.Address) ([]types.ElementID, error) Transaction(id types.TransactionID) (types.Transaction, error) Transactions(address types.Address, amount, offset int) ([]types.TransactionID, error) State(index types.ChainIndex) (context consensus.State, err error) AddSiacoinElement(sce types.SiacoinElement) AddSiafundElement(sfe types.SiafundElement) AddFileContractElement(fce types.FileContractElement) RemoveElement(id types.ElementID) AddChainStats(index types.ChainIndex, stats ChainStats) AddUnspentSiacoinElement(address types.Address, id types.ElementID) AddUnspentSiafundElement(address types.Address, id types.ElementID) RemoveUnspentSiacoinElement(address types.Address, id types.ElementID) RemoveUnspentSiafundElement(address types.Address, id types.ElementID) AddTransaction(txn types.Transaction, addresses []types.Address, block types.ChainIndex) AddState(index types.ChainIndex, context consensus.State) Size() (uint64, error) Commit() error }
A Store is a database that stores information about elements, contracts, and blocks.