database

package
v0.0.0-...-52431d2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder(cfg *config.Config, codec *params.EncodingConfig) (db.Database, error)

Builder allows to create a new BigDipperDb instance implementing the database.Builder type

Types

type BigDipperDb

type BigDipperDb struct {
	*postgresql.Database
	Sqlx *sqlx.DB
}

BigDipperDb represents a PostgreSQL database with expanded features. so that it can properly store custom BigDipper-related data.

func Cast

func Cast(db db.Database) *BigDipperDb

Cast allows to cast the given db to a BigDipperDb instance

func (*BigDipperDb) GetAccounts

func (db *BigDipperDb) GetAccounts() ([]string, error)

GetAccounts returns all the accounts that are currently stored inside the database.

func (*BigDipperDb) GetBlockHeightTimeDayAgo

func (db *BigDipperDb) GetBlockHeightTimeDayAgo(now time.Time) (dbtypes.BlockRow, error)

GetBlockHeightTimeDayAgo return block height and time that a block proposals about a day (24hour) ago from input date

func (*BigDipperDb) GetBlockHeightTimeHourAgo

func (db *BigDipperDb) GetBlockHeightTimeHourAgo(now time.Time) (dbtypes.BlockRow, error)

GetBlockHeightTimeHourAgo return block height and time that a block proposals about a hour ago from input date

func (*BigDipperDb) GetBlockHeightTimeMinuteAgo

func (db *BigDipperDb) GetBlockHeightTimeMinuteAgo(now time.Time) (dbtypes.BlockRow, error)

GetBlockHeightTimeMinuteAgo return block height and time that a block proposals about a minute ago from input date

func (*BigDipperDb) GetDelegatorsForHeight

func (db *BigDipperDb) GetDelegatorsForHeight(height int64) ([]string, error)

GetDelegatorsForHeight returns the delegators addresses for the given height

func (*BigDipperDb) GetGenesisTime

func (db *BigDipperDb) GetGenesisTime() (time.Time, error)

GetGenesisTime get genesis time of chain (only work if x/consensus enabled)

func (*BigDipperDb) GetLastBlock

func (db *BigDipperDb) GetLastBlock() (*dbtypes.BlockRow, error)

GetLastBlock returns the last block stored inside the database based on the heights

func (*BigDipperDb) GetLastBlockHeight

func (db *BigDipperDb) GetLastBlockHeight() (int64, error)

GetLastBlockHeight returns the last block height stored inside the database

func (*BigDipperDb) GetStakingParams

func (db *BigDipperDb) GetStakingParams() (*types.StakingParams, error)

GetStakingParams returns the types.StakingParams instance containing the current params

func (*BigDipperDb) GetTokenNames

func (db *BigDipperDb) GetTokenNames() ([]string, error)

GetTokenNames returns the list of token names stored inside the supply table

func (*BigDipperDb) GetValidator

func (db *BigDipperDb) GetValidator(valAddress string) (types.Validator, error)

GetValidator returns the validator having the given address. If no validator for such address can be found, an error is returned instead.

func (*BigDipperDb) GetValidatorConsensusAddress

func (db *BigDipperDb) GetValidatorConsensusAddress(address string) (sdk.ConsAddress, error)

GetValidatorConsensusAddress returns the consensus address of the validator having the given operator address

func (*BigDipperDb) GetValidators

func (db *BigDipperDb) GetValidators() ([]dbtypes.ValidatorData, error)

GetValidators returns all the validators that are currently stored inside the database.

func (*BigDipperDb) InsertEnableModules

func (db *BigDipperDb) InsertEnableModules(modules []string) error

UpdateEnableModules allows to save enabled module into the database

func (*BigDipperDb) Prune

func (db *BigDipperDb) Prune(height int64) error

Prune implements db.PruningDb

func (*BigDipperDb) SaveAccountBalances

func (db *BigDipperDb) SaveAccountBalances(balances []bbanktypes.AccountBalance) error

SaveAccountBalances allows to store the balance for the given account associating it to the given height

