indexer

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 13 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 Config

type Config struct {
	Hostname     string
	HostPort     int
	Username     string
	Password     string
	DatabaseName string
	DriverName   string
}

type Database

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

Database represents an DB connection

func NewDBClient

func NewDBClient(parameters *Config, path string, log logger.Logger) *Database

NewDBClient creates a db client

func (*Database) CloseDB

func (d *Database) CloseDB()

func (*Database) CreateTable

func (d *Database) CreateTable(tableName string) error

func (*Database) GetCurrentState

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

func (*Database) GetSpecificState

func (d *Database) GetSpecificState(gap int) (State, error)

returns state from height - gap

func (*Database) InitializeTables

func (d *Database) InitializeTables() error

func (*Database) InsertBlock

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

InsertBlock a block into the db.

func (*Database) Ping

func (d *Database) Ping() error

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