indexer

package
v0.1.46 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

Package indexer is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenesisBlockData

type GenesisBlockData struct {
	Message       string          `json:"message"`
	InitialSupply uint64          `json:"initialSupply"`
	UTXOs         []*genesis.UTXO `json:"utxos"`
}

GenesisBlockData contains Genesis state details

type MockParser added in v0.1.42

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

MockParser is a mock of Parser interface.

func NewMockParser added in v0.1.42

func NewMockParser(ctrl *gomock.Controller) *MockParser

NewMockParser creates a new mock instance.

func (*MockParser) EXPECT added in v0.1.42

func (m *MockParser) EXPECT() *MockParserMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockParser) GetGenesisBlock added in v0.1.42

func (m *MockParser) GetGenesisBlock(arg0 context.Context) (*ParsedGenesisBlock, error)

GetGenesisBlock mocks base method.

func (*MockParser) GetPlatformHeight added in v0.1.42

func (m *MockParser) GetPlatformHeight(arg0 context.Context) (uint64, error)

GetPlatformHeight mocks base method.

func (*MockParser) ParseCurrentBlock added in v0.1.42

func (m *MockParser) ParseCurrentBlock(arg0 context.Context) (*ParsedBlock, error)

ParseCurrentBlock mocks base method.

func (*MockParser) ParseNonGenesisBlock added in v0.1.42

func (m *MockParser) ParseNonGenesisBlock(arg0 context.Context, arg1 string, arg2 uint64) (*ParsedBlock, error)

ParseNonGenesisBlock mocks base method.

type MockParserMockRecorder added in v0.1.42

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

MockParserMockRecorder is the mock recorder for MockParser.

func (*MockParserMockRecorder) GetGenesisBlock added in v0.1.42

func (mr *MockParserMockRecorder) GetGenesisBlock(arg0 any) *gomock.Call

GetGenesisBlock indicates an expected call of GetGenesisBlock.

func (*MockParserMockRecorder) GetPlatformHeight added in v0.1.42

func (mr *MockParserMockRecorder) GetPlatformHeight(arg0 any) *gomock.Call

GetPlatformHeight indicates an expected call of GetPlatformHeight.

func (*MockParserMockRecorder) ParseCurrentBlock added in v0.1.42

func (mr *MockParserMockRecorder) ParseCurrentBlock(arg0 any) *gomock.Call

ParseCurrentBlock indicates an expected call of ParseCurrentBlock.

func (*MockParserMockRecorder) ParseNonGenesisBlock added in v0.1.42

func (mr *MockParserMockRecorder) ParseNonGenesisBlock(arg0, arg1, arg2 any) *gomock.Call

ParseNonGenesisBlock indicates an expected call of ParseNonGenesisBlock.

type ParsedBlock

type ParsedBlock struct {
	BlockID   ids.ID    `json:"id"`
	BlockType string    `json:"type"`
	ParentID  ids.ID    `json:"parent"`
	Timestamp int64     `json:"timestamp"`
	Height    uint64    `json:"height"`
	Txs       []*txs.Tx `json:"transactions"`
}

ParsedBlock contains block details parsed from indexer containers

type ParsedGenesisBlock

type ParsedGenesisBlock struct {
	ParsedBlock
	GenesisBlockData `json:"data"`
}

ParsedGenesisBlock contains Genesis state details

type Parser

type Parser interface {
	// GetGenesisBlock parses and returns the Genesis block
	GetGenesisBlock(ctx context.Context) (*ParsedGenesisBlock, error)
	// ParseNonGenesisBlock returns the block with provided hash or height
	ParseNonGenesisBlock(ctx context.Context, hash string, height uint64) (*ParsedBlock, error)
	// GetPlatformHeight returns the current block height of P-chain
	GetPlatformHeight(ctx context.Context) (uint64, error)
	// ParseCurrentBlock parses and returns the current tip of P-chain
	ParseCurrentBlock(ctx context.Context) (*ParsedBlock, error)
}

Parser defines the interface for a P-chain indexer parser Note: we use indexer just because platformVM does not currently offer a way to retrieve blocks by height. However we do NOT want to use the indexer to retrieve blocks by ID; instead we'll use platformvm.GetBlock api for that. The reason is that we want to use platformVM-level block ID as P-chain blocks identifier rather than proposerVM-level.

func NewParser

func NewParser(pChainClient client.PChainClient, avalancheNetworkID uint32) (Parser, error)

NewParser creates a new P-chain indexer parser Note: NewParser should not contain calls to pChainClient as we cannot assume client is ready to serve requests immediately

Jump to

Keyboard shortcuts

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