ledger

package
v0.0.0-...-1f4b7d8 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeySize = fmt.Errorf("wrong key length")
View Source
var ErrTxOutNotFound = fmt.Errorf("tx out not found")

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 NewDB

func NewDB(path string) (*db, error)

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type Balance

type Balance struct {
	Key   []byte
	Value int64
}

type BalanceCalc

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

func (*BalanceCalc) Calc

func (bc *BalanceCalc) Calc() error

type Config

type Config struct {
	BatchSize            int
	BalanceCalcPeriod    int32
	BalanceCalcThreshold int32
}

type DB

type DB interface {
	GetHeight() (int32, error)
	SetHeight(int32) error
	Get([]byte) (*Entry, error)
	GetBalance([]byte) (*Balance, error)
	GetIterator(prefix []byte) iterator.Iterator
	Put(*Entry) error
	PutBatch([]Entry) error
	PutBalance(*Balance) error
	Close() error
}

type Entry

type Entry struct {
	Address []byte
	TxHash  *chainhash.Hash
	In      bool
	Value   int64
}

func ToEntry

func ToEntry(key, value []byte) (*Entry, error)

type Explorer

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

func NewExplorer

func NewExplorer(
	chain *blockchain.BlockChain,
	chainParams *chaincfg.Params,
	txoutDB txout.DB,
	db DB,
	config *Config) *Explorer

func (*Explorer) GetType

func (e *Explorer) GetType() string

func (*Explorer) Start

func (e *Explorer) Start()

func (*Explorer) Stop

func (e *Explorer) Stop()

func (*Explorer) WaitForShutdown

func (e *Explorer) WaitForShutdown()

Jump to

Keyboard shortcuts

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