dcrsqlite

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2017 License: ISC Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TableNameSummaries is name of the table used to store block summary data
	TableNameSummaries = "dcrdata_block_summary"
	// TableNameStakeInfo is name of the table used to store extended stake info
	TableNameStakeInfo = "dcrdata_stakeinfo_extended"
)
View Source
const (

	// DefaultStakeDbName is the default database name
	DefaultStakeDbName = "ffldb_stake"
)

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 InitWiredDB

func InitWiredDB(dbInfo *DBInfo, cl *dcrrpcclient.Client, p *chaincfg.Params) (wiredDB, error)

func NewWiredDB

func NewWiredDB(db *sql.DB, cl *dcrrpcclient.Client, p *chaincfg.Params) wiredDB

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 BlockSummaryDatabaser

type BlockSummaryDatabaser interface {
	StoreStakeInfoExtended(bd *apitypes.StakeInfoExtended) error
	RetrieveStakeInfoExtended(ind int64) (*apitypes.StakeInfoExtended, error)
}

BlockSummaryDatabaser is the interface for a block data saving database

type DB

type DB struct {
	*sql.DB
	// contains filtered or unexported fields
}

DB is a wrapper around sql.DB that adds methods for storing and retrieving chain data. Use InitDB to get a new instance. This may be unexported in the future.

func InitDB

func InitDB(dbInfo *DBInfo) (*DB, error)

InitDB creates a new DB instance from a DBInfo containing the name of the file used to back the underlying sql database.

func NewDB

func NewDB(db *sql.DB) *DB

NewDB creates a new DB instance with pre-generated sql statements from an existing sql.DB. Use InitDB to create a new DB without having a sql.DB.

func (*DB) RetrieveBlockSummary

func (db *DB) RetrieveBlockSummary(ind int64) (*apitypes.BlockDataBasic, error)

func (*DB) RetrieveLatestBlockSummary

func (db *DB) RetrieveLatestBlockSummary() (*apitypes.BlockDataBasic, error)

func (*DB) RetrieveLatestStakeInfoExtended

func (db *DB) RetrieveLatestStakeInfoExtended() (*apitypes.StakeInfoExtended, error)

func (*DB) RetrieveStakeInfoExtended

func (db *DB) RetrieveStakeInfoExtended(ind int64) (*apitypes.StakeInfoExtended, error)

func (*DB) Store

func (db *DB) Store(data *blockdata.BlockData) error

Store satisfies the blockdata.BlockDataSaver interface

func (*DB) StoreBlockSummary

func (db *DB) StoreBlockSummary(bd *apitypes.BlockDataBasic) error

func (*DB) StoreStakeInfoExtended

func (db *DB) StoreStakeInfoExtended(si *apitypes.StakeInfoExtended) error

type DBInfo

type DBInfo struct {
	FileName string
}

DBInfo contains db configuration

type StakeInfoDatabaser

type StakeInfoDatabaser interface {
	StoreBlockSummary(bd *apitypes.BlockDataBasic) error
	RetrieveBlockSummary(ind int64) (*apitypes.BlockDataBasic, error)
}

StakeInfoDatabaser is the interface for an extended stake info saving database

Jump to

Keyboard shortcuts

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