reader

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

README

对外暴露的读能力

// 内核提供 PreExec(ctx context.Context, in *pb.InvokeRPCRequest) (*pb.InvokeRPCResponse, error) { // 内核提供 PostTx(ctx context.Context, in *pb.TxStatus) (*pb.CommonReply, error) {

// 服务组合内核提供接口提供 BatchPostTx(ctx context.Context, in *pb.BatchTxs) (*pb.CommonReply, error) { // 服务组合内核提供接口提供 PreExecWithSelectUTXO(ctx context.Context, in *pb.PreExecWithSelectUTXORequest) (*pb.PreExecWithSelectUTXOResponse, error) { // 引擎有提供 GetBlockChains(ctx context.Context, in *pb.CommonIn) (*pb.BlockChains, error) {

// 链信息读组件提供 GetBlockChainStatus(ctx context.Context, in *pb.BCStatus) (*pb.BCStatus, error) { ConfirmBlockChainStatus(ctx context.Context, in *pb.BCStatus) (*pb.BCTipStatus, error) { GetSystemStatus(ctx context.Context, in *pb.CommonIn) (*pb.SystemsStatusReply, error) { GetNetURL(ctx context.Context, in *pb.CommonIn) (*pb.RawUrl, error) {

// 账本读组件提供 QueryTx(ctx context.Context, in *pb.TxStatus) (*pb.TxStatus, error) { GetBlock(ctx context.Context, in *pb.BlockID) (*pb.Block, error) { GetBlockByHeight(ctx context.Context, in *pb.BlockHeight) (*pb.Block, error) {

// 合约读组件提供 QueryContractStatData(ctx context.Context, in *pb.ContractStatDataRequest) (*pb.ContractStatDataResponse, error) { GetAccountContracts(ctx context.Context, in *pb.GetAccountContractsRequest) (*pb.GetAccountContractsResponse, error) { GetAddressContracts(ctx context.Context, in *pb.AddressContractsRequest) (*pb.AddressContractsResponse, error) { GetAccountByAK(ctx context.Context, in *pb.AK2AccountRequest) (*pb.AK2AccountResponse, error) { QueryACL(ctx context.Context, in *pb.AclStatus) (*pb.AclStatus, error) {

// utxo读组件提供 QueryUtxoRecord(ctx context.Context, in *pb.UtxoRecordDetail) (*pb.UtxoRecordDetail, error) { GetBalance(ctx context.Context, in *pb.AddressStatus) (*pb.AddressStatus, error) { GetFrozenBalance(ctx context.Context, in *pb.AddressStatus) (*pb.AddressStatus, error) { GetBalanceDetail(ctx context.Context, in *pb.AddressBalanceStatus) (*pb.AddressBalanceStatus, error) { SelectUTXOBySize(ctx context.Context, in *pb.UtxoInput) (*pb.UtxoOutput, error) { SelectUTXO(ctx context.Context, in *pb.UtxoInput) (*pb.UtxoOutput, error) {

// 共识读组件提供 DposCandidates(ctx context.Context, in *pb.DposCandidatesRequest) (*pb.DposCandidatesResponse, error) { DposNominateRecords(ctx context.Context, in *pb.DposNominateRecordsRequest) (*pb.DposNominateRecordsResponse, error) { DposNomineeRecords(ctx context.Context, in *pb.DposNomineeRecordsRequest) (*pb.DposNomineeRecordsResponse, error) { DposVoteRecords(ctx context.Context, in *pb.DposVoteRecordsRequest) (*pb.DposVoteRecordsResponse, error) { DposVotedRecords(ctx context.Context, in *pb.DposVotedRecordsRequest) (*pb.DposVotedRecordsResponse, error) { DposCheckResults(ctx context.Context, in *pb.DposCheckResultsRequest) (*pb.DposCheckResultsResponse, error) { DposStatus(ctx context.Context, in *pb.DposStatusRequest) (*pb.DposStatusResponse, error) {

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// leveldb: not found
	DBNotFound = errors.New("数据库表没有记录")
	// 其它错误
	ParseErr = errors.New("解析数据库记录错误")
)

Functions

This section is empty.

Types

type ChainReader

