storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Separator string = "_"

	ConsulsKey                   Key = "consuls"
	ConsulsCandidateKey          Key = "consuls_candidate"
	LastHeightKey                Key = "last_height"
	LastRoundApproved            Key = "last_round_approved"
	ConsulsCountKey              Key = "consuls_count"
	SignConsulsResultByConsulKey Key = "consuls_sing"
	SignOraclesResultByConsulKey Key = "oracles_sign"
	NebulaeByOracleKey           Key = "nebulae_by_oracle"
	NebulaOraclesIndexKey        Key = "nebula_oracles_index"
	OraclesByNebulaKey           Key = "oracles_by_nebula"
	BftOraclesByNebulaKey        Key = "bft_oracles_nebula"
	OraclesByValidatorKey        Key = "oracles"

	BlockKey      Key = "block"
	VoteKey       Key = "vote"
	ScoreKey      Key = "score"
	CommitKey     Key = "commit"
	RevealKey     Key = "reveal"
	SignResultKey Key = "signResult"
	NebulaInfoKey Key = "nebula_info"
)

Variables

View Source
var (
	ErrKeyNotFound = badger.ErrKeyNotFound
)

Functions

This section is empty.

Types

type Consul

type Consul struct {
	PubKey account.ConsulPubKey
	Value  uint64
}

type Key

type Key string

type NebulaInfo

type NebulaInfo struct {
	MaxPulseCountInBlock uint64
	MinScore             uint64
	ChainType            account.ChainType
	Owner                account.ConsulPubKey
}

type NebulaMap

type NebulaMap map[string]NebulaInfo

type OraclesByTypeMap

type OraclesByTypeMap map[account.ChainType]account.OraclesPubKey

type OraclesMap

type OraclesMap map[string]account.ChainType

type ScoresByConsulMap

type ScoresByConsulMap map[account.ConsulPubKey]uint64

type Storage

type Storage struct {
	// contains filtered or unexported fields
}

func New

func New() *Storage

func (*Storage) BftOraclesByNebula

func (storage *Storage) BftOraclesByNebula(nebulaId account.NebulaId) (OraclesMap, error)

func (*Storage) Commit

func (storage *Storage) Commit() error

func (*Storage) CommitHash

func (storage *Storage) CommitHash(nebulaId account.NebulaId, tcHeight int64, pulseId int64, oraclePubKey account.OraclesPubKey) ([]byte, error)

func (*Storage) Consuls

func (storage *Storage) Consuls() ([]Consul, error)

func (*Storage) ConsulsCandidate

func (storage *Storage) ConsulsCandidate() ([]Consul, error)

func (*Storage) ConsulsCount

func (storage *Storage) ConsulsCount() (int, error)

func (*Storage) LastHeight

func (storage *Storage) LastHeight() (uint64, error)

func (*Storage) LastRoundApproved

func (storage *Storage) LastRoundApproved() (uint64, error)

func (*Storage) NebulaInfo

func (storage *Storage) NebulaInfo(nebulaId account.NebulaId) (*NebulaInfo, error)

func (*Storage) NebulaOraclesIndex

func (storage *Storage) NebulaOraclesIndex(nebulaAddress account.NebulaId) (uint64, error)

func (*Storage) Nebulae

func (storage *Storage) Nebulae() (NebulaMap, error)

func (*Storage) NebulaeByOracle

func (storage *Storage) NebulaeByOracle(pubKey account.OraclesPubKey) ([]account.NebulaId, error)

func (*Storage) NewTransaction

func (storage *Storage) NewTransaction(db *badger.DB)

func (*Storage) OraclesByConsul

func (storage *Storage) OraclesByConsul(pubKey account.ConsulPubKey) (OraclesByTypeMap, error)

func (*Storage) OraclesByNebula

func (storage *Storage) OraclesByNebula(nebulaId account.NebulaId) (OraclesMap, error)

func (*Storage) Result

func (storage *Storage) Result(nebulaId account.NebulaId, pulseId int64, oraclePubKey account.OraclesPubKey) ([]byte, error)

func (*Storage) Results

func (storage *Storage) Results(nebulaId account.NebulaId, pulseId uint64) ([]string, error)

func (*Storage) Reveal

func (storage *Storage) Reveal(nebulaId account.NebulaId, height int64, pulseId int64, commitHash []byte, oraclePubKey account.OraclesPubKey) ([]byte, error)

