burrow: github.com/hyperledger/burrow/vent/sqldb Index | Files | Directories

package sqldb

import "github.com/hyperledger/burrow/vent/sqldb"

Index

Package Files

queries.go sqldb.go system_tables.go

type Queries Uses

type Queries struct {
    LastBlockHeight *sqlx.NamedStmt
    SetBlockHeight  string
}

type SQLDB Uses

type SQLDB struct {
    DB  *sqlx.DB
    adapters.DBAdapter
    Schema  string
    Queries Queries
    types.SQLNames
    Log *logging.Logger
}

SQLDB implements the access to a sql database

func NewSQLDB Uses

func NewSQLDB(connection types.SQLConnection) (*SQLDB, error)

NewSQLDB delegates work to a specific database adapter implementation, opens database connection and create log tables

func (*SQLDB) CleanTables Uses

func (db *SQLDB) CleanTables(chainID, burrowVersion string) error

CleanTables drop tables if stored chainID is different from the given one & store new chainID if the chainID is the same, do nothing

func (*SQLDB) Close Uses

func (db *SQLDB) Close()

Close database connection

func (*SQLDB) GetBlock Uses

func (db *SQLDB) GetBlock(chainID string, height uint64) (types.EventData, error)

GetBlock returns all tables structures and row data for given block

func (*SQLDB) Init Uses

func (db *SQLDB) Init(chainID, burrowVersion string) error

Initialise the system and chain tables in case this is the first run - is idempotent though will drop tables if ChainID has changed

func (*SQLDB) InitChain Uses

func (db *SQLDB) InitChain(chainID, burrowVersion string) (chainIDChanged bool, _ error)

func (*SQLDB) LastBlockHeight Uses

func (db *SQLDB) LastBlockHeight(chainID string) (uint64, error)

func (*SQLDB) Ping Uses

func (db *SQLDB) Ping() error

Ping database

func (*SQLDB) RestoreDB Uses

func (db *SQLDB) RestoreDB(restoreTime time.Time, prefix string) error

RestoreDB restores the DB to a given moment in time. If prefix is provided restores the table state to a new set of tables as <prefix>_<table name>. Drops destination tables before recreating them. If zero time passed restores all values

func (*SQLDB) SetBlock Uses

func (db *SQLDB) SetBlock(chainID string, eventTables types.EventTables, eventData types.EventData) error

SetBlock inserts or updates multiple rows and stores log info in SQL tables

func (*SQLDB) SetBlockHeight Uses

func (db *SQLDB) SetBlockHeight(tx sqlx.Ext, chainID string, height uint64) error

func (*SQLDB) SynchronizeDB Uses

func (db *SQLDB) SynchronizeDB(chainID string, eventTables types.EventTables) error

SynchronizeDB synchronize db tables structures from given tables specifications

Directories

PathSynopsis
adapters

Package sqldb imports 13 packages (graph) and is imported by 6 packages. Updated 2020-01-22. Refresh now. Tools for package owners.