database

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: LGPL-3.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxWeakCertificatesCount = 100
)

Variables

View Source
var (
	OwnShortAnswerKey     = []byte("own-short")
	AnswerHashPrefix      = []byte("hash")
	ShortAnswersKey       = []byte("answers-short")
	LongShortAnswersKey   = []byte("answers-long")
	TxOwnPrefix           = []byte("tx")
	SuccessfulTxOwnPrefix = []byte("s-tx")
	EvidencePrefix        = []byte("evi")
	LotterySeedKey        = []byte("ls")
	FlipCidPrefix         = []byte("cid")
)
View Source
var (
	SnapshotDbPrefix = []byte("snpsht")
)

Functions

This section is empty.

Types

type BackedMemDb

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

func NewBackedMemDb

func NewBackedMemDb(permanent db.DB) *BackedMemDb

func (*BackedMemDb) Close

func (db *BackedMemDb) Close() error

func (*BackedMemDb) Delete

func (db *BackedMemDb) Delete(key []byte) error

func (*BackedMemDb) DeleteSync

func (db *BackedMemDb) DeleteSync(key []byte) error

func (*BackedMemDb) Get

func (db *BackedMemDb) Get(key []byte) ([]byte, error)

func (*BackedMemDb) Has

func (db *BackedMemDb) Has(key []byte) (bool, error)

func (*BackedMemDb) Iterator

func (db *BackedMemDb) Iterator(start, end []byte) (db.Iterator, error)

func (*BackedMemDb) NewBatch

func (db *BackedMemDb) NewBatch() db.Batch

func (*BackedMemDb) Print

func (db *BackedMemDb) Print() error

func (*BackedMemDb) ReverseIterator

func (db *BackedMemDb) ReverseIterator(start, end []byte) (db.Iterator, error)

func (*BackedMemDb) Set

func (db *BackedMemDb) Set(key []byte, value []byte) error

func (*BackedMemDb) SetSync

func (db *BackedMemDb) SetSync(key []byte, value []byte) error

func (*BackedMemDb) Stats

func (db *BackedMemDb) Stats() map[string]string

type DbAnswer

type DbAnswer struct {
	Addr common.Address
	Ans  []byte
}

type DbProof

type DbProof struct {
	Addr  common.Address
	Proof []byte
}

type EpochDb

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

func NewEpochDb

func NewEpochDb(db dbm.DB, epoch uint16) *EpochDb

func (*EpochDb) Clear

func (edb *EpochDb) Clear()

func (*EpochDb) DeleteFlipCid

func (edb *EpochDb) DeleteFlipCid(cid []byte)

func (*EpochDb) GetAnswerHash

func (edb *EpochDb) GetAnswerHash(address common.Address) common.Hash

func (*EpochDb) GetAnswers

func (edb *EpochDb) GetAnswers() map[common.Address]common.Hash

func (*EpochDb) GetConfirmedRespondents

func (edb *EpochDb) GetConfirmedRespondents(start time.Time, end time.Time) []common.Address

func (*EpochDb) HasAnswerHash

func (edb *EpochDb) HasAnswerHash(addr common.Address) bool

func (*EpochDb) HasEvidenceMap

func (edb *EpochDb) HasEvidenceMap(addr common.Address) bool

func (*EpochDb) HasFlipCid

func (edb *EpochDb) HasFlipCid(cid []byte) bool

func (*EpochDb) HasSuccessfulOwnTx

func (edb *EpochDb) HasSuccessfulOwnTx(txHash common.Hash) bool

func (*EpochDb) IterateOverFlipCids

func (edb *EpochDb) IterateOverFlipCids(callback func(cid []byte))

func (*EpochDb) ReadAnswers

func (edb *EpochDb) ReadAnswers() (short []DbAnswer, long []DbAnswer)

func (*EpochDb) ReadEvidenceMaps

func (edb *EpochDb) ReadEvidenceMaps() [][]byte

func (*EpochDb) ReadLotterySeed

func (edb *EpochDb) ReadLotterySeed() []byte

func (*EpochDb) ReadOwnShortAnswersBits

func (edb *EpochDb) ReadOwnShortAnswersBits() []byte

func (*EpochDb) ReadOwnTx

func (edb *EpochDb) ReadOwnTx(txType uint16) []byte

func (*EpochDb) RemoveOwnTx

func (edb *EpochDb) RemoveOwnTx(txType uint16)

func (*EpochDb) WriteAnswerHash

func (edb *EpochDb) WriteAnswerHash(address common.Address, hash common.Hash, timestamp time.Time)

func (*EpochDb) WriteAnswers

func (edb *EpochDb) WriteAnswers(short []DbAnswer, long []DbAnswer)

