logdb

package
v0.0.0-...-71e40f4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockBatch

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

func (*BlockBatch) Commit

func (bb *BlockBatch) Commit(abandonedBlocks ...meter.Bytes32) error

func (*BlockBatch) ForTransaction

func (bb *BlockBatch) ForTransaction(txID meter.Bytes32, txOrigin meter.Address) struct {
	Insert func(tx.Events, tx.Transfers) *BlockBatch
}

type Event

type Event struct {
	BlockID     meter.Bytes32
	Index       uint32
	BlockNumber uint32
	BlockTime   uint64
	TxID        meter.Bytes32
	TxOrigin    meter.Address //contract caller
	Address     meter.Address // always a contract address
	Topics      [5]*meter.Bytes32
	Data        []byte
}

Event represents tx.Event that can be stored in db.

type EventCriteria

type EventCriteria struct {
	Address *meter.Address // always a contract address
	Topics  [5]*meter.Bytes32
}

type EventFilter

type EventFilter struct {
	CriteriaSet []*EventCriteria
	Range       *Range
	Options     *Options
	Order       Order //default asc
}

EventFilter filter

type LogDB

type LogDB struct {
	// contains filtered or unexported fields
}
var (
	GlobalLogDBInstance *LogDB
)

func GetGlobalLogDBInstance

func GetGlobalLogDBInstance() *LogDB

func New

func New(path string) (logDB *LogDB, err error)

New create or open log db at given path.

func NewMem

func NewMem() (*LogDB, error)

NewMem create a log db in ram.

func (*LogDB) Close

func (db *LogDB) Close()

Close close the log db.

func (*LogDB) FilterEvents

func (db *LogDB) FilterEvents(ctx context.Context, filter *EventFilter) ([]*Event, error)

func (*LogDB) FilterTransfers

func (db *LogDB) FilterTransfers(ctx context.Context, filter *TransferFilter) ([]*Transfer, error)

func (*LogDB) Path

func (db *LogDB) Path() string

func (*LogDB) Prepare

func (db *LogDB) Prepare(header *block.Header) *BlockBatch

type Options

type Options struct {
	Offset uint64
	Limit  uint64
}

type Order

type Order string
const (
	ASC  Order = "asc"
	DESC Order = "desc"
)

type Range

type Range struct {
	Unit RangeType
	From uint64
	To   uint64
}

type RangeType

type RangeType string
const (
	Block RangeType = "block"
	Time  RangeType = "time"
)

type Transfer

type Transfer struct {
	BlockID     meter.Bytes32
	Index       uint32
	BlockNumber uint32
	BlockTime   uint64
	TxID        meter.Bytes32
	TxOrigin    meter.Address
	Sender      meter.Address
	Recipient   meter.Address
	Amount      *big.Int
	Token       uint32
}

Transfer represents tx.Transfer that can be stored in db.

type TransferCriteria

type TransferCriteria struct {
	TxOrigin  *meter.Address //who send transaction
	Sender    *meter.Address //who transferred tokens
	Recipient *meter.Address //who recieved tokens
}

type TransferFilter

type TransferFilter struct {
	TxID        *meter.Bytes32
	CriteriaSet []*TransferCriteria
	Range       *Range
	Options     *Options
	Order       Order //default asc
}

Jump to

Keyboard shortcuts

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