func (*BigDipperDb) SaveAccounts

func (db *BigDipperDb) SaveAccounts(accounts []authttypes.AccountI) error

SaveAccount saves the given account information for the given block height and timestamp

func (*BigDipperDb) SaveAverageBlockTimeGenesis

func (db *BigDipperDb) SaveAverageBlockTimeGenesis(averageTime float64, height int64) error

SaveAverageBlockTimeGenesis save the average block time in average_block_time_from_genesis table

func (*BigDipperDb) SaveAverageBlockTimePerDay

func (db *BigDipperDb) SaveAverageBlockTimePerDay(averageTime float64, height int64) error

SaveAverageBlockTimePerDay save the average block time in average_block_time_per_day table

func (*BigDipperDb) SaveAverageBlockTimePerHour

func (db *BigDipperDb) SaveAverageBlockTimePerHour(averageTime float64, height int64) error

SaveAverageBlockTimePerHour save the average block time in average_block_time_per_hour table

func (*BigDipperDb) SaveAverageBlockTimePerMin

func (db *BigDipperDb) SaveAverageBlockTimePerMin(averageTime float64, height int64) error

SaveAverageBlockTimePerMin save the average block time in average_block_time_per_minute table

func (*BigDipperDb) SaveCommunityPool

func (db *BigDipperDb) SaveCommunityPool(coin sdk.DecCoins, height int64) error

SaveCommunityPool allows to save for the given height the given total amount of coins

func (*BigDipperDb) SaveConsensus

func (db *BigDipperDb) SaveConsensus(event *constypes.ConsensusEvent) error

SaveConsensus allows to properly store the given consensus event into the database. Note that only one consensus event is allowed inside the database at any time.

func (*BigDipperDb) SaveDelegations

func (db *BigDipperDb) SaveDelegations(delegations []types.Delegation) error

SaveDelegations stores inside the database the given delegations data. It assumes that the validators addresses are already present inside the proper database table. TIP: To store the validators data call SaveValidators.

func (*BigDipperDb) SaveDelegatorsRewardsAmounts

func (db *BigDipperDb) SaveDelegatorsRewardsAmounts(amounts []bdistrtypes.DelegatorRewardAmount) error

SaveDelegatorsRewardsAmounts saves the given delegator commission amounts for the provided height

func (*BigDipperDb) SaveDeposit

func (db *BigDipperDb) SaveDeposit(deposit types.Deposit) error

SaveDeposit allows to save for the given message deposit and height

func (*BigDipperDb) SaveDeposits

func (db *BigDipperDb) SaveDeposits(deposits []types.Deposit) error

SaveDeposits allows to save multiple deposits

func (*BigDipperDb) SaveDoubleSignEvidence

func (db *BigDipperDb) SaveDoubleSignEvidence(evidence types.DoubleSignEvidence) error

SaveDoubleSignEvidence saves the given double sign evidence inside the proper tables

func (*BigDipperDb) SaveGenesisData

func (db *BigDipperDb) SaveGenesisData(genesis *tmtypes.GenesisDoc) error

SaveGenesisHeight save the genesis height

func (*BigDipperDb) SaveInflation

func (db *BigDipperDb) SaveInflation(inflation sdk.Dec, height int64) error

SaveInflation allows to store the inflation for the given block height as well as timestamp

func (*BigDipperDb) SaveProposal

func (db *BigDipperDb) SaveProposal(proposal types.Proposal) error

SaveProposal save a single proposal

func (*BigDipperDb) SaveProposals

func (db *BigDipperDb) SaveProposals(proposals []types.Proposal) error

SaveProposals allows to save for the given height the given total amount of coins

func (*BigDipperDb) SaveRedelegations

func (db *BigDipperDb) SaveRedelegations(redelegations []types.Redelegation) error

SaveRedelegations saves the given redelegations inside the database. It assumes that all the validators as well as all the delegators addresses are already present inside the proper tables of the database. To store the validators data call SaveValidatorData(s). To store the account data call SaveAccount.

func (*BigDipperDb) SaveSlashingParams

