Documentation ¶
Index ¶
- Variables
- type Block
- type ElasticIndexerArgs
- type Event
- type Indexer
- type Miniblock
- type NilIndexer
- func (ni *NilIndexer) IsInterfaceNil() bool
- func (ni *NilIndexer) IsNilIndexer() bool
- func (ni *NilIndexer) SaveBlock(_ data.BodyHandler, _ data.HeaderHandler, _ map[string]data.TransactionHandler, ...)
- func (ni *NilIndexer) SaveRoundInfo(_ RoundInfo)
- func (ni *NilIndexer) SaveValidatorsPubKeys(_ map[uint32][][]byte, _ uint32)
- func (ni *NilIndexer) SaveValidatorsRating(_ string, _ []ValidatorRatingInfo)
- func (ni *NilIndexer) SetTxLogsProcessor(_ process.TransactionLogProcessorDatabase)
- func (ni *NilIndexer) UpdateTPS(_ statistics.TPSBenchmark)
- type Options
- type RoundInfo
- type ScResult
- type TPS
- type Transaction
- type TxLog
- type ValidatorRatingInfo
- type ValidatorsPublicKeys
- type ValidatorsRatingInfo
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 ErrEmptyPassword = errors.New("password is empty")
ErrEmptyPassword signals that password for elastic search is empty
var ErrEmptyUserName = errors.New("user name is empty")
ErrEmptyUserName signals that user name for elastic search is empty
var ErrNilPubkeyConverter = errors.New("nil pubkey converter")
ErrNilPubkeyConverter signals that an operation has been attempted to or with a nil public key converter implementation
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"` Epoch uint32 `json:"epoch"` Hash string `json:"-"` MiniBlocksHashes []string `json:"miniBlocksHashes"` NotarizedBlocksHashes []string `json:"notarizedBlocksHashes"` Proposer uint64 `json:"proposer"` Validators []uint64 `json:"validators"` PubKeyBitmap string `json:"pubKeyBitmap"` Size int64 `json:"size"` SizeTxs int64 `json:"sizeTxs"` Timestamp time.Duration `json:"timestamp"` StateRootHash string `json:"stateRootHash"` PrevHash string `json:"prevHash"` ShardID uint32 `json:"shardId"` TxCount uint32 `json:"txCount"` }
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 ElasticIndexerArgs ¶
type ElasticIndexerArgs struct { ShardId uint32 Url string UserName string Password string Marshalizer marshal.Marshalizer Hasher hashing.Hasher EpochStartNotifier sharding.EpochStartEventNotifier NodesCoordinator sharding.NodesCoordinator AddressPubkeyConverter core.PubkeyConverter ValidatorPubkeyConverter core.PubkeyConverter Options *Options }
ElasticIndexerArgs is struct that is used to store all components that are needed to create a indexer
type Event ¶ added in v1.0.114
type Event struct { Address string `json:"address"` Identifier string `json:"identifier"` Topics []string `json:"topics"` Data string `json:"data"` }
Event holds all the data needed for an event structure
type Indexer ¶
type Indexer interface { SetTxLogsProcessor(txLogsProc process.TransactionLogProcessorDatabase) SaveBlock(body data.BodyHandler, header data.HeaderHandler, txPool map[string]data.TransactionHandler, signersIndexes []uint64, notarizedHeadersHashes []string) SaveRoundInfo(roundInfo RoundInfo) UpdateTPS(tpsBenchmark statistics.TPSBenchmark) SaveValidatorsPubKeys(validatorsPubKeys map[uint32][][]byte, epoch uint32) SaveValidatorsRating(indexID string, infoRating []ValidatorRatingInfo) IsInterfaceNil() bool IsNilIndexer() bool }
Indexer is an interface for saving node specific data to other storage. This could be an elastic search index, a MySql database or any other external services.
func NewElasticIndexer ¶
func NewElasticIndexer(arguments ElasticIndexerArgs) (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 Miniblock ¶ added in v0.0.5
type Miniblock struct { Hash string `json:"-"` SenderShardID uint32 `json:"senderShard"` ReceiverShardID uint32 `json:"receiverShard"` SenderBlockHash string `json:"senderBlockHash"` ReceiverBlockHash string `json:"receiverBlockHash"` Type string `json:"type"` }
Miniblock is a structure containing miniblock information
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(_ data.BodyHandler, _ data.HeaderHandler, _ map[string]data.TransactionHandler, _ []uint64, _ []string)
SaveBlock will do nothing
func (*NilIndexer) SaveRoundInfo ¶
func (ni *NilIndexer) SaveRoundInfo(_ RoundInfo)
SaveRoundInfo will do nothing
func (*NilIndexer) SaveValidatorsPubKeys ¶
func (ni *NilIndexer) SaveValidatorsPubKeys(_ map[uint32][][]byte, _ uint32)
SaveValidatorsPubKeys will do nothing
func (*NilIndexer) SaveValidatorsRating ¶ added in v0.0.5
func (ni *NilIndexer) SaveValidatorsRating(_ string, _ []ValidatorRatingInfo)
SaveValidatorsRating --
func (*NilIndexer) SetTxLogsProcessor ¶ added in v1.0.114
func (ni *NilIndexer) SetTxLogsProcessor(_ process.TransactionLogProcessorDatabase)
SetTxLogsProcessor will do nothing
func (*NilIndexer) UpdateTPS ¶
func (ni *NilIndexer) UpdateTPS(_ 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:"round"` 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 ScResult ¶ added in v1.0.114
type ScResult struct { Nonce uint64 `json:"nonce"` GasLimit uint64 `json:"gasLimit"` GasPrice uint64 `json:"gasPrice"` Value string `json:"value"` Sender string `json:"sender"` Receiver string `json:"receiver"` Code string `json:"code"` Data string `json:"data"` PreTxHash string `json:"prevTxHash"` CallType string `json:"callType"` CodeMetadata string `json:"codeMetaData"` ReturnMessage string `json:"returnMessage"` }
ScResult is a structure containing all the fields that need to be saved for a smart contract result
type TPS ¶
type TPS struct { LiveTPS float64 `json:"liveTPS"` PeakTPS float64 `json:"peakTPS"` BlockNumber uint64 `json:"blockNumber"` RoundNumber uint64 `json:"roundNumber"` RoundTime uint64 `json:"roundTime"` AverageBlockTxCount *big.Int `json:"averageBlockTxCount"` TotalProcessedTxCount *big.Int `json:"totalProcessedTxCount"` AverageTPS *big.Int `json:"averageTPS"` CurrentBlockNonce uint64 `json:"currentBlockNonce"` NrOfShards uint32 `json:"nrOfShards"` NrOfNodes uint32 `json:"nrOfNodes"` LastBlockTxCount uint32 `json:"lastBlockTxCount"` ShardID uint32 `json:"shardID"` }
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:"-"` MBHash string `json:"miniBlockHash"` BlockHash string `json:"-"` 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"` GasUsed uint64 `json:"gasUsed"` Data string `json:"data"` Signature string `json:"signature"` Timestamp time.Duration `json:"timestamp"` Status string `json:"status"` SmartContractResults []ScResult `json:"scResults"` Log TxLog `json:"-"` }
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 ValidatorRatingInfo ¶ added in v0.0.5
type ValidatorRatingInfo struct { PublicKey string `json:"publicKey"` Rating float32 `json:"rating"` }
ValidatorRatingInfo is a structure containing validator rating information
type ValidatorsPublicKeys ¶
type ValidatorsPublicKeys struct {
PublicKeys []string `json:"publicKeys"`
}
ValidatorsPublicKeys is a structure containing fields for validators public keys
type ValidatorsRatingInfo ¶ added in v0.0.5
type ValidatorsRatingInfo struct {
ValidatorsInfos []ValidatorRatingInfo `json:"validatorsRating"`
}
ValidatorsRatingInfo is a structure containing validators information