indexservice

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotExist indicates certain item does not exist in Blockchain database
	ErrNotExist = errors.New("not exist in DB")
	// ErrAlreadyExist indicates certain item already exists in Blockchain database
	ErrAlreadyExist = errors.New("already exist in DB")
)

Functions

This section is empty.

Types

type ExecutionHistory

type ExecutionHistory struct {
	NodeAddress   string
	UserAddress   string
	ExecutionHash string
}

ExecutionHistory defines the schema of "execution history" table

type ExecutionToBlock

type ExecutionToBlock struct {
	NodeAddress   string
	ExecutionHash string
	BlockHash     string
}

ExecutionToBlock defines the schema of "execution hash to block hash" table

type Indexer

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

Indexer handle the index build for blocks

func (*Indexer) BuildIndex

func (idx *Indexer) BuildIndex(blk *blockchain.Block) error

BuildIndex build the index for a block

func (*Indexer) GetBlockByExecution

func (idx *Indexer) GetBlockByExecution(executionHash hash.Hash32B) (hash.Hash32B, error)

GetBlockByExecution return block hash by execution hash

func (*Indexer) GetBlockByTransfer

func (idx *Indexer) GetBlockByTransfer(transferHash hash.Hash32B) (hash.Hash32B, error)

GetBlockByTransfer return block hash by transfer hash

func (*Indexer) GetBlockByVote

func (idx *Indexer) GetBlockByVote(voteHash hash.Hash32B) (hash.Hash32B, error)

GetBlockByVote return block hash by vote hash

func (*Indexer) GetExecutionHistory

func (idx *Indexer) GetExecutionHistory(userAddr string) ([]hash.Hash32B, error)

GetExecutionHistory get execution history

func (*Indexer) GetTransferHistory

func (idx *Indexer) GetTransferHistory(userAddr string) ([]hash.Hash32B, error)

GetTransferHistory get transfer history

func (*Indexer) GetVoteHistory

func (idx *Indexer) GetVoteHistory(userAddr string) ([]hash.Hash32B, error)

GetVoteHistory get vote history

func (*Indexer) UpdateExecutionHistory

func (idx *Indexer) UpdateExecutionHistory(blk *blockchain.Block, tx *sql.Tx) error

UpdateExecutionHistory stores execution information into execution history table

func (*Indexer) UpdateExecutionToBlock

func (idx *Indexer) UpdateExecutionToBlock(blk *blockchain.Block, tx *sql.Tx) error

UpdateExecutionToBlock map execution hash to block hash

func (*Indexer) UpdateTransferHistory

func (idx *Indexer) UpdateTransferHistory(blk *blockchain.Block, tx *sql.Tx) error

UpdateTransferHistory stores transfer information into transfer history table

func (*Indexer) UpdateTransferToBlock

func (idx *Indexer) UpdateTransferToBlock(blk *blockchain.Block, tx *sql.Tx) error

UpdateTransferToBlock map transfer hash to block hash

func (*Indexer) UpdateVoteHistory

func (idx *Indexer) UpdateVoteHistory(blk *blockchain.Block, tx *sql.Tx) error

UpdateVoteHistory stores vote information into vote history table

func (*Indexer) UpdateVoteToBlock

func (idx *Indexer) UpdateVoteToBlock(blk *blockchain.Block, tx *sql.Tx) error

UpdateVoteToBlock map vote hash to block hash

type Server

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

Server is the container of the index service

func NewServer

func NewServer(
	cfg *config.Config,
	bc blockchain.Blockchain,
) *Server

NewServer instantiates an index service

func (*Server) Indexer

func (s *Server) Indexer() *Indexer

Indexer return indexer interface

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the explorer server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the explorer server

type TransferHistory

type TransferHistory struct {
	NodeAddress string
	UserAddress string
	TrasferHash string
}

TransferHistory defines the schema of "transfer history" table

type TransferToBlock

type TransferToBlock struct {
	NodeAddress string
	TrasferHash string
	BlockHash   string
}

TransferToBlock defines the schema of "transfer hash to block hash" table

type VoteHistory

type VoteHistory struct {
	NodeAddress string
	UserAddress string
	VoteHash    string
}

VoteHistory defines the schema of "vote history" table

type VoteToBlock

type VoteToBlock struct {
	NodeAddress string
	VoteHash    string
	BlockHash   string
}

VoteToBlock defines the schema of "vote hash to block hash" table

Jump to

Keyboard shortcuts

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