func (*Storage) Reveals

func (storage *Storage) Reveals(nebulaId account.NebulaId, height int64, pulseId int64) ([]string, error)

func (*Storage) RoundHeight

func (storage *Storage) RoundHeight(chainType account.ChainType, ledgerHeight uint64) (uint64, error)

func (*Storage) Score

func (storage *Storage) Score(pubKey account.ConsulPubKey) (uint64, error)

func (*Storage) Scores

func (storage *Storage) Scores() (ScoresByConsulMap, error)

func (*Storage) SetBftOraclesByNebula

func (storage *Storage) SetBftOraclesByNebula(nebulaId account.NebulaId, oracles OraclesMap) error

func (*Storage) SetCommitHash

func (storage *Storage) SetCommitHash(nebulaId account.NebulaId, tcHeight int64, pulseId int64, oraclePubKey account.OraclesPubKey, commit []byte) error

func (*Storage) SetConsuls

func (storage *Storage) SetConsuls(consuls []Consul) error

func (*Storage) SetConsulsCandidate

func (storage *Storage) SetConsulsCandidate(consuls []Consul) error

func (*Storage) SetConsulsCount

func (storage *Storage) SetConsulsCount(consulsCount int) error

func (*Storage) SetLastHeight

func (storage *Storage) SetLastHeight(height uint64) error

func (*Storage) SetLastRoundApproved

func (storage *Storage) SetLastRoundApproved(roundId uint64) error

func (*Storage) SetNebula

func (storage *Storage) SetNebula(nebulaId account.NebulaId, info NebulaInfo) error

func (*Storage) SetNebulaOraclesIndex

func (storage *Storage) SetNebulaOraclesIndex(nebulaAddress account.NebulaId, index uint64) error

func (*Storage) SetNebulaeByOracle

func (storage *Storage) SetNebulaeByOracle(pubKey account.OraclesPubKey, nebulae []account.NebulaId) error

func (*Storage) SetNewRound

func (storage *Storage) SetNewRound(chainType account.ChainType, ledgerHeight uint64, tcHeight uint64) error

func (*Storage) SetOraclesByConsul

func (storage *Storage) SetOraclesByConsul(pubKey account.ConsulPubKey, oracles OraclesByTypeMap) error

func (*Storage) SetOraclesByNebula

func (storage *Storage) SetOraclesByNebula(nebulaAddress account.NebulaId, oracles OraclesMap) error

func (*Storage) SetResult

func (storage *Storage) SetResult(nebulaId account.NebulaId, pulseId int64, oraclePubKey account.OraclesPubKey, sign []byte) error

func (*Storage) SetReveal

func (storage *Storage) SetReveal(nebulaId account.NebulaId, height int64, pulseId int64, commitHash []byte, oraclePubKey account.OraclesPubKey, reveal []byte) error

func (*Storage) SetScore

func (storage *Storage) SetScore(pubKey account.ConsulPubKey, score uint64) error

func (*Storage) SetSignConsuls

func (storage *Storage) SetSignConsuls(consulsPubKey account.ConsulPubKey, chainType account.ChainType, roundId int64, sign []byte) error

func (*Storage) SetSignOracles

func (storage *Storage) SetSignOracles(pubKey account.ConsulPubKey, nebulaId account.NebulaId, roundId int64, sign []byte) error

func (*Storage) SetVote

func (storage *Storage) SetVote(pubKey account.ConsulPubKey, votes []Vote) error

func (*Storage) SignConsulsByConsul

func (storage *Storage) SignConsulsByConsul(consulPubKey account.ConsulPubKey, chainType account.ChainType, roundId int64) ([]byte, error)

func (*Storage) SignOraclesByConsul

func (storage *Storage) SignOraclesByConsul(pubKey account.ConsulPubKey, nebulaId account.NebulaId, roundId int64) ([]byte, error)

func (*Storage) Vote

func (storage *Storage) Vote(pubKey account.ConsulPubKey) ([]Vote, error)

func (*Storage) Votes

func (storage *Storage) Votes() (VoteByConsulMap, error)

type Vote

type Vote struct {
	PubKey account.ConsulPubKey
	Score  uint64
}

type VoteByConsulMap

type VoteByConsulMap map[account.ConsulPubKey][]Vote

Jump to

Keyboard shortcuts

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