func (*EpochDb) WriteEvidenceMap

func (edb *EpochDb) WriteEvidenceMap(addr common.Address, bitmap []byte)

func (*EpochDb) WriteFlipCid

func (edb *EpochDb) WriteFlipCid(cid []byte)

func (*EpochDb) WriteLotterySeed

func (edb *EpochDb) WriteLotterySeed(seed []byte)

func (*EpochDb) WriteOwnShortAnswers

func (edb *EpochDb) WriteOwnShortAnswers(answers *types.Answers)

func (*EpochDb) WriteOwnTx

func (edb *EpochDb) WriteOwnTx(txType uint16, tx []byte)

func (*EpochDb) WriteSuccessfulOwnTx

func (edb *EpochDb) WriteSuccessfulOwnTx(txHash common.Hash)

type Repo

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

func NewRepo

func NewRepo(db dbm.DB) *Repo

func (*Repo) DeleteOutdatedBurntCoins

func (r *Repo) DeleteOutdatedBurntCoins(blockHeight uint64, blockRange uint64)

func (*Repo) GetSavedTxs

func (r *Repo) GetSavedTxs(address common.Address, count int, token []byte) (txs []*types.SavedTransaction, nextToken []byte)

func (*Repo) GetTotalBurntCoins

func (r *Repo) GetTotalBurntCoins() []*types.BurntCoins

func (*Repo) LastSnapshotManifest

func (r *Repo) LastSnapshotManifest() (cid []byte, root common.Hash, height uint64, fileName string)

func (*Repo) ReadActivity

func (r *Repo) ReadActivity() *types.ActivityMonitor

func (*Repo) ReadBlockHeader

func (r *Repo) ReadBlockHeader(hash common.Hash) *types.Header

func (*Repo) ReadCanonicalHash

func (r *Repo) ReadCanonicalHash(height uint64) common.Hash

func (*Repo) ReadCertificate

func (r *Repo) ReadCertificate(hash common.Hash) *types.BlockCert

func (*Repo) ReadHead

func (r *Repo) ReadHead() *types.Header

func (*Repo) ReadIdentityStateDiff

func (r *Repo) ReadIdentityStateDiff(height uint64) []byte

func (*Repo) ReadPreliminaryHead

func (r *Repo) ReadPreliminaryHead() *types.Header

func (*Repo) ReadTxIndex

func (r *Repo) ReadTxIndex(hash common.Hash) *types.TransactionIndex

func (*Repo) RemoveCanonicalHash

func (r *Repo) RemoveCanonicalHash(height uint64)

func (*Repo) RemoveHeader

func (r *Repo) RemoveHeader(hash common.Hash)

func (*Repo) RemovePreliminaryHead

func (r *Repo) RemovePreliminaryHead(batch dbm.Batch)

func (*Repo) SaveBurntCoins

func (r *Repo) SaveBurntCoins(blockHeight uint64, txHash common.Hash, address common.Address, key string, amount *big.Int)

func (*Repo) SaveTx

func (r *Repo) SaveTx(address common.Address, blockHash common.Hash, timestamp uint64, feePerByte *big.Int, transaction *types.Transaction)

func (*Repo) SetHead

func (r *Repo) SetHead(batch dbm.Batch, height uint64)

func (*Repo) WriteActivity

func (r *Repo) WriteActivity(monitor *types.ActivityMonitor)

func (*Repo) WriteBlockHeader

func (r *Repo) WriteBlockHeader(header *types.Header)

func (*Repo) WriteCanonicalHash

func (r *Repo) WriteCanonicalHash(height uint64, hash common.Hash)

func (*Repo) WriteCertificate

func (r *Repo) WriteCertificate(hash common.Hash, cert *types.BlockCert)

func (*Repo) WriteFinalConsensus

func (r *Repo) WriteFinalConsensus(hash common.Hash)

func (*Repo) WriteHead

func (r *Repo) WriteHead(batch dbm.Batch, header *types.Header)

func (*Repo) WriteIdentityStateDiff

func (r *Repo) WriteIdentityStateDiff(height uint64, diff []byte)

func (*Repo) WriteLastSnapshotManifest

func (r *Repo) WriteLastSnapshotManifest(cid []byte, root common.Hash, height uint64, fileName string) error

func (*Repo) WritePreliminaryHead

func (r *Repo) WritePreliminaryHead(header *types.Header)

func (*Repo) WriteTxIndex

func (r *Repo) WriteTxIndex(txHash common.Hash, index *types.TransactionIndex)

func (*Repo) WriteWeakCertificate

func (r *Repo) WriteWeakCertificate(hash common.Hash)

Jump to

Keyboard shortcuts

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