Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBodyTypeAssertion = errors.New("elasticsearch - body type assertion failed")
ErrBodyTypeAssertion signals that we could not create an elasticsearch index
var ErrCannotCreateIndex = errors.New("cannot create elasitc index")
ErrCannotCreateIndex signals that we could not create an elasticsearch index
var ErrNoHeader = errors.New("elasticsearch - no header")
ErrNoHeader signals that we could not create an elasticsearch index
var ErrNoMiniblocks = errors.New("elasticsearch - no miniblocks")
ErrNoMiniblocks signals that we could not create an elasticsearch index
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Nonce uint64 `json:"nonce"` ShardID uint32 `json:"shardId"` Hash string `json:"hash"` Proposer string `json:"proposer"` Validators []string `json:"validators"` PubKeyBitmap string `json:"pubKeyBitmap"` Size int64 `json:"size"` Timestamp time.Duration `json:"timestamp"` TxCount uint32 `json:"txCount"` StateRootHash string `json:"stateRootHash"` PrevHash string `json:"prevHash"` }
Block is a structure containing all the fields that need
to be saved for a block. It has all the default fields plus some extra information for ease of search and filter
type Indexer ¶
type Indexer interface { SaveBlock(body data.BodyHandler, header data.HeaderHandler, txPool map[string]data.TransactionHandler) UpdateTPS(tpsBenchmark statistics.TPSBenchmark) IsInterfaceNil() bool }
Indexer is an interface for saving node specific data to other storage. This could be an elasticsearch index, a MySql database or any other external services.
func NewElasticIndexer ¶
func NewElasticIndexer( url string, username string, password string, shardCoordinator sharding.Coordinator, marshalizer marshal.Marshalizer, hasher hashing.Hasher, logger *logger.Logger, options *Options, ) (Indexer, error)
NewElasticIndexer creates a new elasticIndexer where the server listens on the url, authentication for the server is using the username and password
type Options ¶
type Options struct {
TxIndexingEnabled bool
}
Options structure holds the indexer's configuration options
type TPS ¶
type TPS struct { LiveTPS float64 `json:"liveTPS"` PeakTPS float64 `json:"peakTPS"` NrOfShards uint32 `json:"nrOfShards"` NrOfNodes uint32 `json:"nrOfNodes"` BlockNumber uint64 `json:"blockNumber"` RoundNumber uint64 `json:"roundNumber"` RoundTime uint64 `json:"roundTime"` AverageBlockTxCount *big.Int `json:"averageBlockTxCount"` LastBlockTxCount uint32 `json:"lastBlockTxCount"` TotalProcessedTxCount *big.Int `json:"totalProcessedTxCount"` ShardID uint32 `json:"shardID"` AverageTPS *big.Int `json:"averageTPS"` CurrentBlockNonce uint64 `json:"currentBlockNonce"` }
TPS is a structure containing all the fields that need to
be saved for a shard statistic in the database
type Transaction ¶
type Transaction struct { Hash string `json:"hash"` MBHash string `json:"miniBlockHash"` BlockHash string `json:"blockHash"` Nonce uint64 `json:"nonce"` Value *big.Int `json:"value"` Receiver string `json:"receiver"` Sender string `json:"sender"` ReceiverShard uint32 `json:"receiverShard"` SenderShard uint32 `json:"senderShard"` GasPrice uint64 `json:"gasPrice"` GasLimit uint64 `json:"gasLimit"` Data string `json:"data"` Signature string `json:"signature"` Timestamp time.Duration `json:"timestamp"` Status string `json:"status"` }
Transaction is a structure containing all the fields that need
to be saved for a transaction. It has all the default fields plus some extra information for ease of search and filter