logdb

package
v0.0.0-...-75aef46 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: GPL-3.0 Imports: 8 Imported by: 8

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 ...powerplay.Bytes32) error

func (*BlockBatch) ForTransaction

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

type Event

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

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

type EventCriteria

type EventCriteria struct {
	Address *powerplay.Address // always a contract address
	Topics  [5]*powerplay.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
}

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     powerplay.Bytes32
	Index       uint32
	BlockNumber uint32
	BlockTime   uint64
	TxID        powerplay.Bytes32
	TxOrigin    powerplay.Address
	Sender      powerplay.Address
	Recipient   powerplay.Address
	Amount      *big.Int
}

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

type TransferCriteria

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

type TransferFilter

type TransferFilter struct {
	TxID        *powerplay.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