Documentation ¶
Index ¶
- Variables
- type Block
- type Indexer
- type NilIndexer
- func (ni *NilIndexer) IsInterfaceNil() bool
- func (ni *NilIndexer) IsNilIndexer() bool
- func (ni *NilIndexer) SaveBlock(body data.BodyHandler, header data.HeaderHandler, ...)
- func (im *NilIndexer) SaveMetaBlock(header data.HeaderHandler, signersIndexes []uint64)
- func (ni *NilIndexer) SaveRoundInfo(info RoundInfo)
- func (ni *NilIndexer) SaveValidatorsPubKeys(validatorsPubKeys map[uint32][][]byte)
- func (ni *NilIndexer) UpdateTPS(tpsBenchmark statistics.TPSBenchmark)
- type Options
- type RoundInfo
- type TPS
- type Transaction
- type ValidatorsPublicKeys
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"` Round uint64 `json:"round"` ShardID uint32 `json:"shardId"` Hash string `json:"hash"` Proposer uint64 `json:"proposer"` Validators []uint64 `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, signersIndexes []uint64) SaveMetaBlock(header data.HeaderHandler, signersIndexes []uint64) SaveRoundInfo(roundInfo RoundInfo) UpdateTPS(tpsBenchmark statistics.TPSBenchmark) SaveValidatorsPubKeys(validatorsPubKeys map[uint32][][]byte) IsInterfaceNil() bool IsNilIndexer() 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, 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 NilIndexer ¶
type NilIndexer struct { }
NilIndexer will be used when an Indexer is required, but another one isn't necessary or available
func (*NilIndexer) IsInterfaceNil ¶
func (ni *NilIndexer) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*NilIndexer) IsNilIndexer ¶
func (ni *NilIndexer) IsNilIndexer() bool
IsNilIndexer will return a bool value that signals if the indexer's implementation is a NilIndexer
func (*NilIndexer) SaveBlock ¶
func (ni *NilIndexer) SaveBlock(body data.BodyHandler, header data.HeaderHandler, txPool map[string]data.TransactionHandler, signersIndexes []uint64)
SaveBlock will do nothing
func (*NilIndexer) SaveMetaBlock ¶
func (im *NilIndexer) SaveMetaBlock(header data.HeaderHandler, signersIndexes []uint64)
func (*NilIndexer) SaveRoundInfo ¶
func (ni *NilIndexer) SaveRoundInfo(info RoundInfo)
SaveRoundInfo will do nothing
func (*NilIndexer) SaveValidatorsPubKeys ¶
func (ni *NilIndexer) SaveValidatorsPubKeys(validatorsPubKeys map[uint32][][]byte)
SaveValidatorsPubKeys will do nothing
func (*NilIndexer) UpdateTPS ¶
func (ni *NilIndexer) UpdateTPS(tpsBenchmark statistics.TPSBenchmark)
UpdateTPS will do nothing
type Options ¶
type Options struct {
TxIndexingEnabled bool
}
Options structure holds the indexer's configuration options
type RoundInfo ¶
type RoundInfo struct { Index uint64 `json:"-"` SignersIndexes []uint64 `json:"signersIndexes"` BlockWasProposed bool `json:"blockWasProposed"` ShardId uint32 `json:"shardId"` Timestamp time.Duration `json:"timestamp"` }
RoundInfo is a structure containing block signers and shard id
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"` Round uint64 `json:"round"` Value string `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
type ValidatorsPublicKeys ¶
type ValidatorsPublicKeys struct {
PublicKeys []string `json:"publicKeys"`
}
ValidatorsPublicKeys is a structure containing fields for validators public keys