Documentation ¶
Index ¶
- Variables
- func AddKeysWithTag(db ptndb.Database, key, tag string) error
- func BatchErrorHandler(err error, errorList *[]error)
- func BytesToUint64(b []byte) uint64
- func ConvertBytes(val interface{}) (re []byte)
- func Delete(db ptndb.Deleter, key []byte) error
- func GetAddrTransactionsHash(db DatabaseReader, addr string) ([]common.Hash, error)
- func GetBytes(db ptndb.Database, key []byte) ([]byte, error)
- func GetContractRlp(db DatabaseReader, id common.Hash) (rlp.RawValue, error)
- func GetContractStateKey(id []byte, field string) []byte
- func GetKeysWithTag(db ptndb.Database, tag string) []string
- func GetMmediatorKey(address common.Address) []byte
- func GetString(db ptndb.Database, key string) (string, error)
- func GetUnitChainVersion(db ptndb.Database) int
- func Init(path string, cache int, handles int) (ptndb.Database, error)
- func JuryDepositKey(jurorAddr string) string
- func MediatorDepositKey(medAddr string) string
- func RetrieveFromJsonBytes(db ptndb.Database, key []byte, v interface{}) error
- func RetrieveFromRlpBytes(db ptndb.Database, key []byte, v interface{}) error
- func SaveUnitChainVersion(db ptndb.Putter, vsn int) error
- func StoreString(db ptndb.Putter, key, value string) error
- func StoreToJsonBytes(db ptndb.Putter, key []byte, value interface{}) error
- func StoreToRlpBytes(db ptndb.Putter, key []byte, value interface{}) error
- func Uint64ToBytes(number uint64) []byte
- func Update(db ptndb.Database, key, value []byte) error
- type DagDb
- func (dagdb *DagDb) ForEachAllTxDo(txAction func(key []byte, transaction *modules.Transaction) error) error
- func (dagdb *DagDb) GetAllData() ([][]byte, [][]byte)
- func (dagdb *DagDb) GetAllTxs() ([]*modules.Transaction, error)
- func (dagdb *DagDb) GetBody(unitHash common.Hash) ([]common.Hash, error)
- func (dagdb *DagDb) GetCommon(key []byte) ([]byte, error)
- func (dagdb *DagDb) GetCommonByPrefix(prefix []byte) map[string][]byte
- func (dagdb *DagDb) GetDb() ptndb.Database
- func (dagdb *DagDb) GetGenesisUnitHash() (common.Hash, error)
- func (dagdb *DagDb) GetHashByNumber(number *modules.ChainIndex) (common.Hash, error)
- func (dagdb *DagDb) GetHeaderByHash(hash common.Hash) (*modules.Header, error)
- func (dagdb *DagDb) GetPrefix(prefix []byte) map[string][]byte
- func (dagdb *DagDb) GetTransactionOnly(hash common.Hash) (*modules.Transaction, error)
- func (dagdb *DagDb) GetTrieSyncProgress() (uint64, error)
- func (dagdb *DagDb) GetTxHashByReqId(reqid common.Hash) (common.Hash, error)
- func (dagdb *DagDb) GetTxLookupEntry(txHash common.Hash) (*modules.TxLookupEntry, error)
- func (dagdb *DagDb) GetUnitTransactions(hash common.Hash) (modules.Transactions, error)
- func (dagdb *DagDb) IsHeaderExist(uHash common.Hash) (bool, error)
- func (dagdb *DagDb) IsTransactionExist(hash common.Hash) (bool, error)
- func (dagdb *DagDb) PutTrieSyncProgress(count uint64) error
- func (dagdb *DagDb) SaveBody(unitHash common.Hash, txsHash []common.Hash) error
- func (dagdb *DagDb) SaveCommon(key, val []byte) error
- func (dagdb *DagDb) SaveGenesisUnitHash(hash common.Hash) error
- func (dagdb *DagDb) SaveHeader(h *modules.Header) error
- func (dagdb *DagDb) SaveHeaders(headers []*modules.Header) error
- func (dagdb *DagDb) SaveTransaction(tx *modules.Transaction) error
- func (dagdb *DagDb) SaveTxLookupEntry(hash common.Hash, height, timestamp uint64, index int, tx *modules.Transaction) error
- type DatabaseReader
- type IDagDb
- type IIndexDb
- type ILocalDb
- type IPropertyDb
- type IStateDb
- type IUtxoDb
- type IndexDb
- func (db *IndexDb) GetAddressCount() int
- func (db *IndexDb) GetAddressTxIds(address common.Address) ([]common.Hash, error)
- func (db *IndexDb) GetMainDataTxIds(filehash []byte) ([]common.Hash, error)
- func (db *IndexDb) GetTokenTxIds(asset *modules.Asset) ([]common.Hash, error)
- func (db *IndexDb) QueryProofOfExistenceByReference(ref []byte) ([]*modules.ProofOfExistence, error)
- func (db *IndexDb) SaveAddress(address common.Address) error
- func (db *IndexDb) SaveAddressTxId(address common.Address, txid common.Hash) error
- func (db *IndexDb) SaveMainDataTxId(filehash []byte, txid common.Hash) error
- func (db *IndexDb) SaveProofOfExistence(poe *modules.ProofOfExistence) error
- func (db *IndexDb) SaveTokenTxId(asset *modules.Asset, txid common.Hash) error
- func (db *IndexDb) TruncateAddressTxIds() error
- type LocalDb
- func (db *LocalDb) GetLocalTx(hash common.Hash) (*modules.Transaction, error)
- func (db *LocalDb) GetLocalTxStatus(txId common.Hash) (modules.TxStatus, error)
- func (db *LocalDb) SaveLocalTx(tx *modules.Transaction) error
- func (db *LocalDb) SaveLocalTxStatus(txId common.Hash, status modules.TxStatus) error
- type PropertyDb
- func (propdb *PropertyDb) GetChainParameters() *core.ChainParameters
- func (db *PropertyDb) GetNewestUnit(asset modules.AssetId) (*modules.UnitProperty, error)
- func (propdb *PropertyDb) RetrieveDynGlobalProp() (*modules.DynamicGlobalProperty, error)
- func (propdb *PropertyDb) RetrieveGlobalProp() (*modules.GlobalProperty, error)
- func (propdb *PropertyDb) RetrieveMediatorSchl() (*modules.MediatorSchedule, error)
- func (db *PropertyDb) SetNewestUnit(header *modules.Header) error
- func (propdb *PropertyDb) StoreDynGlobalProp(dgp *modules.DynamicGlobalProperty) error
- func (propdb *PropertyDb) StoreGlobalProp(gp *modules.GlobalProperty) error
- func (propdb *PropertyDb) StoreMediatorSchl(ms *modules.MediatorSchedule) error
- type StateDb
- func (statedb *StateDb) DeleteState(key []byte) error
- func (statedb *StateDb) GetAccountBalance(address common.Address) uint64
- func (statedb *StateDb) GetAccountState(address common.Address, statekey string) (*modules.ContractStateValue, error)
- func (statedb *StateDb) GetAccountVotedMediators(addr common.Address) map[string]bool
- func (statedb *StateDb) GetAllAccountStates(address common.Address) (map[string]*modules.ContractStateValue, error)
- func (statedb *StateDb) GetAllContractTpl() ([]*modules.ContractTemplate, error)
- func (statedb *StateDb) GetAllContractTplFromSysContract() ([]*modules.ContractTemplate, error)
- func (statedb *StateDb) GetAllContracts() ([]*modules.Contract, error)
- func (statedb *StateDb) GetAllJuror() (map[string]*modules.JurorDeposit, error)
- func (statedb *StateDb) GetBlacklistAddress() ([]common.Address, *modules.StateVersion, error)
- func (statedb *StateDb) GetCandidateMediatorList() (map[string]bool, error)
- func (statedb *StateDb) GetContract(id []byte) (*modules.Contract, error)
- func (statedb *StateDb) GetContractDeploy(reqId []byte) (*modules.ContractDeployPayload, error)
- func (statedb *StateDb) GetContractDeployReq(reqId []byte) (*modules.ContractDeployRequestPayload, error)
- func (statedb *StateDb) GetContractDeveloperList() ([]common.Address, error)
- func (statedb *StateDb) GetContractIdsByTpl(tplId []byte) ([][]byte, error)
- func (statedb *StateDb) GetContractInvoke(reqId []byte) (*modules.ContractInvokePayload, error)
- func (statedb *StateDb) GetContractInvokeReq(reqId []byte) (*modules.ContractInvokeRequestPayload, error)
- func (statedb *StateDb) GetContractJury(contractId []byte) (*modules.ElectionNode, error)
- func (statedb *StateDb) GetContractSignature(reqId []byte) (*modules.SignaturePayload, error)
- func (statedb *StateDb) GetContractState(id []byte, field string) ([]byte, *modules.StateVersion, error)
- func (statedb *StateDb) GetContractStatesById(id []byte) (map[string]*modules.ContractStateValue, error)
- func (statedb *StateDb) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error)
- func (statedb *StateDb) GetContractStop(reqId []byte) (*modules.ContractStopPayload, error)
- func (statedb *StateDb) GetContractStopReq(reqId []byte) (*modules.ContractStopRequestPayload, error)
- func (statedb *StateDb) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)
- func (statedb *StateDb) GetContractTplCode(tplId []byte) ([]byte, error)
- func (statedb *StateDb) GetContractTplCodeFromSysContract(tplId []byte) ([]byte, error)
- func (statedb *StateDb) GetContractTplFromSysContract(tplId []byte) (*modules.ContractTemplate, error)
- func (statedb *StateDb) GetContractsWithJuryAddr(addr common.Hash) []*modules.Contract
- func (statedb *StateDb) GetDataVersion() (*modules.DataVersion, error)
- func (statedb *StateDb) GetJurorByAddr(addr string) (*modules.JurorDeposit, error)
- func (statedb *StateDb) GetJuryCandidateList() (map[string]bool, error)
- func (statedb *StateDb) GetMainChain() (*modules.MainChain, error)
- func (statedb *StateDb) GetMediators() map[common.Address]bool
- func (statedb *StateDb) GetPartitionChains() ([]*modules.PartitionChain, error)
- func (db *StateDb) GetPrefix(prefix []byte) map[string][]byte
- func (statedb *StateDb) GetSysParamWithoutVote() (map[string]string, error)
- func (statedb *StateDb) GetSysParamsWithVotes() (*modules.SysTokenIDInfo, error)
- func (statedb *StateDb) IsInContractDeveloperList(address common.Address) bool
- func (statedb *StateDb) IsInJuryCandidateList(address common.Address) bool
- func (statedb *StateDb) IsMediator(address common.Address) bool
- func (statedb *StateDb) LookupAccount() map[common.Address]*modules.AccountInfo
- func (statedb *StateDb) LookupMediatorInfo() []*modules.MediatorInfo
- func (statedb *StateDb) RetrieveMediator(address common.Address) (*core.Mediator, error)
- func (statedb *StateDb) RetrieveMediatorInfo(address common.Address) (*modules.MediatorInfo, error)
- func (statedb *StateDb) SaveAccountState(address common.Address, write *modules.AccountStateWriteSet, ...) error
- func (statedb *StateDb) SaveAccountStates(address common.Address, writeset []modules.AccountStateWriteSet, ...) error
- func (statedb *StateDb) SaveContract(contract *modules.Contract) error
- func (statedb *StateDb) SaveContractDeploy(reqid []byte, deploy *modules.ContractDeployPayload) error
- func (statedb *StateDb) SaveContractDeployReq(reqid []byte, deploy *modules.ContractDeployRequestPayload) error
- func (statedb *StateDb) SaveContractInvokeReq(reqid []byte, invoke *modules.ContractInvokeRequestPayload) error
- func (statedb *StateDb) SaveContractJury(contractId []byte, jury modules.ElectionNode, version *modules.StateVersion) error
- func (statedb *StateDb) SaveContractSignature(reqid []byte, sig *modules.SignaturePayload) error
- func (statedb *StateDb) SaveContractState(contractId []byte, ws *modules.ContractWriteSet, version *modules.StateVersion) error
- func (statedb *StateDb) SaveContractStates(id []byte, wset []modules.ContractWriteSet, version *modules.StateVersion) error
- func (statedb *StateDb) SaveContractStop(reqid []byte, stop *modules.ContractStopPayload) error
- func (statedb *StateDb) SaveContractStopReq(reqid []byte, stopr *modules.ContractStopRequestPayload) error
- func (statedb *StateDb) SaveContractTpl(tpl *modules.ContractTemplate) error
- func (statedb *StateDb) SaveContractTplCode(tplId []byte, byteCode []byte) error
- func (statedb *StateDb) SaveContractWithJuryAddr(addr common.Hash, contract *modules.Contract) error
- func (statedb *StateDb) SaveDataVersion(dv *modules.DataVersion) error
- func (statedb *StateDb) SaveSysConfigContract(key string, val []byte, ver *modules.StateVersion) error
- func (statedb *StateDb) StoreMediator(med *core.Mediator) error
- func (statedb *StateDb) StoreMediatorInfo(add common.Address, mi *modules.MediatorInfo) error
- func (statedb *StateDb) UpdateAccountBalance(address common.Address, addAmount int64) error
- func (statedb *StateDb) UpdateMediatorInfoExpand(med *core.Mediator) error
- func (statedb *StateDb) UpdateStateByContractInvoke(invoke *modules.ContractInvokeRequestPayload, unitTime int64, ...) error
- type UtxoDb
- func (db *UtxoDb) ClearAddrUtxo(addr common.Address) error
- func (db *UtxoDb) ClearUtxo() error
- func (utxodb *UtxoDb) DeleteUtxo(outpoint *modules.OutPoint, spentTxId common.Hash, spentTime uint64) error
- func (db *UtxoDb) GetAddrOutpoints(address common.Address) ([]modules.OutPoint, error)
- func (db *UtxoDb) GetAddrUtxos(addr common.Address, asset *modules.Asset) (map[modules.OutPoint]*modules.Utxo, error)
- func (db *UtxoDb) GetAllUtxos() (map[modules.OutPoint]*modules.Utxo, error)
- func (utxodb *UtxoDb) GetRequestAndTxMapping(hash common.Hash) (common.Hash, error)
- func (utxodb *UtxoDb) GetStxoEntry(outpoint *modules.OutPoint) (*modules.Stxo, error)
- func (utxodb *UtxoDb) GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error)
- func (utxodb *UtxoDb) IsUtxoSpent(outpoint *modules.OutPoint) (bool, error)
- func (utxodb *UtxoDb) SaveRequestAndTxHash(requestHash common.Hash, txHash common.Hash) error
- func (utxodb *UtxoDb) SaveStxoEntry(outpoint *modules.OutPoint, stxo *modules.Stxo) error
- func (utxodb *UtxoDb) SaveUtxoEntity(outpoint *modules.OutPoint, utxo *modules.Utxo) error
- func (utxodb *UtxoDb) SaveUtxoSpent(outpoint *modules.OutPoint, utxo *modules.Utxo, spentTxId common.Hash, ...) error
- func (utxodb *UtxoDb) SaveUtxoView(view map[modules.OutPoint]*modules.Utxo) error
Constants ¶
This section is empty.
Variables ¶
var DBPath = dagconfig.DefaultDataDir()
Functions ¶
func BatchErrorHandler ¶
func BytesToUint64 ¶
func ConvertBytes ¶
func ConvertBytes(val interface{}) (re []byte)
func GetAddrTransactionsHash ¶
func GetAddrTransactionsHash(db DatabaseReader, addr string) ([]common.Hash, error)
GetAdddrTransactionsHash
func GetContractRlp ¶
func GetContractStateKey ¶ added in v1.0.8
func GetMmediatorKey ¶ added in v1.0.5
func GetUnitChainVersion ¶
get unit chain version
GetUnitChainVersion reads the version number from db.
func JuryDepositKey ¶ added in v1.0.3
func MediatorDepositKey ¶ added in v1.0.3
func RetrieveFromJsonBytes ¶
func RetrieveFromRlpBytes ¶
func SaveUnitChainVersion ¶
SaveUnitChainVersion writes vsn as the version number to db.
func Uint64ToBytes ¶
encodeBlockNumber encodes a block number as big endian uint64
Types ¶
type DagDb ¶
type DagDb struct {
// contains filtered or unexported fields
}
对DAG对象的操作,包括:Unit,Tx等
func (*DagDb) ForEachAllTxDo ¶ added in v1.0.3
func (*DagDb) GetAllData ¶ added in v1.0.4
func (*DagDb) GetCommonByPrefix ¶
func (*DagDb) GetHashByNumber ¶
func (*DagDb) GetHeaderByHash ¶
func (*DagDb) GetTransactionOnly ¶
GetTransactionOnly can get a transaction by hash.
func (*DagDb) GetTrieSyncProgress ¶
GetTrieSyncProgress stores the fast sync trie process counter to support retrieving it across restarts.
func (*DagDb) GetTxHashByReqId ¶
func (*DagDb) GetTxLookupEntry ¶
func (*DagDb) GetUnitTransactions ¶
func (*DagDb) IsTransactionExist ¶
func (*DagDb) PutTrieSyncProgress ¶
PutTrieSyncProgress stores the fast sync trie process counter to support retrieving it across restarts.
func (*DagDb) SaveBody ¶
* key: [BODY_PREFIX][unit hash] value: all transactions hash set's rlp encoding bytes
func (*DagDb) SaveCommon ¶
----- common saver -----
func (*DagDb) SaveHeader ¶
###################### SAVE IMPL START ###################### * key: [HEADER_PREFIX][chain index number]_[chain index]_[unit hash] value: unit header rlp encoding bytes
save header
func (*DagDb) SaveTransaction ¶
func (dagdb *DagDb) SaveTransaction(tx *modules.Transaction) error
* key: [TRANSACTION_PREFIX][tx hash] value: transaction struct rlp encoding bytes
func (*DagDb) SaveTxLookupEntry ¶
type DatabaseReader ¶
type DatabaseReader interface { Get(key []byte) (value []byte, err error) NewIterator() iterator.Iterator NewIteratorWithPrefix(prefix []byte) iterator.Iterator }
DatabaseReader wraps the Get method of a backing data store.
type IDagDb ¶
type IDagDb interface { GetDb() ptndb.Database GetGenesisUnitHash() (common.Hash, error) SaveGenesisUnitHash(hash common.Hash) error SaveHeader(h *modules.Header) error SaveHeaders(headers []*modules.Header) error SaveTransaction(tx *modules.Transaction) error GetAllTxs() ([]*modules.Transaction, error) SaveBody(unitHash common.Hash, txsHash []common.Hash) error GetBody(unitHash common.Hash) ([]common.Hash, error) SaveTxLookupEntry(hash common.Hash, height, timestamp uint64, index int, tx *modules.Transaction) error PutTrieSyncProgress(count uint64) error GetUnitTransactions(hash common.Hash) (modules.Transactions, error) GetTransactionOnly(hash common.Hash) (*modules.Transaction, error) GetTxLookupEntry(hash common.Hash) (*modules.TxLookupEntry, error) GetPrefix(prefix []byte) map[string][]byte GetHeaderByHash(hash common.Hash) (*modules.Header, error) IsHeaderExist(uHash common.Hash) (bool, error) IsTransactionExist(txHash common.Hash) (bool, error) GetHashByNumber(number *modules.ChainIndex) (common.Hash, error) GetTrieSyncProgress() (uint64, error) // common geter GetCommon(key []byte) ([]byte, error) GetCommonByPrefix(prefix []byte) map[string][]byte SaveCommon(key, val []byte) error GetAllData() ([][]byte, [][]byte) // get txhash and save index //GetReqIdByTxHash(hash common.Hash) (common.Hash, error) GetTxHashByReqId(reqid common.Hash) (common.Hash, error) ForEachAllTxDo(txAction func(key []byte, transaction *modules.Transaction) error) error }
type IIndexDb ¶
type IIndexDb interface { SaveAddressTxId(address common.Address, txid common.Hash) error GetAddressTxIds(address common.Address) ([]common.Hash, error) //清空AddressTxIds TruncateAddressTxIds() error SaveTokenTxId(asset *modules.Asset, txid common.Hash) error GetTokenTxIds(asset *modules.Asset) ([]common.Hash, error) SaveMainDataTxId(maindata []byte, txid common.Hash) error GetMainDataTxIds(maindata []byte) ([]common.Hash, error) SaveProofOfExistence(poe *modules.ProofOfExistence) error QueryProofOfExistenceByReference(ref []byte) ([]*modules.ProofOfExistence, error) SaveAddress(address common.Address) error GetAddressCount() int }
type IPropertyDb ¶
type IPropertyDb interface { StoreGlobalProp(gp *modules.GlobalProperty) error RetrieveGlobalProp() (*modules.GlobalProperty, error) StoreDynGlobalProp(dgp *modules.DynamicGlobalProperty) error RetrieveDynGlobalProp() (*modules.DynamicGlobalProperty, error) StoreMediatorSchl(ms *modules.MediatorSchedule) error RetrieveMediatorSchl() (*modules.MediatorSchedule, error) SetNewestUnit(header *modules.Header) error //GetNewestUnit(token modules.AssetId) (common.Hash, *modules.ChainIndex, int64, error) GetNewestUnit(token modules.AssetId) (*modules.UnitProperty, error) GetChainParameters() *core.ChainParameters }
type IStateDb ¶
type IStateDb interface { GetPrefix(prefix []byte) map[string][]byte SaveContract(contract *modules.Contract) error GetContract(id []byte) (*modules.Contract, error) GetAllContracts() ([]*modules.Contract, error) SaveContractState(id []byte, w *modules.ContractWriteSet, version *modules.StateVersion) error SaveContractStates(id []byte, wset []modules.ContractWriteSet, version *modules.StateVersion) error GetContractState(id []byte, field string) ([]byte, *modules.StateVersion, error) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error) GetContractStatesById(id []byte) (map[string]*modules.ContractStateValue, error) UpdateStateByContractInvoke(invoke *modules.ContractInvokeRequestPayload, unitTime int64, version *modules.StateVersion) error SaveContractTpl(tpl *modules.ContractTemplate) error SaveContractTplCode(tplId []byte, byteCode []byte) error GetContractTpl(tplId []byte) (*modules.ContractTemplate, error) GetContractTplCode(tplId []byte) ([]byte, error) GetAllContractTpl() ([]*modules.ContractTemplate, error) GetContractTplFromSysContract(tplId []byte) (*modules.ContractTemplate, error) GetContractTplCodeFromSysContract(tplId []byte) ([]byte, error) GetAllContractTplFromSysContract() ([]*modules.ContractTemplate, error) GetContractIdsByTpl(tplId []byte) ([][]byte, error) SaveContractDeploy(reqid []byte, deploy *modules.ContractDeployPayload) error SaveContractDeployReq(reqid []byte, deploy *modules.ContractDeployRequestPayload) error SaveContractInvokeReq(reqid []byte, invoke *modules.ContractInvokeRequestPayload) error SaveContractStop(reqid []byte, stop *modules.ContractStopPayload) error SaveContractStopReq(reqid []byte, stopr *modules.ContractStopRequestPayload) error SaveContractSignature(reqid []byte, sig *modules.SignaturePayload) error GetContractDeploy(reqId []byte) (*modules.ContractDeployPayload, error) GetContractDeployReq(reqid []byte) (*modules.ContractDeployRequestPayload, error) GetContractInvoke(reqId []byte) (*modules.ContractInvokePayload, error) GetContractInvokeReq(reqid []byte) (*modules.ContractInvokeRequestPayload, error) GetContractStop(reqId []byte) (*modules.ContractStopPayload, error) GetContractStopReq(reqId []byte) (*modules.ContractStopRequestPayload, error) GetContractSignature(reqId []byte) (*modules.SignaturePayload, error) SaveAccountState(address common.Address, write *modules.AccountStateWriteSet, version *modules.StateVersion) error SaveAccountStates(address common.Address, writeset []modules.AccountStateWriteSet, version *modules.StateVersion) error GetAllAccountStates(address common.Address) (map[string]*modules.ContractStateValue, error) GetAccountState(address common.Address, statekey string) (*modules.ContractStateValue, error) UpdateAccountBalance(addr common.Address, addAmount int64) error GetAccountBalance(address common.Address) uint64 GetAccountVotedMediators(addr common.Address) map[string]bool LookupAccount() map[common.Address]*modules.AccountInfo //获得一个合约的陪审团列表 GetContractJury(contractId []byte) (*modules.ElectionNode, error) SaveContractJury(contractId []byte, jury modules.ElectionNode, version *modules.StateVersion) error StoreMediator(med *core.Mediator) error UpdateMediatorInfoExpand(med *core.Mediator) error StoreMediatorInfo(add common.Address, mi *modules.MediatorInfo) error RetrieveMediator(address common.Address) (*core.Mediator, error) GetMediators() map[common.Address]bool LookupMediatorInfo() []*modules.MediatorInfo IsMediator(address common.Address) bool RetrieveMediatorInfo(address common.Address) (*modules.MediatorInfo, error) GetCandidateMediatorList() (map[string]bool, error) GetJuryCandidateList() (map[string]bool, error) IsInJuryCandidateList(address common.Address) bool GetAllJuror() (map[string]*modules.JurorDeposit, error) GetJurorByAddr(addr string) (*modules.JurorDeposit, error) GetContractDeveloperList() ([]common.Address, error) IsInContractDeveloperList(address common.Address) bool GetDataVersion() (*modules.DataVersion, error) SaveDataVersion(dv *modules.DataVersion) error GetPartitionChains() ([]*modules.PartitionChain, error) GetMainChain() (*modules.MainChain, error) GetBlacklistAddress() ([]common.Address, *modules.StateVersion, error) GetSysParamWithoutVote() (map[string]string, error) GetSysParamsWithVotes() (*modules.SysTokenIDInfo, error) SaveSysConfigContract(key string, val []byte, ver *modules.StateVersion) error SaveContractWithJuryAddr(addr common.Hash, contract *modules.Contract) error GetContractsWithJuryAddr(addr common.Hash) []*modules.Contract }
type IUtxoDb ¶
type IUtxoDb interface { GetUtxoEntry(outpoint *modules.OutPoint) (*modules.Utxo, error) GetAddrOutpoints(addr common.Address) ([]modules.OutPoint, error) GetAddrUtxos(addr common.Address, asset *modules.Asset) (map[modules.OutPoint]*modules.Utxo, error) GetAllUtxos() (map[modules.OutPoint]*modules.Utxo, error) SaveUtxoEntity(outpoint *modules.OutPoint, utxo *modules.Utxo) error SaveUtxoView(view map[modules.OutPoint]*modules.Utxo) error DeleteUtxo(outpoint *modules.OutPoint, spentTxId common.Hash, spentTime uint64) error IsUtxoSpent(outpoint *modules.OutPoint) (bool, error) GetStxoEntry(outpoint *modules.OutPoint) (*modules.Stxo, error) ClearAddrUtxo(addr common.Address) error ClearUtxo() error SaveRequestAndTxHash(requestHash common.Hash, txHash common.Hash) error GetRequestAndTxMapping(hash common.Hash) (common.Hash, error) }
type IndexDb ¶
type IndexDb struct {
// contains filtered or unexported fields
}
func NewIndexDb ¶
func (*IndexDb) GetAddressCount ¶ added in v1.0.6
func (*IndexDb) GetAddressTxIds ¶
func (*IndexDb) GetMainDataTxIds ¶
func (*IndexDb) GetTokenTxIds ¶
func (*IndexDb) QueryProofOfExistenceByReference ¶
func (db *IndexDb) QueryProofOfExistenceByReference(ref []byte) ([]*modules.ProofOfExistence, error)
func (*IndexDb) SaveAddress ¶ added in v1.0.6
func (*IndexDb) SaveAddressTxId ¶
func (*IndexDb) SaveMainDataTxId ¶
save filehash key:IDX_MAIN_DATA_TXID value:Txid
func (*IndexDb) SaveProofOfExistence ¶
func (db *IndexDb) SaveProofOfExistence(poe *modules.ProofOfExistence) error
func (*IndexDb) SaveTokenTxId ¶
func (*IndexDb) TruncateAddressTxIds ¶ added in v1.0.3
type LocalDb ¶ added in v1.0.6
type LocalDb struct {
// contains filtered or unexported fields
}
func NewLocalDb ¶ added in v1.0.6
func (*LocalDb) GetLocalTx ¶ added in v1.0.6
查询某交易的内容和状态
func (*LocalDb) GetLocalTxStatus ¶ added in v1.0.6
func (*LocalDb) SaveLocalTx ¶ added in v1.0.6
func (db *LocalDb) SaveLocalTx(tx *modules.Transaction) error
通过本地RPC创建或广播的交易
type PropertyDb ¶
type PropertyDb struct {
// contains filtered or unexported fields
}
func NewPropertyDb ¶
func NewPropertyDb(db ptndb.Database) *PropertyDb
modified by Yiran initialize PropertyDB , and retrieve gp,dgp,mc from IPropertyDb.
func (*PropertyDb) GetChainParameters ¶
func (propdb *PropertyDb) GetChainParameters() *core.ChainParameters
func (*PropertyDb) GetNewestUnit ¶
func (db *PropertyDb) GetNewestUnit(asset modules.AssetId) (*modules.UnitProperty, error)
func (db *PropertyDb) GetNewestUnit(asset modules.AssetId) (common.Hash, *modules.ChainIndex, int64, error) {
func (*PropertyDb) RetrieveDynGlobalProp ¶
func (propdb *PropertyDb) RetrieveDynGlobalProp() (*modules.DynamicGlobalProperty, error)
func (*PropertyDb) RetrieveGlobalProp ¶
func (propdb *PropertyDb) RetrieveGlobalProp() (*modules.GlobalProperty, error)
func (*PropertyDb) RetrieveMediatorSchl ¶
func (propdb *PropertyDb) RetrieveMediatorSchl() (*modules.MediatorSchedule, error)
func (*PropertyDb) SetNewestUnit ¶
func (db *PropertyDb) SetNewestUnit(header *modules.Header) error
func (*PropertyDb) StoreDynGlobalProp ¶
func (propdb *PropertyDb) StoreDynGlobalProp(dgp *modules.DynamicGlobalProperty) error
func (*PropertyDb) StoreGlobalProp ¶
func (propdb *PropertyDb) StoreGlobalProp(gp *modules.GlobalProperty) error
func (*PropertyDb) StoreMediatorSchl ¶
func (propdb *PropertyDb) StoreMediatorSchl(ms *modules.MediatorSchedule) error
type StateDb ¶
type StateDb struct {
// contains filtered or unexported fields
}
保存了对合约写集、Config、Asset信息
func NewStateDb ¶
func (*StateDb) DeleteState ¶
func (*StateDb) GetAccountBalance ¶
func (*StateDb) GetAccountState ¶
func (*StateDb) GetAccountVotedMediators ¶
func (*StateDb) GetAllAccountStates ¶
func (*StateDb) GetAllContractTpl ¶
func (statedb *StateDb) GetAllContractTpl() ([]*modules.ContractTemplate, error)
func (*StateDb) GetAllContractTplFromSysContract ¶ added in v1.0.7
func (statedb *StateDb) GetAllContractTplFromSysContract() ([]*modules.ContractTemplate, error)
func (*StateDb) GetAllContracts ¶
func (*StateDb) GetAllJuror ¶ added in v1.0.3
func (statedb *StateDb) GetAllJuror() (map[string]*modules.JurorDeposit, error)
func (*StateDb) GetBlacklistAddress ¶ added in v1.0.3
func (*StateDb) GetCandidateMediatorList ¶ added in v1.0.3
func (*StateDb) GetContract ¶
func (*StateDb) GetContractDeploy ¶
func (statedb *StateDb) GetContractDeploy(reqId []byte) (*modules.ContractDeployPayload, error)
func (*StateDb) GetContractDeployReq ¶
func (statedb *StateDb) GetContractDeployReq(reqId []byte) (*modules.ContractDeployRequestPayload, error)
func (*StateDb) GetContractDeveloperList ¶ added in v1.0.1
func (*StateDb) GetContractIdsByTpl ¶
func (*StateDb) GetContractInvoke ¶
func (statedb *StateDb) GetContractInvoke(reqId []byte) (*modules.ContractInvokePayload, error)
func (*StateDb) GetContractInvokeReq ¶
func (statedb *StateDb) GetContractInvokeReq(reqId []byte) (*modules.ContractInvokeRequestPayload, error)
func (*StateDb) GetContractJury ¶
func (statedb *StateDb) GetContractJury(contractId []byte) (*modules.ElectionNode, error)
func (*StateDb) GetContractSignature ¶
func (statedb *StateDb) GetContractSignature(reqId []byte) (*modules.SignaturePayload, error)
func (*StateDb) GetContractState ¶
func (statedb *StateDb) GetContractState(id []byte, field string) ([]byte, *modules.StateVersion, error)
* 获取合约某一个属性 To get contract or contract template one field
func (*StateDb) GetContractStatesById ¶
func (statedb *StateDb) GetContractStatesById(id []byte) (map[string]*modules.ContractStateValue, error)
* 获取合约全部属性 To get contract or contract template all fields
func (*StateDb) GetContractStatesByPrefix ¶
func (statedb *StateDb) GetContractStatesByPrefix(id []byte, prefix string) (map[string]*modules.ContractStateValue, error)
* 获取合约全部属性 by Prefix To get contract or contract template all fields
func (*StateDb) GetContractStop ¶
func (statedb *StateDb) GetContractStop(reqId []byte) (*modules.ContractStopPayload, error)
func (*StateDb) GetContractStopReq ¶
func (statedb *StateDb) GetContractStopReq(reqId []byte) (*modules.ContractStopRequestPayload, error)
func (*StateDb) GetContractTpl ¶
func (statedb *StateDb) GetContractTpl(tplId []byte) (*modules.ContractTemplate, error)
func (*StateDb) GetContractTplCode ¶
func (*StateDb) GetContractTplCodeFromSysContract ¶ added in v1.0.7
func (*StateDb) GetContractTplFromSysContract ¶ added in v1.0.7
func (statedb *StateDb) GetContractTplFromSysContract(tplId []byte) (*modules.ContractTemplate, error)
func (*StateDb) GetContractsWithJuryAddr ¶ added in v1.0.5
func (*StateDb) GetDataVersion ¶
func (statedb *StateDb) GetDataVersion() (*modules.DataVersion, error)
func (*StateDb) GetJurorByAddr ¶ added in v1.0.3
func (statedb *StateDb) GetJurorByAddr(addr string) (*modules.JurorDeposit, error)
func (*StateDb) GetJuryCandidateList ¶
func (*StateDb) GetPartitionChains ¶
func (statedb *StateDb) GetPartitionChains() ([]*modules.PartitionChain, error)
func (*StateDb) GetSysParamWithoutVote ¶
func (*StateDb) GetSysParamsWithVotes ¶
func (statedb *StateDb) GetSysParamsWithVotes() (*modules.SysTokenIDInfo, error)
func (*StateDb) IsInContractDeveloperList ¶ added in v1.0.1
func (*StateDb) IsInJuryCandidateList ¶
func (*StateDb) LookupAccount ¶
func (statedb *StateDb) LookupAccount() map[common.Address]*modules.AccountInfo
func (*StateDb) LookupMediatorInfo ¶
func (statedb *StateDb) LookupMediatorInfo() []*modules.MediatorInfo
func (*StateDb) RetrieveMediator ¶
func (*StateDb) RetrieveMediatorInfo ¶
func (*StateDb) SaveAccountState ¶
func (statedb *StateDb) SaveAccountState(address common.Address, write *modules.AccountStateWriteSet, version *modules.StateVersion) error
func (*StateDb) SaveAccountStates ¶
func (statedb *StateDb) SaveAccountStates(address common.Address, writeset []modules.AccountStateWriteSet, version *modules.StateVersion) error
func (*StateDb) SaveContract ¶
func (*StateDb) SaveContractDeploy ¶
func (statedb *StateDb) SaveContractDeploy(reqid []byte, deploy *modules.ContractDeployPayload) error
func (*StateDb) SaveContractDeployReq ¶
func (statedb *StateDb) SaveContractDeployReq(reqid []byte, deploy *modules.ContractDeployRequestPayload) error
func (*StateDb) SaveContractInvokeReq ¶
func (statedb *StateDb) SaveContractInvokeReq(reqid []byte, invoke *modules.ContractInvokeRequestPayload) error
func (*StateDb) SaveContractJury ¶
func (statedb *StateDb) SaveContractJury(contractId []byte, jury modules.ElectionNode, version *modules.StateVersion) error
func (*StateDb) SaveContractSignature ¶
func (statedb *StateDb) SaveContractSignature(reqid []byte, sig *modules.SignaturePayload) error
func (*StateDb) SaveContractState ¶
func (statedb *StateDb) SaveContractState(contractId []byte, ws *modules.ContractWriteSet, version *modules.StateVersion) error
func (*StateDb) SaveContractStates ¶
func (statedb *StateDb) SaveContractStates(id []byte, wset []modules.ContractWriteSet, version *modules.StateVersion) error
func (*StateDb) SaveContractStop ¶
func (statedb *StateDb) SaveContractStop(reqid []byte, stop *modules.ContractStopPayload) error
func (*StateDb) SaveContractStopReq ¶
func (statedb *StateDb) SaveContractStopReq(reqid []byte, stopr *modules.ContractStopRequestPayload) error
func (*StateDb) SaveContractTpl ¶
func (statedb *StateDb) SaveContractTpl(tpl *modules.ContractTemplate) error
func (*StateDb) SaveContractTplCode ¶
func (*StateDb) SaveContractWithJuryAddr ¶ added in v1.0.5
func (*StateDb) SaveDataVersion ¶
func (statedb *StateDb) SaveDataVersion(dv *modules.DataVersion) error
func (*StateDb) SaveSysConfigContract ¶
func (statedb *StateDb) SaveSysConfigContract(key string, val []byte, ver *modules.StateVersion) error
var CONF_PREFIX = append(constants.CONTRACT_STATE_PREFIX, scc.SysConfigContractAddress.Bytes()...)
func (*StateDb) StoreMediatorInfo ¶
func (*StateDb) UpdateAccountBalance ¶
func (*StateDb) UpdateMediatorInfoExpand ¶ added in v1.0.5
func (*StateDb) UpdateStateByContractInvoke ¶ added in v1.0.1
func (statedb *StateDb) UpdateStateByContractInvoke(invoke *modules.ContractInvokeRequestPayload, unitTime int64, version *modules.StateVersion) error
type UtxoDb ¶
type UtxoDb struct { ADDR_OUTPOINT_PREFIX []byte OUTPOINT_ADDR_PREFIX []byte SPENT_UTXO_PREFIX []byte UTXO_PREFIX []byte UTXO_INDEX_PREFIX []byte // contains filtered or unexported fields }
func NewUtxoDb ¶
func NewUtxoDb(db ptndb.Database, tokenEngine tokenengine.ITokenEngine, isRequest bool) *UtxoDb
func (*UtxoDb) ClearAddrUtxo ¶ added in v1.0.4
func (*UtxoDb) DeleteUtxo ¶
func (utxodb *UtxoDb) DeleteUtxo(outpoint *modules.OutPoint, spentTxId common.Hash, spentTime uint64) error
Remove the utxo
func (*UtxoDb) GetAddrOutpoints ¶
func (*UtxoDb) GetAddrUtxos ¶
func (db *UtxoDb) GetAddrUtxos(addr common.Address, asset *modules.Asset) ( map[modules.OutPoint]*modules.Utxo, error)
GetAddrUtxos if asset is nil, query all Asset from address
func (*UtxoDb) GetAllUtxos ¶
func (*UtxoDb) GetRequestAndTxMapping ¶ added in v1.0.6
func (*UtxoDb) GetStxoEntry ¶ added in v1.0.1
func (*UtxoDb) GetUtxoEntry ¶
###################### GET IMPL START ######################
dbFetchUtxoEntry
func (*UtxoDb) IsUtxoSpent ¶ added in v1.0.1
func (*UtxoDb) SaveRequestAndTxHash ¶ added in v1.0.6
###################### GET IMPL END ######################
func (*UtxoDb) SaveStxoEntry ¶ added in v1.0.1
func (*UtxoDb) SaveUtxoEntity ¶
###################### UTXO Entity ######################