Documentation ¶
Index ¶
- Variables
- type BlockByIndex
- type IndexHistory
- type Indexer
- func (idx *Indexer) BuildIndex(blk *block.Block) error
- func (idx *Indexer) CreateTablesIfNotExist() error
- func (idx *Indexer) GetBlockByIndex(indexIdentifier string, indexHash hash.Hash256) (hash.Hash256, error)
- func (idx *Indexer) GetIndexHistory(indexIdentifier string, userAddr string) ([]hash.Hash256, error)
- func (idx *Indexer) HandleBlock(blk *block.Block) error
- func (idx *Indexer) UpdateBlockByIndex(blk *block.Block, tx *sql.Tx, indexIdentifier string, indexHash hash.Hash256, ...) error
- func (idx *Indexer) UpdateIndexHistory(blk *block.Block, tx *sql.Tx, indexIdentifier string, userAddr string, ...) error
- type Server
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 BlockByIndex ¶
BlockByIndex defines the base schema of "index to block" table
type IndexHistory ¶
IndexHistory defines the schema of "index history" table
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer handles the index build for blocks
func (*Indexer) BuildIndex ¶
BuildIndex builds the index for a block
func (*Indexer) CreateTablesIfNotExist ¶
CreateTablesIfNotExist creates tables in local database
func (*Indexer) GetBlockByIndex ¶
func (idx *Indexer) GetBlockByIndex(indexIdentifier string, indexHash hash.Hash256) (hash.Hash256, error)
GetBlockByIndex returns block hash by index hash
func (*Indexer) GetIndexHistory ¶
func (idx *Indexer) GetIndexHistory(indexIdentifier string, userAddr string) ([]hash.Hash256, error)
GetIndexHistory gets index history
func (*Indexer) HandleBlock ¶
HandleBlock is an implementation of interface BlockCreationSubscriber
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
Click to show internal directories.
Click to hide internal directories.