database

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: LGPL-3.0 Imports: 16 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")
	PublicFlipKeyPrefix   = []byte("pubk")
	PrivateFlipKeyPrefix  = []byte("pk")
	LotteryIdentities     = []byte("li")
)
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 DbEvidenceMap added in v0.27.0

type DbEvidenceMap struct {
	Sender common.Address
	Map    []byte
}

type DbLotteryIdentity added in v0.28.5

type DbLotteryIdentity struct {
	Address                 common.Address
	ShiftedShardId          common.ShardId
	FlipCids                [][]byte
	PubKey                  []byte
	State                   uint8
	HasDoneAllRequiredFlips bool
}

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() []*DbEvidenceMap

func (*EpochDb) ReadLotteryIdentities added in v0.28.5

func (edb *EpochDb) ReadLotteryIdentities() []DbLotteryIdentity

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) ReadPrivateFlipKeys added in v0.22.0

func (edb *EpochDb) ReadPrivateFlipKeys() []*types.PrivateFlipKeysPackage

func (*EpochDb) ReadPublicFlipKeys added in v0.22.0

func (edb *EpochDb) ReadPublicFlipKeys() []*types.PublicFlipKey

func (*EpochDb) RemoveAnswerHash added in v0.27.0

func (edb *EpochDb) RemoveAnswerHash(address common.Address)

func (*EpochDb) RemoveEvidenceMap added in v0.27.0

func (edb *EpochDb) RemoveEvidenceMap(addr common.Address)

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) WriteLotteryIdentities added in v0.28.5

func (edb *EpochDb) WriteLotteryIdentities(identities []DbLotteryIdentity)

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) WritePrivateFlipKey added in v0.22.0

func (edb *EpochDb) WritePrivateFlipKey(key *types.PrivateFlipKeysPackage)

func (*EpochDb) WritePublicFlipKey added in v0.22.0

func (edb *EpochDb) WritePublicFlipKey(key *types.PublicFlipKey)

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) AddToBlackList added in v1.0.0

func (r *Repo) AddToBlackList(txHash common.Hash)

func (*Repo) DeleteOutdatedBurntCoins

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

func (*Repo) FinishApplyingTx added in v1.0.0

func (r *Repo) FinishApplyingTx(txHash common.Hash)

func (*Repo) GetSavedEvents added in v0.22.0

func (r *Repo) GetSavedEvents(contract common.Address) (events []*types.SavedEvent)

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) HasApplyingTxLog added in v1.0.0

func (r *Repo) HasApplyingTxLog(txHash common.Hash) bool

func (*Repo) IsInBlackList added in v1.0.0

func (r *Repo) IsInBlackList(txHash common.Hash) bool

func (*Repo) LastSnapshotManifest

func (r *Repo) LastSnapshotManifest() (cidV2 []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) ReadConsensusVersion added in v0.23.0

func (r *Repo) ReadConsensusVersion() uint32

func (*Repo) ReadHead

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

func (*Repo) ReadIdentityStateDiff

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

func (*Repo) ReadIntermediateGenesis added in v0.23.0

func (r *Repo) ReadIntermediateGenesis() uint64

func (*Repo) ReadPreliminaryConsensusVersion added in v0.23.0

func (r *Repo) ReadPreliminaryConsensusVersion() uint32

func (*Repo) ReadPreliminaryHead

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

func (*Repo) ReadPreliminaryIntermediateGenesis added in v0.23.0

func (r *Repo) ReadPreliminaryIntermediateGenesis() uint64

func (*Repo) ReadReceiptIndex added in v0.22.0

func (r *Repo) ReadReceiptIndex(hash common.Hash) *types.TxReceiptIndex

func (*Repo) ReadTxIndex

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

func (*Repo) ReadUpgradeVotes added in v0.23.0

func (r *Repo) ReadUpgradeVotes() *types.UpgradeVotes

func (*Repo) RemoveCanonicalHash

func (r *Repo) RemoveCanonicalHash(height uint64)

func (*Repo) RemoveHeader

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

func (*Repo) RemovePreliminaryConsensusVersion added in v0.23.0

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

func (*Repo) RemovePreliminaryHead

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

func (*Repo) RemovePreliminaryIntermediateGenesis added in v0.23.0

func (r *Repo) RemovePreliminaryIntermediateGenesis(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 int64, feePerGas *big.Int, transaction *types.Transaction)

func (*Repo) SetHead

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

func (*Repo) StartApplyingTx added in v1.0.0

func (r *Repo) StartApplyingTx(txHash common.Hash)

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) WriteConsensusVersion added in v0.23.0

func (r *Repo) WriteConsensusVersion(batch dbm.Batch, v uint32)

func (*Repo) WriteEvent added in v0.22.0

func (r *Repo) WriteEvent(contract common.Address, txHash common.Hash, idx uint32, event *types.TxEvent)

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) WriteIntermediateGenesis added in v0.23.0

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

func (*Repo) WriteLastSnapshotManifest

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

func (*Repo) WritePreliminaryConsensusVersion added in v0.23.0

func (r *Repo) WritePreliminaryConsensusVersion(v uint32)

func (*Repo) WritePreliminaryHead

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

func (*Repo) WritePreliminaryIntermediateGenesis added in v0.23.0

func (r *Repo) WritePreliminaryIntermediateGenesis(height uint64)

func (*Repo) WriteReceiptIndex added in v0.22.0

func (r *Repo) WriteReceiptIndex(hash common.Hash, idx *types.TxReceiptIndex)

func (*Repo) WriteTxIndex

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

func (*Repo) WriteUpgradeVotes added in v0.23.0

func (r *Repo) WriteUpgradeVotes(votes *types.UpgradeVotes)

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