db

package
v0.1.1-devnet Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorPrevBlockHash = errors.New("block previous hash doesn't match")

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Account       string `json:"account"`
	Confirmed     int    `json:"confirmed"`
	Unconfirmed   int    `json:"unconfirmed"`
	Locked        int    `json:"locked"`
	TotalSent     int    `json:"total_sent"`
	TotalReceived int    `json:"total_received"`
}

type Database

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

Database represents an DB connection

func NewDB

func NewDB(dbConnString string, log logger.Logger, wg *sync.WaitGroup, driver string, netParams *params.ChainParams) *Database

NewDB creates a db client

func (*Database) Close

func (d *Database) Close()

func (*Database) GetActiveValidatorIndices

func (d *Database) GetActiveValidatorIndices() ([]uint64, error)

func (*Database) GetCurrentState

func (d *Database) GetCurrentState() (State, error)

func (*Database) GetValidatorBalance

func (d *Database) GetValidatorBalance(pubkey string) (int, error)

func (*Database) Initialize

func (d *Database) Initialize() (string, error)

func (*Database) InsertBlock

func (d *Database) InsertBlock(block *primitives.Block) error

func (*Database) Migrate

func (d *Database) Migrate() error

func (*Database) ModifyValidatorBalance

func (d *Database) ModifyValidatorBalance(pubkey string, balance int) error

func (*Database) ProcessEpoch

func (d *Database) ProcessEpoch(b *primitives.Block, epoch int64) error

ProcessEpoch process the block information and modifies the epoch information.

func (*Database) ProcessMempoolTransaction

func (d *Database) ProcessMempoolTransaction(tx *proto.Tx)

func (*Database) ProcessSlot

func (d *Database) ProcessSlot(b *primitives.Block) error

ProcessSlot process the block slot and modifies the database.

type State

type State struct {
	Blocks        int
	LastBlockHash string
}

State represents the last block saved

Jump to

Keyboard shortcuts

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