indexertypes

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxQuestions is the maximum number of questions allowed in a VotePackage
	MaxQuestions = 64
	// MaxOptions is the maximum number of options allowed in a VotePackage question
	MaxOptions = 128
)
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 NewEmptyVotes

func NewEmptyVotes(questions, options int) [][]*big.Int

NewEmptyVotes creates a new results struct with the given number of questions and options

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:"num_txs"`
	LastBlockHash   types.HexBytes `json:"last_block_hash"`
	ProposerAddress types.HexBytes `json:"proposer_address"`
}

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 `badgerholdKey:"Type"`
	Count uint64
}

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

type Entity

type Entity struct {
	ID           types.HexBytes `badgerholdKey:"ID"`
	ProcessCount uint32
	CreationTime time.Time
}

Entity holds the db reference for an entity

type EnvelopeMetadata

type EnvelopeMetadata struct {
	ProcessId types.HexBytes `json:"process_id"`
	Nullifier types.HexBytes `json:"nullifier"`
	TxIndex   int32          `json:"tx_index"`
	Height    uint32         `json:"height"`
	TxHash    types.HexBytes `json:"tx_hash"`
}

EnvelopeMetadata contains vote information for the EnvelopeList api

type EnvelopePackage

type EnvelopePackage struct {
	EncryptionKeyIndexes []uint32         `json:"encryption_key_indexes"`
	Meta                 EnvelopeMetadata `json:"meta"`
	Nonce                types.HexBytes   `json:"nonce"`
	Signature            types.HexBytes   `json:"signature"`
	VotePackage          []byte           `json:"vote_package"`
	Weight               string           `json:"weight"`
}

EnvelopePackage contains a VoteEnvelope and auxiliary information for the Envelope api

type Process

type Process struct {
	ID                types.HexBytes             `badgerholdKey:"ID" json:"processId"`
	EntityID          types.HexBytes             `badgerholdIndex:"EntityID" json:"entityId"`
	EntityIndex       uint32                     `json:"entityIndex"`
	StartBlock        uint32                     `json:"startBlock"`
	EndBlock          uint32                     `badgerholdIndex:"EndBlock" json:"endBlock"`
	Rheight           uint32                     `badgerholdIndex:"Rheight" json:"-"`
	CensusRoot        types.HexBytes             `json:"censusRoot"`
	CensusURI         string                     `json:"censusURI"`
	Metadata          string                     `json:"metadata"`
	CensusOrigin      int32                      `json:"censusOrigin"`
	Status            int32                      `badgerholdIndex:"Status" json:"status"`
	Namespace         uint32                     `badgerholdIndex:"Namespace" 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                     `badgerholdIndex:"SourceNetworkId" json:"sourceNetworkId"`
}

Process represents an election process handled by the Vochain. The scrutinizer 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 (Process) String

func (p Process) String() string

type Results

type Results struct {
	ProcessID      types.HexBytes             `badgerholdKey:"ProcessID" json:"processId"`
	Votes          [][]*big.Int               `json:"votes"`
	Weight         *big.Int                   `json:"weight"`
	EnvelopeHeight uint64                     `json:"envelopeHeight"`
	EnvelopeType   *models.EnvelopeType       `json:"envelopeType"`
	VoteOpts       *models.ProcessVoteOptions `json:"voteOptions"`
	Signatures     []types.HexBytes           `json:"signatures"`
	Final          bool                       `json:"final"`
	BlockHeight    uint32                     `json:"blockHeight"`
}

Results holds the final results and relevant process info for a vochain process

func (*Results) Add

func (r *Results) Add(new *Results) error

Add adds the total weight and votes from the given Results to the containing Results making the method call.

func (*Results) AddVote

func (r *Results) AddVote(voteValues []int, weight *big.Int, mutex *sync.Mutex) error

AddVote adds the voteValues and weight to the Results struct. Checks are performed according the Ballot Protocol.

func (*Results) String

func (r *Results) String() string

String formats the results in a human-readable string

type ScrutinizerOnProcessData

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

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

type TxMetadata

type TxMetadata struct {
	Type        string         `json:"type"`
	BlockHeight uint32         `json:"block_height,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"`
	Height      uint32         `json:"height,omitempty"`
	BlockHeight uint32         `json:"block_height,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 `badgerholdKey:"Index"`
	BlockHeight  uint32
	TxBlockIndex int32
}

TxReference holds the db reference for a single transaction

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 `badgerholdKey:"Nullifier"`
	ProcessID    types.HexBytes `badgerholdIndex:"ProcessID"`
	Height       uint32
	Weight       *big.Int
	TxIndex      int32
	CreationTime time.Time
}

VoteReference holds the db reference for a single vote

Jump to

Keyboard shortcuts

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