indexer

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: MIT Imports: 6 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 (
	// ErrBlockHasNoHash error when block hash no hash
	ErrBlockHasNoHash = errors.New("block to index has no hash")
)
View Source
var (
	// ErrNoAppsToIndex error when there are no apps to index
	ErrNoAppsToIndex = errors.New("no apps to index")
)
View Source
var (
	// ErrNoNodesToIndex error when there are no nodes to index
	ErrNoNodesToIndex = errors.New("no nodes to index")
)
View Source
var (
	// ErrNoTransactionsToIndex error when there are no transactions to index
	ErrNoTransactionsToIndex = errors.New("no transactions to index")
)

Functions

This section is empty.

Types

type Account added in v0.3.0

type Account struct {
	Address             string
	Height              int
	Balance             *big.Int
	BalanceDenomination string
}

Account struct handler of all account fields to be indexed

type App added in v0.3.0

type App struct {
	Address      string
	Height       int
	Jailed       bool
	PublicKey    string
	StakedTokens *big.Int
}

App struct handler of all app fields to be indexed

type Block

type Block struct {
	Hash            string
	Height          int
	Time            time.Time
	ProposerAddress string
	TXCount         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) IndexAccount added in v0.3.0

func (i *Indexer) IndexAccount(address string, blockHeight int) error

IndexAccount converts account details to a known structure and saves them

func (*Indexer) IndexBlock

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

IndexBlock converts block details to a known structure and saves them

func (*Indexer) IndexBlockApps added in v0.3.0

func (i *Indexer) IndexBlockApps(blockHeight int) ([]string, error)

IndexBlockApps converts apps details to known structures and saved them returns all addresses indexed

func (*Indexer) IndexBlockNodes added in v0.3.0

func (i *Indexer) IndexBlockNodes(blockHeight int) ([]string, error)

IndexBlockNodes converts nodes details to known structures and saves them returns all addresses indexed

func (*Indexer) IndexBlockTransactions

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

IndexBlockTransactions converts block transactions to a known structure and saves them

type Node added in v0.3.0

type Node struct {
	Address    string
	Height     int
	Jailed     bool
	PublicKey  string
	ServiceURL string
	Tokens     *big.Int
}

Node struct handler of all node fields to be indexed

type Provider

type Provider interface {
	GetBlock(blockNumber int) (*provider.GetBlockOutput, error)
	GetBlockTransactions(options *provider.GetBlockTransactionsOptions) (*provider.GetBlockTransactionsOutput, error)
	GetAccount(address string, options *provider.GetAccountOptions) (*provider.GetAccountOutput, error)
	GetNodes(options *provider.GetNodesOptions) (*provider.GetNodesOutput, error)
	GetApps(options *provider.GetAppsOptions) (*provider.GetAppsOutput, 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
	Amount          *big.Int
}

Transaction struct handler of all transaction fields to be indexed

type Writer

type Writer interface {
	WriteBlock(block *Block) error
	WriteTransactions(txs []*Transaction) error
	WriteAccount(account *Account) error
	WriteNodes(nodes []*Node) error
	WriteApps(apps []*App) 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