db

package
v0.0.0-...-391dc4a Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB()

Types

type Block

type Block struct {
	Number uint64
	Time   uint64
	Txs    []*Tx
}

func NewBlock

func NewBlock() *Block

func (*Block) From

func (c *Block) From(tx *types.Transaction) string

func (*Block) Read

func (c *Block) Read(fileName string) error

func (*Block) String

func (c *Block) String() string

func (*Block) Write

func (c *Block) Write(fileName string) error

type DB

type DB struct {
	// contains filtered or unexported fields
}
var Instance *DB

func NewDB

func NewDB(network string, url string, periodMs int) *DB

func (*DB) BlockExists

func (c *DB) BlockExists(blockNumber uint64) bool

func (*DB) GetBlock

func (c *DB) GetBlock(blockNumber uint64) (*Block, error)

func (*DB) GetBlockFromCache

func (c *DB) GetBlockFromCache(blockNumber uint64) (*Block, error)

func (*DB) GetData

func (c *DB) GetData(timeBegin uint64, timeEnd uint64) []*Tx

func (*DB) GetLatestTransactions

func (c *DB) GetLatestTransactions() (*TxsByMinutes, []*Tx)

func (*DB) GetState

func (c *DB) GetState() (dbState *DbState)

func (*DB) GroupByMinutes

func (c *DB) GroupByMinutes(beginDT uint64, endDT uint64, txs []*Tx) *TxsByMinutes

func (*DB) LatestBlockNumber

func (c *DB) LatestBlockNumber() uint64

func (*DB) LoadExistingBlocks

func (c *DB) LoadExistingBlocks()

func (*DB) SaveBlock

func (c *DB) SaveBlock(b *Block) error

func (*DB) Start

func (c *DB) Start()

func (*DB) Stop

func (c *DB) Stop()

type DbState

type DbState struct {
	MinBlock              int64
	MaxBlock              int64
	CountOfBlocks         int
	Network               string
	Status                string
	SubStatus             string
	LoadedBlocks          []DbStateBlockRange
	LoadedBlocksTimeRange string
}

type DbStateBlockRange

type DbStateBlockRange struct {
	DtStr1  string
	Number1 uint64
	DtStr2  string
	Number2 uint64
	Count   int
}

type Tx

type Tx struct {
	BlNumber uint64          `json:"bl_n"`
	BlDT     uint64          `json:"bl_dt"`
	TxFrom   *common.Address `json:"tx_from"`
	TxTo     *common.Address `json:"tx_to"`
	TxValue  *big.Int        `json:"tx_value"`
	TxData   []byte          `json:"tx_data"`
}

type TxsByMinute

type TxsByMinute struct {
	DT  uint64
	TXS []*Tx
}

type TxsByMinutes

type TxsByMinutes struct {
	Items []*TxsByMinute
}

Jump to

Keyboard shortcuts

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