indexertypes

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CountStoreEntities is the key for the entity count db reference
	CountStoreEntities = uint8(iota)
	// CountStoreProcesses is the key for the process count db reference
	CountStoreProcesses
	// CountStoreEnvelopes is the key for the envelope count db reference
	CountStoreEnvelopes
	// CountStoreTransactions is the key for the transaction count db reference
	CountStoreTransactions
)

Variables

This section is empty.

Functions

func ResultsFromDB

func ResultsFromDB(dbproc *indexerdb.Process) *results.Results

Types

type BlockMetadata

type BlockMetadata struct {
	Height          uint32         `json:"height,omitempty"`
	Timestamp       time.Time      `json:"timestamp"`
	Hash            types.HexBytes `json:"hash,omitempty"`
	NumTxs          uint64         `json:"numTxs"`
	LastBlockHash   types.HexBytes `json:"lastBlockHash"`
	ProposerAddress types.HexBytes `json:"proposerAddress"`
}

BlockMetadata contains the metadata for a single tendermint block

func (*BlockMetadata) String

func (b *BlockMetadata) String() string

String prints the BlockMetadata in a human-readable format

type CountStore

type CountStore struct {
	Type  uint8
	Count uint64
}

CountStore holds the count of envelopes, processes, entities, or transactions

type Entity

type Entity struct {
	ID           types.HexBytes
	ProcessCount uint32
	CreationTime time.Time
}

Entity holds the db reference for an entity

type EnvelopeMetadata

type EnvelopeMetadata struct {
	ProcessId types.HexBytes `json:"processId"`
	Nullifier types.HexBytes `json:"nullifier"`
	VoterID   types.HexBytes `json:"voterId"`
	TxIndex   int32          `json:"txIndex"`
	Height    uint32         `json:"height"`
	TxHash    types.HexBytes `json:"txHash"`
}

EnvelopeMetadata contains vote information for the EnvelopeList api

type EnvelopePackage

type EnvelopePackage struct {
	EncryptionKeyIndexes []uint32         `json:"encryptionKeyIndexes"`
	Meta                 EnvelopeMetadata `json:"meta"`
	Nonce                types.HexBytes   `json:"nonce"`
	Signature            types.HexBytes   `json:"signature"`
	VotePackage          []byte           `json:"votePackage"`
	Weight               string           `json:"weight"`
	OverwriteCount       uint32           `json:"overwriteCount"`
	Date                 time.Time        `json:"date"`
}

EnvelopePackage contains a VoteEnvelope and auxiliary information for the Envelope api

type IndexerOnProcessData

type IndexerOnProcessData struct {
	EntityID  []byte
	ProcessID []byte
}

IndexerOnProcessData holds the required data for callbacks when a new process is added into the vochain.

type Process

type Process struct {
	ID                types.HexBytes             `json:"processId"`
	EntityID          types.HexBytes             `json:"entityId"`
	StartBlock        uint32                     `json:"startBlock"`
	EndBlock          uint32                     `json:"endBlock"`
	CensusRoot        types.HexBytes             `json:"censusRoot"`
	RollingCensusRoot types.HexBytes             `json:"rollingCensusRoot"`
	CensusURI         string                     `json:"censusURI"`
	Metadata          string                     `json:"metadata"`
	CensusOrigin      int32                      `json:"censusOrigin"`
	Status            int32                      `json:"status"`
	Namespace         uint32                     `json:"namespace"`
	Envelope          *models.EnvelopeType       `json:"envelopeType"`
	Mode              *models.ProcessMode        `json:"processMode"`
	VoteOpts          *models.ProcessVoteOptions `json:"voteOptions"`
	PrivateKeys       []string                   `json:"-"`
	PublicKeys        []string                   `json:"-"`
	QuestionIndex     uint32                     `json:"questionIndex"`
	CreationTime      time.Time                  `json:"creationTime"`
	HaveResults       bool                       `json:"haveResults"`
	FinalResults      bool                       `json:"finalResults"`
	SourceBlockHeight uint64                     `json:"sourceBlockHeight"`
	SourceNetworkId   string                     `json:"sourceNetworkId"` // string form of the enum to be user friendly
	MaxCensusSize     uint64                     `json:"maxCensusSize"`
	RollingCensusSize uint64                     `json:"rollingCensusSize"`
}

Process represents an election process handled by the Vochain. The indexer Process data type is different from the vochain state data type since it is optimized for querying purposes and not for keeping a shared consensus state.

func ProcessFromDB

func ProcessFromDB(dbproc *indexerdb.Process) *Process

func (Process) String

func (p Process) String() string

type TokenTransferMeta

type TokenTransferMeta struct {
	Amount    uint64          `json:"amount"`
	From      types.AccountID `json:"from"`
	Height    uint64          `json:"height"`
	TxHash    types.Hash      `json:"txHash"`
	Timestamp time.Time       `json:"timestamp"`
	To        types.AccountID `json:"to"`
}

TokenTransferMeta contains the information of a token transfer and some extra useful information. The types are compatible with the SQL defined schema.

type TxMetadata

type TxMetadata struct {
	Type        string         `json:"type"`
	BlockHeight uint32         `json:"blockHeight,omitempty"`
	Index       int32          `json:"index"`
	Hash        types.HexBytes `json:"hash"`
}

TxMetadata contains tx information for the TransactionList api

type TxPackage

type TxPackage struct {
	Tx          []byte         `json:"tx"`
	ID          uint32         `json:"id,omitempty"`
	BlockHeight uint32         `json:"blockHeight,omitempty"`
	Index       *int32         `json:"index,omitempty"`
	Hash        types.HexBytes `json:"hash"`
	Signature   types.HexBytes `json:"signature"`
}

TxPackage contains a SignedTx and auxiliary information for the Transaction api

type TxReference

type TxReference struct {
	Index        uint64         `json:"transactionNumber"`
	Hash         types.HexBytes `json:"transactionHash"`
	BlockHeight  uint32         `json:"blockHeight"`
	TxBlockIndex int32          `json:"transactionIndex"`
	TxType       string         `json:"transactionType"`
}

TxReference holds the db reference for a single transaction

func TxReferenceFromDB

func TxReferenceFromDB(dbtx *indexerdb.TxReference) *TxReference

type VotePackage

type VotePackage struct {
	Nonce string `json:"nonce,omitempty"`
	Votes []int  `json:"votes"`
}

VotePackage represents the payload of a vote (usually base64 encoded)

type VoteReference

type VoteReference struct {
	Nullifier      types.HexBytes
	ProcessID      types.HexBytes
	VoterID        state.VoterID
	Height         uint32
	Weight         *types.BigInt
	TxIndex        int32
	CreationTime   time.Time
	OverwriteCount uint32
}

VoteReference holds the db reference for a single vote

func VoteReferenceFromDB

func VoteReferenceFromDB(dbvote *indexerdb.VoteReference) *VoteReference

Jump to

Keyboard shortcuts

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