Documentation ¶
Index ¶
- func RepairRocksDB(name string) error
- type AddrBalance
- type BlockInfo
- type BulkConnect
- type RocksDB
- func (d *RocksDB) Close() error
- func (d *RocksDB) ComputeInternalStateColumnStats(stopCompute chan os.Signal) error
- func (d *RocksDB) ConnectBlock(block *bchain.Block) error
- func (d *RocksDB) DatabaseSizeOnDisk() int64
- func (d *RocksDB) DeleteTx(txid string) error
- func (d *RocksDB) DisconnectBlock(block *bchain.Block) error
- func (d *RocksDB) DisconnectBlockRangeNonUTXO(lower uint32, higher uint32) error
- func (d *RocksDB) DisconnectBlockRangeUTXO(lower uint32, higher uint32) error
- func (d *RocksDB) GetAddrDescBalance(addrDesc bchain.AddressDescriptor) (*AddrBalance, error)
- func (d *RocksDB) GetAddrDescTransactions(addrDesc bchain.AddressDescriptor, lower uint32, higher uint32, ...) (err error)
- func (d *RocksDB) GetAddressBalance(address string) (*AddrBalance, error)
- func (d *RocksDB) GetAndResetConnectBlockStats() string
- func (d *RocksDB) GetBestBlock() (uint32, string, error)
- func (d *RocksDB) GetBlockHash(height uint32) (string, error)
- func (d *RocksDB) GetBlockInfo(height uint32) (*BlockInfo, error)
- func (d *RocksDB) GetMemoryStats() string
- func (d *RocksDB) GetTransactions(address string, lower uint32, higher uint32, ...) (err error)
- func (d *RocksDB) GetTx(txid string) (*bchain.Tx, uint32, error)
- func (d *RocksDB) GetTxAddresses(txid string) (*TxAddresses, error)
- func (d *RocksDB) InitBulkConnect() (*BulkConnect, error)
- func (d *RocksDB) LoadInternalState(rpcCoin string) (*common.InternalState, error)
- func (d *RocksDB) PutTx(tx *bchain.Tx, height uint32, blockTime int64) error
- func (d *RocksDB) Reopen() error
- func (d *RocksDB) SetInconsistentState(inconsistent bool) error
- func (d *RocksDB) SetInternalState(is *common.InternalState)
- func (d *RocksDB) StoreInternalState(is *common.InternalState) error
- type StopIteration
- type SyncWorker
- type TxAddresses
- type TxCache
- type TxInput
- type TxOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RepairRocksDB ¶
RepairRocksDB calls RocksDb db repair function
Types ¶
type AddrBalance ¶ added in v0.1.0
func (*AddrBalance) ReceivedSat ¶ added in v0.1.0
func (ab *AddrBalance) ReceivedSat() *big.Int
type BlockInfo ¶ added in v0.1.0
type BlockInfo struct { Hash string Time int64 Txs uint32 Size uint32 Height uint32 // Height is not packed! }
BlockInfo holds information about blocks kept in column height
type BulkConnect ¶ added in v0.1.0
type BulkConnect struct {
// contains filtered or unexported fields
}
BulkConnect is used to connect blocks in bulk, faster but if interrupted inconsistent way
func (*BulkConnect) Close ¶ added in v0.1.0
func (b *BulkConnect) Close() error
Close flushes the cached data and switches DB from inconsistent state open after Close, the BulkConnect cannot be used
func (*BulkConnect) ConnectBlock ¶ added in v0.1.0
func (b *BulkConnect) ConnectBlock(block *bchain.Block, storeBlockTxs bool) error
ConnectBlock connects block in bulk mode
type RocksDB ¶
type RocksDB struct {
// contains filtered or unexported fields
}
RocksDB handle
func NewRocksDB ¶
func NewRocksDB(path string, cacheSize, maxOpenFiles int, parser bchain.BlockChainParser, metrics *common.Metrics) (d *RocksDB, err error)
NewRocksDB opens an internal handle to RocksDB environment. Close needs to be called to release it.
func (*RocksDB) ComputeInternalStateColumnStats ¶
ComputeInternalStateColumnStats computes stats of all db columns and sets them to internal state can be very slow operation
func (*RocksDB) ConnectBlock ¶
ConnectBlock indexes addresses in the block and stores them in db
func (*RocksDB) DatabaseSizeOnDisk ¶
DatabaseSizeOnDisk returns size of the database in bytes
func (*RocksDB) DisconnectBlock ¶
DisconnectBlock removes addresses in the block from the db
func (*RocksDB) DisconnectBlockRangeNonUTXO ¶ added in v0.1.0
DisconnectBlockRangeNonUTXO performs full range scan to remove a range of blocks it is very slow operation
func (*RocksDB) DisconnectBlockRangeUTXO ¶ added in v0.1.0
DisconnectBlockRangeUTXO removes all data belonging to blocks in range lower-higher if they are in the range kept in the cfBlockTxids column
func (*RocksDB) GetAddrDescBalance ¶ added in v0.1.0
func (d *RocksDB) GetAddrDescBalance(addrDesc bchain.AddressDescriptor) (*AddrBalance, error)
func (*RocksDB) GetAddrDescTransactions ¶ added in v0.1.0
func (d *RocksDB) GetAddrDescTransactions(addrDesc bchain.AddressDescriptor, lower uint32, higher uint32, fn func(txid string, vout uint32, isOutput bool) error) (err error)
GetAddrDescTransactions finds all input/output transactions for address descriptor Transaction are passed to callback function.
func (*RocksDB) GetAddressBalance ¶ added in v0.1.0
func (d *RocksDB) GetAddressBalance(address string) (*AddrBalance, error)
GetAddressBalance returns address balance for an address or nil if address not found
func (*RocksDB) GetAndResetConnectBlockStats ¶ added in v0.1.0
func (*RocksDB) GetBestBlock ¶
GetBestBlock returns the block hash of the block with highest height in the db
func (*RocksDB) GetBlockHash ¶
GetBlockHash returns block hash at given height or empty string if not found
func (*RocksDB) GetBlockInfo ¶ added in v0.1.0
GetBlockInfo returns block info stored in db
func (*RocksDB) GetMemoryStats ¶ added in v0.1.0
func (*RocksDB) GetTransactions ¶
func (d *RocksDB) GetTransactions(address string, lower uint32, higher uint32, fn func(txid string, vout uint32, isOutput bool) error) (err error)
GetTransactions finds all input/output transactions for address Transaction are passed to callback function.
func (*RocksDB) GetTx ¶
GetTx returns transaction stored in db and height of the block containing it
func (*RocksDB) GetTxAddresses ¶ added in v0.1.0
func (d *RocksDB) GetTxAddresses(txid string) (*TxAddresses, error)
GetTxAddresses returns TxAddresses for given txid or nil if not found
func (*RocksDB) InitBulkConnect ¶ added in v0.1.0
func (d *RocksDB) InitBulkConnect() (*BulkConnect, error)
InitBulkConnect initializes bulk connect and switches DB to inconsistent state
func (*RocksDB) LoadInternalState ¶
func (d *RocksDB) LoadInternalState(rpcCoin string) (*common.InternalState, error)
LoadInternalState loads from db internal state or initializes a new one if not yet stored
func (*RocksDB) Reopen ¶
Reopen reopens the database It closes and reopens db, nobody can access the database during the operation!
func (*RocksDB) SetInconsistentState ¶ added in v0.1.0
func (*RocksDB) SetInternalState ¶
func (d *RocksDB) SetInternalState(is *common.InternalState)
SetInternalState sets the InternalState to be used by db to collect internal state
func (*RocksDB) StoreInternalState ¶
func (d *RocksDB) StoreInternalState(is *common.InternalState) error
StoreInternalState stores the internal state to db
type StopIteration ¶ added in v0.1.0
type StopIteration struct{}
StopIteration is returned by callback function to signal stop of iteration
func (*StopIteration) Error ¶ added in v0.1.0
func (e *StopIteration) Error() string
type SyncWorker ¶
type SyncWorker struct {
// contains filtered or unexported fields
}
SyncWorker is handle to SyncWorker
func NewSyncWorker ¶
func NewSyncWorker(db *RocksDB, chain bchain.BlockChain, syncWorkers, syncChunk int, minStartHeight int, dryRun bool, chanOsSignal chan os.Signal, metrics *common.Metrics, is *common.InternalState) (*SyncWorker, error)
NewSyncWorker creates new SyncWorker and returns its handle
func (*SyncWorker) ConnectBlocksParallel ¶
func (w *SyncWorker) ConnectBlocksParallel(lower, higher uint32) error
ConnectBlocksParallel uses parallel goroutines to get data from blockchain daemon
func (*SyncWorker) DisconnectBlocks ¶
func (w *SyncWorker) DisconnectBlocks(lower uint32, higher uint32, hashes []string) error
DisconnectBlocks removes all data belonging to blocks in range lower-higher,
func (*SyncWorker) ResyncIndex ¶
func (w *SyncWorker) ResyncIndex(onNewBlock bchain.OnNewBlockFunc, initialSync bool) error
ResyncIndex synchronizes index to the top of the blockchain onNewBlock is called when new block is connected, but not in initial parallel sync
type TxAddresses ¶ added in v0.1.0
type TxCache ¶
type TxCache struct {
// contains filtered or unexported fields
}
TxCache is handle to TxCacheServer
func NewTxCache ¶
func NewTxCache(db *RocksDB, chain bchain.BlockChain, metrics *common.Metrics, is *common.InternalState, enabled bool) (*TxCache, error)
NewTxCache creates new TxCache interface and returns its handle