func (db *BigDipperDb) SaveSlashingParams(params slashingtypes.Params, height int64) error

SaveSlashingParams saves the slashing params for the given height

func (*BigDipperDb) SaveStakingParams

func (db *BigDipperDb) SaveStakingParams(params types.StakingParams) error

SaveStakingParams allows to store the given params into the database

func (*BigDipperDb) SaveStakingPool

func (db *BigDipperDb) SaveStakingPool(pool stakingtypes.Pool, height int64) error

SaveStakingPool allows to save for the given height the given stakingtypes pool

func (*BigDipperDb) SaveSupplyToken

func (db *BigDipperDb) SaveSupplyToken(coins sdk.Coins, height int64) error

SaveSupplyTokenPool allows to save for the given height the given total amount of coins

func (*BigDipperDb) SaveTallyResults

func (db *BigDipperDb) SaveTallyResults(tallys []types.TallyResult) error

SaveTallyResults allows to save for the given height the given total amount of coins

func (*BigDipperDb) SaveTokensPrices

func (db *BigDipperDb) SaveTokensPrices(tickers types.MarketTickers, timestamp time.Time) error

SaveTokensPrices allows to save the given tickers associating them to the given timestamp

func (*BigDipperDb) SaveUnbondingDelegations

func (db *BigDipperDb) SaveUnbondingDelegations(delegations []types.UnbondingDelegation) error

SaveUnbondingDelegations saves the given unbonding delegations into the database. It assumes that all the validators as well as all the delegators addresses are already present inside the proper tables of the database. To store the validators data call SaveValidatorData(s). To store the account data call SaveAccount.

func (*BigDipperDb) SaveValidatorCommission

func (db *BigDipperDb) SaveValidatorCommission(data types.ValidatorCommission) error

SaveValidatorCommission saves a single validator commission. It assumes that the delegator address is already present inside the proper database table. TIP: To store the validator data call SaveValidatorData.

func (*BigDipperDb) SaveValidatorCommissionAmount

func (db *BigDipperDb) SaveValidatorCommissionAmount(amount bdistrtypes.ValidatorCommissionAmount) error

SaveValidatorCommissionAmounts saves the given validator commission amounts for the given height

func (*BigDipperDb) SaveValidatorData

func (db *BigDipperDb) SaveValidatorData(validator types.Validator) error

SaveValidatorData saves properly the information about the given validator.

func (*BigDipperDb) SaveValidatorDescription

func (db *BigDipperDb) SaveValidatorDescription(description types.ValidatorDescription) error

SaveValidatorDescription save a single validator description. It assumes that the delegator address is already present inside the proper database table. TIP: To store the validator data call SaveValidatorData.

func (*BigDipperDb) SaveValidators

func (db *BigDipperDb) SaveValidators(validators []types.Validator) error

SaveValidators allows the bulk saving of a list of validators.

func (*BigDipperDb) SaveValidatorsSigningInfos

func (db *BigDipperDb) SaveValidatorsSigningInfos(infos []types.ValidatorSigningInfo) error

SaveValidatorsSigningInfos saves the given infos inside the database

func (*BigDipperDb) SaveValidatorsStatuses

func (db *BigDipperDb) SaveValidatorsStatuses(statuses []types.ValidatorStatus) error

SaveValidatorsStatuses save validator jail and status in the given height and timestamp

func (*BigDipperDb) SaveValidatorsVotingPowers

func (db *BigDipperDb) SaveValidatorsVotingPowers(entries []types.ValidatorVotingPower) error

SaveValidatorsVotingPowers saves the given validator voting powers. It assumes that the delegator address is already present inside the proper database table. TIP: To store the validator data call SaveValidatorData.

func (*BigDipperDb) SaveVote

func (db *BigDipperDb) SaveVote(vote types.Vote) error

SaveVote allows to save for the given height and the message vote

func (*BigDipperDb) UpdateProposal

func (db *BigDipperDb) UpdateProposal(proposal types.Proposal) error

UpdateProposal updates a proposal stored inside the database

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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