indexer

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2022 License: MIT Imports: 4 Imported by: 0

README

Pocket indexer

What it is

TODO

How to install

TODO

More fields

TODO

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTransactionsToIndex error when there are no transactions to index
	ErrNoTransactionsToIndex = errors.New("no transactions to index")
	// ErrBlockHasNoHash error when block hash no hash
	ErrBlockHasNoHash = errors.New("block to index has no hash")
)

Functions

This section is empty.

Types

type Block

type Block struct {
	Hash            string
	Height          int
	Time            time.Time
	ProposerAddress string
	TXCount         int
	RelayCount      int
}

Block struct handler of all block fields to be indexed

type Indexer

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

Indexer struct handler for Indexer functions

func NewIndexer

func NewIndexer(provider Provider, writer Writer) *Indexer

NewIndexer returns Indexer instance with given input

func (*Indexer) IndexBlock

func (i *Indexer) IndexBlock(blockHeight int) error

IndexBlock converts block details to a known structure and saves them

func (*Indexer) IndexBlockTransactions

func (i *Indexer) IndexBlockTransactions(blockHeight int) error

IndexBlockTransactions converts block transactions to a known structure and saves them

type Provider

type Provider interface {
	GetBlock(blockNumber int) (*provider.GetBlockOutput, error)
	GetBlockTransactions(blockHeight int, options *provider.GetBlockTransactionsOptions) (*provider.GetBlockTransactionsOutput, error)
}

Provider interface of needed provider functions

type Transaction

type Transaction struct {
	Hash            string
	FromAddress     string
	ToAddress       string
	AppPubKey       string
	Blockchains     []string
	MessageType     string
	Height          int
	Index           int
	StdTx           *provider.StdTx
	TxResult        *provider.TxResult
	Tx              string
	Entropy         int
	Fee             int
	FeeDenomination string
}

Transaction struct handler of all transaction fields to be indexed

type Writer

type Writer interface {
	WriteBlock(block *Block) error
	WriteTransactions(txs []*Transaction) error
}

Writer interface for write methods to index

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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