type ChainReader interface {
	// 获取链状态 (GetBlockChainStatus)
	GetChainStatus() (*xpb.ChainStatus, error)
	// 检查是否是主干Tip Block (ConfirmBlockChainStatus)
	IsTrunkTipBlock(blkId []byte) (bool, error)
	// 获取系统状态
	GetSystemStatus() (*xpb.SystemStatus, error)
	// 获取节点NetUR
	GetNetURL() (string, error)
	// 获取共识状态
	GetConsensusStatus() (*xpb.ConsensusStatus, error)
}

func NewChainReader

func NewChainReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) ChainReader

type ConsensusReader

type ConsensusReader interface {
	// 获取共识状态
	GetConsStatus() (cons.ConsensusStatus, error)
}

func NewConsensusReader

func NewConsensusReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) ConsensusReader

type ContractReader

type ContractReader interface {
	// 查询该链合约统计数据
	QueryContractStatData() (*protos.ContractStatData, error)
	// 查询账户下合约状态
	GetAccountContracts(account string) ([]*protos.ContractStatus, error)
	// 查询地址下合约状态
	GetAddressContracts(addr string, needContent bool) (map[string][]*protos.ContractStatus, error)
	// 查询地址下账户
	GetAccountByAK(addr string) ([]string, error)
	// 查询合约账户ACL
	QueryAccountACL(account string) (*protos.Acl, error)
	// 查询合约方法ACL
	QueryContractMethodACL(contract, method string) (*protos.Acl, error)
	// 查询账户治理代币余额
	QueryAccountGovernTokenBalance(account string) (*protos.GovernTokenBalance, error)
}

func NewContractReader

func NewContractReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) ContractReader

type LedgerReader

type LedgerReader interface {
	// 查询交易信息(QueryTx)
	QueryTx(txId []byte) (*xpb.TxInfo, error)
	// 通过交易哈希(string)查询交易信息
	QueryTxString(txid string) (*xpb.TxInfo, error)
	// 查询区块ID信息(GetBlock)
	QueryBlock(blkId []byte, needContent bool) (*xpb.BlockInfo, error)
	QueryBlockHeader(blkId []byte) (*xpb.BlockInfo, error)
	// 通过区块高度查询区块信息(GetBlockByHeight)
	QueryBlockByHeight(height int64, needContent bool) (*xpb.BlockInfo, error)
	QueryBlockHeaderByHeight(height int64) (*xpb.BlockInfo, error)
	// VotesUsage 票数(治理代币)使用情况,包括投票与被投票谁,提名信息,总票数与剩余可用票数等
	VotesUsage(address string) (*protos.CandidateRatio, error)
	//
	PledgeVotingRecords(address string) (*protos.PledgeVotingResponse, error)
	//
	GetVerification(address string) (*protos.VerificationTable, error)
	// 查询tdpos投票分红接口
	GovernTokenBonusQuery(account string) (*protos.BonusQueryReply, error)

	GetSystemStatusExplorer() (*protos.BCStatusExplorer, error)
}

func NewLedgerReader

func NewLedgerReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) LedgerReader

type UtxoReader

type UtxoReader interface {
	// 获取账户余额
	GetBalance(account string) (string, error)
	// 获取账户冻结余额
	GetFrozenBalance(account string) (string, error)
	// 获取账户余额详情
	GetBalanceDetail(account string) ([]*lpb.BalanceDetailInfo, error)
	// 拉取固定数目的utxo
	QueryUtxoRecord(account string, count int64) (*lpb.UtxoRecordDetail, error)
	// 选择合适金额的utxo
	SelectUTXO(account string, need *big.Int, isLock, isExclude bool) (*lpb.UtxoOutput, error)
	// 按最大交易大小选择utxo
	SelectUTXOBySize(account string, isLock, isExclude bool) (*lpb.UtxoOutput, error)
	// 随机逼近法选择utxo
	StochasticApproximationSelectUtxos(account string, need *big.Int, isLock, isExclude bool) (*lpb.UtxoOutput, error)
}

func NewUtxoReader

func NewUtxoReader(chainCtx *common.ChainCtx, baseCtx xctx.XContext) UtxoReader

type ValidatorsInfo

type ValidatorsInfo struct {
	Validators   []string `json:"validators"`
	Miner        string   `json:"miner"`
	Curterm      int64    `json:"curterm"`
	ContractInfo string   `json:"contract"`
	BlockNum     int64
	Period       int64
}

Jump to

Keyboard shortcuts

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