Documentation ¶
Index ¶
- Constants
- Variables
- func AddApply(txHash, accountPubKey, accountName, email, remoteIP string) error
- func GetAccountLastPage(eachPage int64) (int64, error)
- func GetAccountTaskCursor() (bson.ObjectId, error)
- func GetAccountTxNumber(name string) (int, error)
- func GetAccountsTotalLen() (int, error)
- func GetBlockByHash(hash string) (*rpcpb.Block, *[]string, error)
- func GetBlockByHeight(height int64) (*rpcpb.Block, error)
- func GetBlockLastPage(eachPage int64) int64
- func GetBlockPayListByHeight(heightList []int64) (map[int64]*BlockPay, error)
- func GetBlockTxnHashes(blockNumber int64) (*[]string, error)
- func GetBlocks(start, limit int) ([]*rpcpb.Block, error)
- func GetCollection(c string) *mgo.Collection
- func GetContractTxNumber(ID string) (int, error)
- func GetDb() (*mgo.Database, error)
- func GetFirstBlockNumberAfter(time int64) (int64, error)
- func GetFlatTxPageCntWithBlk(eachPage int64, blk int64) (int64, error)
- func GetFlatTxTotalPageCnt(eachPage int64, account string, block int64) (int64, error)
- func GetLastBlockNumber() (int64, error)
- func GetLastBlockNumberBefore(time int64) (int64, error)
- func GetTopBlock() (*rpcpb.Block, error)
- func GetTotalFlatTxnLen(address string, block int64) (int, error)
- func GetTxCountByNumber(number int64) (int, error)
- func GetTxTotalPageCnt(eachPage, blockNumber int64) (int64, error)
- func InitConfig()
- func ProcessTxs(txs []*rpcpb.Transaction, blockNumber int64) error
- func ProcessTxsForAccount(txs []*rpcpb.Transaction, blockTime int64, blockNumber int64)
- func SaveAwardInfo(aInfo AwardInfo) error
- func SaveProducerAward(producerAwards []ProducerAward) error
- func SaveProducerContributionAward(producerAwards []ProducerAward) error
- func SaveProducerLevelInfo(aInfo ProducerLevelInfo) error
- func SaveUserAward(userAwards []UserAward) error
- func SaveUserContributionAward(userAwards []UserAward) error
- func UpdateAccountTaskCursor(cursor bson.ObjectId) error
- type Account
- type AccountPubkey
- type AccountTx
- type ActionRaw
- type ApplyAccount
- type AwardInfo
- type BPProduce
- type BPStore
- type Block
- type BlockPay
- type Contract
- type ContractTx
- type FailBlock
- type FlatTx
- type PledgeInfo
- type ProducerAward
- type ProducerLevel
- type ProducerLevelInfo
- type ReceiptRaw
- type SignatureRaw
- type TaskCursor
- type TmpTx
- type Tx
- type TxReceiptRaw
- type TxStore
- type UserAward
- type VoteTx
Constants ¶
View Source
const ( CollectionBlocks = "blocks" CollectionBP = "blockproducer" CollectionTxs = "txs" CollectionFlatTx = "flatxs" CollectionAccount = "accounts" CollectionAccountTx = "accountTx" CollectionAccountPubkey = "accountPubkey" CollectionContract = "contracts" CollectionContractTx = "contractTx" CollectionTaskCursor = "taskCursors" CollectionBlockPay = "blockPays" CollectionApplyIOST = "applyIOST" CollectionVoteTx = "voteTx" CollectionProducerAward = "producerAward" CollectionUserAward = "userAward" CollectionProducerContributionAward = "producerContributionAward" CollectionUserContributionAward = "userContributionAward" CollectionFailedAward = "failedUserAward" CollectionAwardInfo = "awardInfo" CollectionProducerLevelInfo = "producerLevel" )
View Source
const AccountCursorName = "Account_cursor"
Variables ¶
View Source
var ( MongoLink string MongoUser = "" MongoPassWord = "" Db string )
Functions ¶
func GetAccountLastPage ¶
func GetAccountTaskCursor ¶
func GetAccountTxNumber ¶
func GetAccountsTotalLen ¶
func GetBlockLastPage ¶
func GetBlockPayListByHeight ¶
func GetBlockTxnHashes ¶
func GetCollection ¶
func GetCollection(c string) *mgo.Collection
func GetContractTxNumber ¶
func GetFlatTxPageCntWithBlk ¶
func GetFlatTxTotalPageCnt ¶
func GetLastBlockNumber ¶
func GetTopBlock ¶
func GetTotalFlatTxnLen ¶
/ get length of transaction list using account and block number
func GetTxCountByNumber ¶
func GetTxTotalPageCnt ¶
func InitConfig ¶
func InitConfig()
func ProcessTxs ¶
func ProcessTxs(txs []*rpcpb.Transaction, blockNumber int64) error
func ProcessTxsForAccount ¶
func ProcessTxsForAccount(txs []*rpcpb.Transaction, blockTime int64, blockNumber int64)
func SaveAwardInfo ¶
func SaveProducerAward ¶
func SaveProducerAward(producerAwards []ProducerAward) error
func SaveProducerContributionAward ¶
func SaveProducerContributionAward(producerAwards []ProducerAward) error
func SaveProducerLevelInfo ¶
func SaveProducerLevelInfo(aInfo ProducerLevelInfo) error
func SaveUserAward ¶
func UpdateAccountTaskCursor ¶
Types ¶
type Account ¶
type Account struct { Name string `bson:"name" json:"name"` CreateTime int64 `bson:"createTime" json:"create_time"` Creator string `bson:"creator" json:"creator"` AccountInfo *rpcpb.Account `bson:"accountInfo" json:"account_info"` }
func GetAccountByName ¶
func GetAccounts ¶
func GetAccountsByNames ¶
type AccountPubkey ¶
func GetAccountPubkeyByName ¶
func GetAccountPubkeyByName(name string) ([]*AccountPubkey, error)
func GetAccountPubkeyByPubkey ¶
func GetAccountPubkeyByPubkey(pubkey string) ([]*AccountPubkey, error)
type AccountTx ¶
type ApplyAccount ¶
type AwardInfo ¶
type AwardInfo struct { Aid string `json:"aid" form:"aid" query:"aid"` StartTime int64 `json:"start_time" form:"start_time" query:"start_time"` EndTime int64 `json:"end_time" form:"end_time" query:"end_time"` TotalAmount int64 `json:"total_amount" form:"total_amount" query:"total_amount"` CountTime int64 `json:"count_time" form:"count_time" query:"count_time"` }
func GetAwardInfo ¶
func GetVoteAwardInfo ¶
func GetVoteAwardList ¶
type BPProduce ¶
type BPProduce struct { Witness string `bson:"witness" json:"witness"` StartTime int64 `bson:"startTime" json:"startTime"` EndTime int64 `bson:"endTime" json:"endTime"` Count int64 `bson:"count" json:"count"` MaxBlockNumber int `bson:"maxBlockNumber" json:"maxBlockNumber"` MinBlockNumber int `bson:"minBlockNumber" json:"minBlockNumber"` }
func GetBPProduceByStartTime ¶
func GetLastBPProduce ¶
type BPStore ¶
type Block ¶
type Block struct { ParentHash string `bson:"parentHash"` Hash string `bson:"hash"` TxsHash string `bson:"txsHash"` MerkleHash string `bson:"merkleHash"` BlockNumber int64 `bson:"blockNumber"` TxNumber int64 `bson:"txNumber"` Witness string `bson:"witness"` Time int64 `bson:"time"` Version int64 `bson:"version"` Info string `bson:"info"` }
type BlockPay ¶
type BlockPay struct { Height int64 `json:"height" bson:"_id,omitempty"` AvgGasPrice float64 `json:"avg_gas_price"` TotalGasLimit int64 `json:"total_gas_limit"` }
func GetBlockPayByHeight ¶
func GetTopBlockPay ¶
type Contract ¶
type ContractTx ¶
type ContractTx struct { ID string `bson:"id"` Time int64 `bson:"time"` TxHash string `bson:"txHash"` }
func GetContractTxByID ¶
func GetContractTxByID(ID string, start, limit int) ([]*ContractTx, error)
type FailBlock ¶
type FailBlock struct { BlockNumber int64 `bson:"blockNumber"` RetryTimes int64 `bson:"retryTimes"` Processed bool `bson:"processed"` }
record failed sync block
type FlatTx ¶
type FlatTx struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id"` BlockNumber int64 `bson:"blockNumber" json:"blockNumber"` Time int64 `bson:"time" json:"time"` Hash string `bson:"hash" json:"hash"` Expiration int64 `bson:"expiration" json:"expiration"` GasPrice int64 `bson:"gasPrice" json:"gasPrice"` GasLimit int64 `bson:"gasLimit" json:"gasLimit"` Action ActionRaw `bson:"action" json:"action"` Signers []string `bson:"signers" json:"signers"` Signs []SignatureRaw `bson:"signs" json:"signs"` Publisher string `bson:"publisher" json:"publisher"` From string `bson:"from" json:"from"` To string `bson:"to" json:"to"` Amount float64 `bson:"amount" json:"amount"` // 转发数量 ActionIndex int `bson:"actionIndex" json:"actionIndex"` // action 索引 ActionName string `bson:"actionName" json:"actionName"` // action 类型 Receipt TxReceiptRaw `bson:"receipt" json:"receipt"` }
将 Tx.Actions 打平后的数据结构, 如果actionName == Transfer 则会解析出 from, to, amount
func GetFlatTxnDetailByHash ¶
type PledgeInfo ¶
type PledgeInfo struct { MyPledge map[string]float64 `json:"my_pledge"` PledgeForMe map[string]float64 `json:"pledge_for_me"` }
func GetAccountPledge ¶
func GetAccountPledge(name string) (*PledgeInfo, error)
type ProducerAward ¶
type ProducerAward struct { Aid string `json:"aid" form:"aid" query:"aid"` Pid string `json:"pid" form:"pid" query:"pid"` Vote float64 `json:"vote" form:"vote" query:"vote"` Award float64 `json:"award" form:"award" query:"award"` }
func GetProducerAward ¶
func GetProducerAward(id string) ([]*ProducerAward, error)
func GetProducerContributionAward ¶
func GetProducerContributionAward(id string) ([]*ProducerAward, error)
type ProducerLevel ¶
type ProducerLevelInfo ¶
type ProducerLevelInfo struct { Aid string `json:"aid" form:"aid" query:"aid"` //ProducerLevels []*ProducerLevel `json:"producerlevels" form:"producerlevels" query:"producerlevels"` ProducerLevels []*ProducerLevel `json:"producerlevels" form:"producerlevels" query:"producerlevels"` }
func GetProducerLevelInfo ¶
func GetProducerLevelInfo(aid string) (pInfo ProducerLevelInfo, err error)
type ReceiptRaw ¶
type SignatureRaw ¶
type TaskCursor ¶
type Tx ¶
type Tx struct { ExternalId bson.ObjectId `bson:"externalId"` BlockNumber int64 `bson:"blockNumber"` Time int64 `bson:"time"` Hash string `bson:"hash"` Expiration int64 `bson:"expiration"` GasPrice int64 `bson:"gasPrice"` GasLimit int64 `bson:"gasLimit"` Mark int64 `bson:"mark"` Actions []ActionRaw `bson:"actions"` Signers []string `bson:"signers"` Signs []SignatureRaw `bson:"signs"` Publisher SignatureRaw `bson:"publisher"` Receipt TxReceiptRaw `bson:"receipt"` }
func GetTxnDetailByHash ¶
type TxReceiptRaw ¶
type TxReceiptRaw struct { GasUsage int64 `bson:"gasUsage"` SuccActionNum int32 `bson:"succActionNum"` Receipts []ReceiptRaw `bson:"receipts"` StatusCode int32 `bson:"statusCode"` StatusMessage string `bson:"statusMessage"` }
type TxStore ¶
type TxStore struct { BlockNumber int64 `json:"block_number"` Tx *rpcpb.Transaction `json:"tx"` }
func GetTxByHash ¶
func GetTxsByHash ¶
type UserAward ¶
type UserAward struct { Aid string `json:"aid" form:"aid" query:"aid"` Username string `json:"username" form:"username" query:"username"` Pid string `json:"pid" form:"pid" query:"pid"` Vote float64 `json:"vote" form:"vote" query:"vote"` Award float64 `json:"award" form:"award" query:"award"` }
func GetUserAward ¶
Click to show internal directories.
Click to hide internal directories.