Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func NewAddrs(db *sql.DB, lock *sync.RWMutex) (*addrs, error)
- func NewDatabase(dataDir string) (*database, error)
- func NewSTXOs(db *sql.DB, lock *sync.RWMutex) (*stxos, error)
- func NewState(db *sql.DB, lock *sync.RWMutex) (*state, error)
- func NewTxs(db *sql.DB, lock *sync.RWMutex) (*txs, error)
- func NewUTXOs(db *sql.DB, lock *sync.RWMutex) (*utxos, error)
- func UseLogger(logger elalog.Logger)
- type Addrs
- type AddrsBatch
- type DataBatch
- type DataStore
- type STXOs
- type STXOsBatch
- type State
- type Txs
- type TxsBatch
- type UTXOs
- type UTXOsBatch
Constants ¶
View Source
const CreateAddrsDB = `CREATE TABLE IF NOT EXISTS Addrs(
Hash BLOB NOT NULL PRIMARY KEY,
Script BLOB,
Type INTEGER NOT NULL
);`
View Source
const CreateSTXOsDB = `` /* 255-byte string literal not displayed */
View Source
const CreateStateDB = `CREATE TABLE IF NOT EXISTS State(
Key NOT NULL PRIMARY KEY,
Value BLOB NOT NULL
);`
View Source
const CreateTxsDB = `` /* 303-byte string literal not displayed */
View Source
const CreateUTXOsDB = `` /* 192-byte string literal not displayed */
View Source
const (
DriverName = "sqlite3"
)
View Source
const (
HeightKey = "Height"
)
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
func NewDatabase ¶
Types ¶
type Addrs ¶
type Addrs interface { // put a address to database Put(hash *common.Uint168, script []byte, addrType int) error // get a address from database Get(hash *common.Uint168) (*sutil.Addr, error) // get all addresss from database GetAll() ([]*sutil.Addr, error) // delete a address from database Del(hash *common.Uint168) error // Batch return a AddrsBatch Batch() AddrsBatch }
type AddrsBatch ¶
type DataBatch ¶
type DataBatch interface { Addrs() AddrsBatch Txs() TxsBatch UTXOs() UTXOsBatch STXOs() STXOsBatch RollbackHeight(height uint32) error // contains filtered or unexported methods }
type STXOs ¶
type STXOs interface { // Put save a STXO into database Put(stxo *sutil.STXO) error // get a stxo from database Get(op *util.OutPoint) (*sutil.STXO, error) // get stxos of the given address hash from database GetAddrAll(hash *common.Uint168) ([]*sutil.STXO, error) // Get all STXOs in database GetAll() ([]*sutil.STXO, error) // delete a stxo from database Del(outPoint *util.OutPoint) error // Batch return a STXOsBatch. Batch() STXOsBatch }
type STXOsBatch ¶
type Txs ¶
type Txs interface { // Put a new transaction to database Put(tx *util.Tx) error // Fetch a raw tx and it's metadata given a hash Get(txId *common.Uint256) (*util.Tx, error) // Fetch all transactions from database GetAll() ([]*util.Tx, error) // Fetch all transactions from the given height. GetAllFrom(height uint32) ([]*util.Tx, error) // Fetch all unconfirmed transactions. GetAllUnconfirmed() ([]*util.Tx, error) // Delete a transaction from the db Del(txId *common.Uint256) error // PutForkTxs persists the fork chain transactions into database with the // fork block hash and can be queried by GetForkTxs(hash). PutForkTxs(txs []*util.Tx, hash *common.Uint256) error // GetForkTxs returns all transactions within the fork block hash. GetForkTxs(hash *common.Uint256) ([]*util.Tx, error) // Batch return a TxsBatch Batch() TxsBatch }
type UTXOs ¶
type UTXOs interface { // put a utxo to database Put(utxo *sutil.UTXO) error // get a utxo from database Get(op *util.OutPoint) (*sutil.UTXO, error) // get utxos of the given address hash from database GetAddrAll(hash *common.Uint168) ([]*sutil.UTXO, error) // Get all UTXOs in database GetAll() ([]*sutil.UTXO, error) // delete a utxo from database Del(outPoint *util.OutPoint) error // Batch return a UTXOsBatch. Batch() UTXOsBatch }
Click to show internal directories.
Click to hide internal directories.