Documentation ¶
Index ¶
- Constants
- Variables
- func CloseLedger()
- func NewrCache() *rCache
- type Account
- type AccountStore
- type Block
- type BlockLink
- type BlockStore
- type Cache
- func (c *Cache) Delete(key []byte) error
- func (c *Cache) Discard()
- func (b *Cache) Drop(prefix []byte) error
- func (c *Cache) Get(key []byte) (interface{}, error)
- func (c *Cache) Iterator(prefix []byte, end []byte, f func(k, v []byte) error) error
- func (b *Cache) Len() int64
- func (c *Cache) Put(key []byte, value interface{}) error
- func (c *Cache) Quoted()
- func (c *Cache) Release()
- type CacheStat
- type CacheStore
- type ContractStore
- type DposStore
- type FrontierStore
- type GenericStore
- type Iterator
- type Ledger
- func (l *Ledger) Action(at storage.ActionType, t int) (interface{}, error)
- func (l *Ledger) AddAccountMeta(value *types.AccountMeta, c storage.Cache) error
- func (l *Ledger) AddAccountMetaCache(value *types.AccountMeta, batch ...storage.Batch) error
- func (l *Ledger) AddAccountMetaHistory(tm *types.TokenMeta, block *types.StateBlock, cache storage.Cache) error
- func (l *Ledger) AddBlockCache(blk *types.StateBlock, batch ...storage.Batch) error
- func (l *Ledger) AddBlockPrivatePayload(hash types.Hash, payload []byte) error
- func (l *Ledger) AddFrontier(frontier *types.Frontier, c storage.Cache) error
- func (l *Ledger) AddGapDoDSettleStateBlock(key types.Hash, blk *types.StateBlock, sync types.SynchronizedKind) error
- func (l *Ledger) AddGapPovBlock(height uint64, blk *types.StateBlock, sync types.SynchronizedKind) error
- func (l *Ledger) AddGapPublishBlock(key types.Hash, blk *types.StateBlock, sync types.SynchronizedKind) error
- func (l *Ledger) AddGenericType(key *types.GenericKey, value *types.GenericType) error
- func (l *Ledger) AddGenericTypeC(key *types.GenericKeyC, value *types.GenericTypeC, c storage.Cache) error
- func (l *Ledger) AddOrUpdateAccountMetaCache(value *types.AccountMeta, batch ...storage.Batch) error
- func (l *Ledger) AddOrUpdateGenericType(key *types.GenericKey, value *types.GenericType) error
- func (l *Ledger) AddOrUpdateGenericTypeC(key *types.GenericKeyC, value *types.GenericTypeC, c storage.Cache) error
- func (l *Ledger) AddOrUpdatePeerInfo(value *types.PeerInfo) error
- func (l *Ledger) AddOrUpdateVmLogs(value *types.VmLogs, c storage.Cache) error
- func (l *Ledger) AddPeerInfo(info *types.PeerInfo) error
- func (l *Ledger) AddPending(key *types.PendingKey, value *types.PendingInfo, c storage.Cache) error
- func (l *Ledger) AddPovBestHash(height uint64, hash types.Hash, batch ...storage.Batch) error
- func (l *Ledger) AddPovBlock(blk *types.PovBlock, td *types.PovTD, batch ...storage.Batch) error
- func (l *Ledger) AddPovBody(height uint64, hash types.Hash, body *types.PovBody) error
- func (l *Ledger) AddPovDiffStat(dayStat *types.PovDiffDayStat) error
- func (l *Ledger) AddPovHeader(header *types.PovHeader) error
- func (l *Ledger) AddPovHeight(hash types.Hash, height uint64) error
- func (l *Ledger) AddPovMinerStat(dayStat *types.PovMinerDayStat) error
- func (l *Ledger) AddPovTD(hash types.Hash, height uint64, td *types.PovTD) error
- func (l *Ledger) AddPovTxLookup(txHash types.Hash, txLookup *types.PovTxLookup, batch ...storage.Batch) error
- func (l *Ledger) AddPovTxLookupInBatch(txHash types.Hash, txLookup *types.PovTxLookup, batch storage.Batch) error
- func (l *Ledger) AddRepresentation(address types.Address, diff *types.Benefit, c storage.Cache) error
- func (l *Ledger) AddSmartContractBlock(value *types.SmartContractBlock) error
- func (l *Ledger) AddStateBlock(block *types.StateBlock) error
- func (l *Ledger) AddTokenMetaConfirmed(address types.Address, meta *types.TokenMeta, cache storage.Cache) error
- func (l *Ledger) AddTrieCleanHeight(height uint64) error
- func (l *Ledger) AddUncheckedBlock(key types.Hash, blk *types.StateBlock, kind types.UncheckedKind, ...) error
- func (l *Ledger) AddUncheckedSyncBlock(previous types.Hash, blk *types.StateBlock) error
- func (l *Ledger) AddUnconfirmedSyncBlock(hash types.Hash, blk *types.StateBlock) error
- func (l *Ledger) AddVoteHistory(hash types.Hash, address types.Address) error
- func (l *Ledger) BatchGetPovHeadersByHeightAsc(height uint64, count uint64) ([]*types.PovHeader, error)
- func (l *Ledger) BatchGetPovHeadersByHeightDesc(height uint64, count uint64) ([]*types.PovHeader, error)
- func (l *Ledger) BlockConfirmed(blk *types.StateBlock)
- func (l *Ledger) Blocks(limit int, offset int) ([]types.Hash, error)
- func (l *Ledger) BlocksByAccount(address types.Address, limit int, offset int) ([]types.Hash, error)
- func (l *Ledger) BlocksCount() (uint64, error)
- func (l *Ledger) BlocksCountByType() (map[string]uint64, error)
- func (l *Ledger) Cache() *MemoryCache
- func (l *Ledger) CalculateAmount(block *types.StateBlock) (types.Balance, error)
- func (l *Ledger) CleanAllVoteHistory() error
- func (l *Ledger) CleanBlockVoteHistory(hash types.Hash) error
- func (l *Ledger) CleanSyncCache()
- func (l *Ledger) Close() error
- func (l *Ledger) ContractAddress(b *types.StateBlock) (*types.Address, error)
- func (l *Ledger) CountAccountMetas() (uint64, error)
- func (l *Ledger) CountBlocksCache() (uint64, error)
- func (l *Ledger) CountFrontiers() (uint64, error)
- func (l *Ledger) CountGenericTypeCs() (uint64, error)
- func (l *Ledger) CountGenericTypes() (uint64, error)
- func (l *Ledger) CountPeersInfo() (uint64, error)
- func (l *Ledger) CountPovAccountTxs() (uint64, error)
- func (l *Ledger) CountPovBestHashs() (uint64, error)
- func (l *Ledger) CountPovBlocks() (uint64, error)
- func (l *Ledger) CountPovTxs() (uint64, error)
- func (l *Ledger) CountRepresentations() (uint64, error)
- func (l *Ledger) CountSmartContractBlocks() (uint64, error)
- func (l *Ledger) CountStateBlocks() (uint64, error)
- func (l *Ledger) CountUncheckedBlocks() (uint64, error)
- func (l *Ledger) CountUncheckedBlocksStore() (uint64, error)
- func (l *Ledger) CountUncheckedSyncBlocks() (uint64, error)
- func (l *Ledger) CountUnconfirmedSyncBlocks() (uint64, error)
- func (l *Ledger) CountVmLogs() (uint64, error)
- func (l *Ledger) DBStore() storage.Store
- func (l *Ledger) DebugAllPovInfos()
- func (l *Ledger) Delete(k []byte) error
- func (l *Ledger) DeleteAccountMeta(key types.Address, c storage.Cache) error
- func (l *Ledger) DeleteAccountMetaCache(address types.Address, batch ...storage.Batch) error
- func (l *Ledger) DeleteBlockCache(hash types.Hash, batch ...storage.Batch) error
- func (l *Ledger) DeleteBlockPrivatePayload(hash types.Hash) error
- func (l *Ledger) DeleteFrontier(key types.Hash, c storage.Cache) error
- func (l *Ledger) DeleteGapDoDSettleStateBlock(key, blkHash types.Hash) error
- func (l *Ledger) DeleteGapPovBlock(height uint64, hash types.Hash) error
- func (l *Ledger) DeleteGapPublishBlock(key types.Hash, blkHash types.Hash) error
- func (l *Ledger) DeleteGenericType(key *types.GenericKey) error
- func (l *Ledger) DeleteGenericTypeC(key *types.GenericKeyC, c storage.Cache) error
- func (l *Ledger) DeletePending(key *types.PendingKey, c storage.Cache) error
- func (l *Ledger) DeletePovBestHash(height uint64, batch ...storage.Batch) error
- func (l *Ledger) DeletePovBlock(blk *types.PovBlock) error
- func (l *Ledger) DeletePovBody(height uint64, hash types.Hash) error
- func (l *Ledger) DeletePovDiffStat(dayIndex uint32) error
- func (l *Ledger) DeletePovHeader(height uint64, hash types.Hash) error
- func (l *Ledger) DeletePovHeight(hash types.Hash) error
- func (l *Ledger) DeletePovMinerStat(dayIndex uint32) error
- func (l *Ledger) DeletePovTD(hash types.Hash, height uint64) error
- func (l *Ledger) DeletePovTxLookup(txHash types.Hash, batch ...storage.Batch) error
- func (l *Ledger) DeletePovTxLookupInBatch(txHash types.Hash, batch storage.Batch) error
- func (l *Ledger) DeleteStateBlock(key types.Hash, c storage.Cache) error
- func (l *Ledger) DeleteTokenMetaCache(address types.Address, tokenType types.Hash, batch ...storage.Batch) error
- func (l *Ledger) DeleteTokenMetaConfirmed(address types.Address, tokenType types.Hash, c storage.Cache) error
- func (l *Ledger) DeleteUncheckedBlock(key types.Hash, kind types.UncheckedKind) error
- func (l *Ledger) DeleteUncheckedSyncBlock(hash types.Hash) error
- func (l *Ledger) DeleteUnconfirmedSyncBlock(hash types.Hash) error
- func (l *Ledger) DeleteVmLogs(key types.Hash, c storage.Cache) error
- func (l *Ledger) DropAllPovBlocks() error
- func (l *Ledger) Dump(t int) (string, error)
- func (l *Ledger) EmptyRelation() error
- func (l *Ledger) EventBus() event.EventBus
- func (l *Ledger) Flush() error
- func (l *Ledger) FlushU() error
- func (l *Ledger) GenerateChangeBlock(account types.Address, representative types.Address, prk ed25519.PrivateKey) (*types.StateBlock, error)
- func (l *Ledger) GenerateOnlineBlock(account types.Address, prk ed25519.PrivateKey, povHeight uint64) (*types.StateBlock, error)
- func (l *Ledger) GenerateReceiveBlock(sendBlock *types.StateBlock, prk ed25519.PrivateKey) (*types.StateBlock, error)
- func (l *Ledger) GenerateSendBlock(block *types.StateBlock, amount types.Balance, prk ed25519.PrivateKey) (*types.StateBlock, error)
- func (l *Ledger) Get(k []byte, c ...storage.Cache) ([]byte, error)
- func (l *Ledger) GetAccountMeta(address types.Address, c ...storage.Cache) (*types.AccountMeta, error)
- func (l *Ledger) GetAccountMetaByPovHeight(address types.Address, height uint64) (*types.AccountMeta, error)
- func (l *Ledger) GetAccountMetaCaches(fn func(am *types.AccountMeta) error) error
- func (l *Ledger) GetAccountMetaConfirmed(address types.Address, c ...storage.Cache) (*types.AccountMeta, error)
- func (l *Ledger) GetAccountMetas(fn func(am *types.AccountMeta) error) error
- func (l *Ledger) GetAccountMeteCache(address types.Address, batch ...storage.Batch) (*types.AccountMeta, error)
- func (l *Ledger) GetAllPovBestBlocks(fn func(*types.PovBlock) error) error
- func (l *Ledger) GetAllPovBestHashes(fn func(height uint64, hash types.Hash) error) error
- func (l *Ledger) GetAllPovBestHeaders(fn func(header *types.PovHeader) error) error
- func (l *Ledger) GetAllPovBlocks(fn func(*types.PovBlock) error) error
- func (l *Ledger) GetAllPovDiffStats(fn func(*types.PovDiffDayStat) error) error
- func (l *Ledger) GetAllPovHeaders(fn func(header *types.PovHeader) error) error
- func (l *Ledger) GetAllPovMinerStats(fn func(*types.PovMinerDayStat) error) error
- func (l *Ledger) GetBlockCache(hash types.Hash) (*types.StateBlock, error)
- func (l *Ledger) GetBlockCaches(fn func(*types.StateBlock) error) error
- func (l *Ledger) GetBlockChild(hash types.Hash, c ...storage.Cache) (types.Hash, error)
- func (l *Ledger) GetBlockLink(hash types.Hash, c ...storage.Cache) (types.Hash, error)
- func (l *Ledger) GetBlockPrivatePayload(hash types.Hash) ([]byte, error)
- func (l *Ledger) GetCacheStat() []*CacheStat
- func (l *Ledger) GetCacheStatue() map[string]string
- func (l *Ledger) GetFrontier(hash types.Hash, c ...storage.Cache) (*types.Frontier, error)
- func (l *Ledger) GetFrontiers() ([]*types.Frontier, error)
- func (l *Ledger) GetGapDoDSettleStateBlock(key types.Hash, visit types.GapDoDSettleStateBlockWalkFunc) error
- func (l *Ledger) GetGapPublishBlock(key types.Hash, visit types.GapPublishBlockWalkFunc) error
- func (l *Ledger) GetGenericType(key *types.GenericKey) (*types.GenericType, error)
- func (l *Ledger) GetGenericTypeC(key *types.GenericKeyC, c ...storage.Cache) (*types.GenericTypeC, error)
- func (l *Ledger) GetGenericTypeCs(fn func(key *types.GenericKeyC, value *types.GenericTypeC) error) error
- func (l *Ledger) GetGenericTypes(fn func(key *types.GenericKey, value *types.GenericType) error) error
- func (l *Ledger) GetLastGapPovHeight() uint64
- func (l *Ledger) GetLatestPovBestHash() (types.Hash, error)
- func (l *Ledger) GetLatestPovBlock() (*types.PovBlock, error)
- func (l *Ledger) GetLatestPovDiffStat() (*types.PovDiffDayStat, error)
- func (l *Ledger) GetLatestPovHeader() (*types.PovHeader, error)
- func (l *Ledger) GetLatestPovMinerStat(batch ...storage.Batch) (*types.PovMinerDayStat, error)
- func (l *Ledger) GetObject(k []byte, c ...storage.Cache) (interface{}, []byte, error)
- func (l *Ledger) GetOnlineRepresentations() ([]types.Address, error)
- func (l *Ledger) GetPeerInfo(peerID string) (*types.PeerInfo, error)
- func (l *Ledger) GetPeersInfo(fn func(info *types.PeerInfo) error) error
- func (l *Ledger) GetPending(pendingKey *types.PendingKey) (*types.PendingInfo, error)
- func (l *Ledger) GetPendings(fn func(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo) error) error
- func (l *Ledger) GetPendingsByAddress(address types.Address, ...) error
- func (l *Ledger) GetPendingsByToken(account types.Address, token types.Hash, ...) error
- func (l *Ledger) GetPovBestHash(height uint64, batch ...storage.Batch) (types.Hash, error)
- func (l *Ledger) GetPovBlockByHash(hash types.Hash) (*types.PovBlock, error)
- func (l *Ledger) GetPovBlockByHeight(height uint64) (*types.PovBlock, error)
- func (l *Ledger) GetPovBlockByHeightAndHash(height uint64, hash types.Hash) (*types.PovBlock, error)
- func (l *Ledger) GetPovBody(height uint64, hash types.Hash) (*types.PovBody, error)
- func (l *Ledger) GetPovDiffStat(dayIndex uint32) (*types.PovDiffDayStat, error)
- func (l *Ledger) GetPovHeader(height uint64, hash types.Hash) (*types.PovHeader, error)
- func (l *Ledger) GetPovHeaderByHash(hash types.Hash) (*types.PovHeader, error)
- func (l *Ledger) GetPovHeaderByHeight(height uint64) (*types.PovHeader, error)
- func (l *Ledger) GetPovHeight(hash types.Hash) (uint64, error)
- func (l *Ledger) GetPovLatestHeight() (uint64, error)
- func (l *Ledger) GetPovMinerStat(dayIndex uint32, batch ...storage.Batch) (*types.PovMinerDayStat, error)
- func (l *Ledger) GetPovTD(hash types.Hash, height uint64, batch ...storage.Batch) (*types.PovTD, error)
- func (l *Ledger) GetPovTxLookup(txHash types.Hash) (*types.PovTxLookup, error)
- func (l *Ledger) GetPovTxlScanCursor() (uint64, error)
- func (l *Ledger) GetRandomStateBlock() (*types.StateBlock, error)
- func (l *Ledger) GetRelation(dest interface{}, query string) error
- func (l *Ledger) GetRepresentation(key types.Address, c ...storage.Cache) (*types.Benefit, error)
- func (l *Ledger) GetRepresentations(fn func(types.Address, *types.Benefit) error) error
- func (l *Ledger) GetSmartContractBlock(key types.Hash) (*types.SmartContractBlock, error)
- func (l *Ledger) GetSmartContractBlocks(fn func(block *types.SmartContractBlock) error) error
- func (l *Ledger) GetStateBlock(hash types.Hash, c ...storage.Cache) (*types.StateBlock, error)
- func (l *Ledger) GetStateBlockConfirmed(hash types.Hash, c ...storage.Cache) (*types.StateBlock, error)
- func (l *Ledger) GetStateBlocksConfirmed(fn func(*types.StateBlock) error) error
- func (l *Ledger) GetTokenById(tokenId types.Hash) (*types.TokenInfo, error)
- func (l *Ledger) GetTokenByName(tokenName string) (*types.TokenInfo, error)
- func (l *Ledger) GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)
- func (l *Ledger) GetTokenMetaByBlockHash(hash types.Hash) (*types.TokenMeta, error)
- func (l *Ledger) GetTokenMetaByPovHeight(address types.Address, hash types.Hash, height uint64) (*types.TokenMeta, error)
- func (l *Ledger) GetTokenMetaConfirmed(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)
- func (l *Ledger) GetTrieCleanHeight() (uint64, error)
- func (l *Ledger) GetUCacheStat() []*CacheStat
- func (l *Ledger) GetUCacheStatue() map[string]string
- func (l *Ledger) GetUncheckedBlock(hash types.Hash, kind types.UncheckedKind) (*types.StateBlock, types.SynchronizedKind, error)
- func (l *Ledger) GetUncheckedBlocks(visit types.UncheckedBlockWalkFunc) error
- func (l *Ledger) GetUncheckedSyncBlock(hash types.Hash) (*types.StateBlock, error)
- func (l *Ledger) GetUnconfirmedSyncBlock(hash types.Hash) (*types.StateBlock, error)
- func (l *Ledger) GetVerifiedData() map[types.Hash]int
- func (l *Ledger) GetVmLogs(key types.Hash, c ...storage.Cache) (*types.VmLogs, error)
- func (l *Ledger) HasAccountMetaCache(address types.Address) (bool, error)
- func (l *Ledger) HasAccountMetaConfirmed(address types.Address) (bool, error)
- func (l *Ledger) HasBlockCache(hash types.Hash) (bool, error)
- func (l *Ledger) HasGenericType(key *types.GenericKey) (bool, error)
- func (l *Ledger) HasGenericTypeC(key *types.GenericKeyC, c ...storage.Cache) (bool, error)
- func (l *Ledger) HasPovBlock(height uint64, hash types.Hash, batch ...storage.Batch) bool
- func (l *Ledger) HasPovBody(height uint64, hash types.Hash, batch ...storage.Batch) bool
- func (l *Ledger) HasPovHeader(height uint64, hash types.Hash, batch ...storage.Batch) bool
- func (l *Ledger) HasPovHeight(hash types.Hash) bool
- func (l *Ledger) HasPovMinerStat(dayIndex uint32) bool
- func (l *Ledger) HasPovTxLookup(txHash types.Hash) bool
- func (l *Ledger) HasSmartContractBlock(key types.Hash) (bool, error)
- func (l *Ledger) HasStateBlock(hash types.Hash) (bool, error)
- func (l *Ledger) HasStateBlockConfirmed(hash types.Hash) (bool, error)
- func (l *Ledger) HasTokenMeta(address types.Address, tokenType types.Hash) (bool, error)
- func (l *Ledger) HasUncheckedBlock(hash types.Hash, kind types.UncheckedKind) (bool, error)
- func (l *Ledger) HasUncheckedSyncBlock(hash types.Hash) (bool, error)
- func (l *Ledger) HasUnconfirmedSyncBlock(hash types.Hash) (bool, error)
- func (l *Ledger) HasVmLogs(key types.Hash, c ...storage.Cache) (bool, error)
- func (l *Ledger) HasVoteHistory(hash types.Hash, address types.Address) bool
- func (l *Ledger) IsUserAccount(address types.Address) (bool, error)
- func (l *Ledger) Iterator(prefix []byte, end []byte, fn func(k []byte, v []byte) error) error
- func (l *Ledger) IteratorObject(prefix []byte, end []byte, fn func(k []byte, v interface{}) error) error
- func (l *Ledger) ListTokens() ([]*types.TokenInfo, error)
- func (l *Ledger) NeedToWriteTrie(height uint64) bool
- func (l *Ledger) NewVMIterator(address *types.Address) *Iterator
- func (l *Ledger) PendingAmount(address types.Address, token types.Hash) (types.Balance, error)
- func (l *Ledger) PovHeightAddGap(height uint64) error
- func (l *Ledger) PovHeightDeleteGap(height uint64) error
- func (l *Ledger) PovHeightHasGap(height uint64) (bool, error)
- func (l *Ledger) Put(key []byte, value interface{}) error
- func (l *Ledger) RegisterInterface(con types.Convert, objs []types.Schema) error
- func (l *Ledger) RegisterRelation(objs []types.Schema) error
- func (l *Ledger) RemoveStorage(key []byte, val []byte, c storage.Cache) error
- func (l *Ledger) SaveStorage(val map[string]interface{}, c ...storage.Cache) error
- func (l *Ledger) SaveStorageByConvert(key []byte, val []byte, c storage.Cache) error
- func (l *Ledger) SearchVmLogs(fn func(key types.Hash, value *types.VmLogs) error) error
- func (l *Ledger) SelectRelation(dest interface{}, query string) error
- func (l *Ledger) SetCacheCapacity() error
- func (l *Ledger) SetLastGapPovHeight(height uint64) error
- func (l *Ledger) SetOnlineRepresentations(addresses []*types.Address) error
- func (l *Ledger) SetPovLatestHeight(height uint64, batch ...storage.Batch) error
- func (l *Ledger) SetPovTxlScanCursor(height uint64, batch ...storage.Batch) error
- func (l *Ledger) SetStorage(val map[string]interface{}) error
- func (l *Ledger) SubRepresentation(address types.Address, diff *types.Benefit, c storage.Cache) error
- func (l *Ledger) UCache() *MemoryCache
- func (l *Ledger) UpdateAccountMeta(value *types.AccountMeta, c storage.Cache) error
- func (l *Ledger) UpdateAccountMetaHistory(tm *types.TokenMeta, block *types.StateBlock, cache storage.Cache) error
- func (l *Ledger) UpdateAccountMeteCache(value *types.AccountMeta, batch ...storage.Batch) error
- func (l *Ledger) UpdateGenericType(key *types.GenericKey, value *types.GenericType) error
- func (l *Ledger) UpdateGenericTypeC(key *types.GenericKeyC, value *types.GenericTypeC, c storage.Cache) error
- func (l *Ledger) UpdatePeerInfo(value *types.PeerInfo) error
- func (l *Ledger) UpdateStateBlock(block *types.StateBlock, c storage.Cache) error
- func (l *Ledger) WalkGapPovBlocks(visit types.GapPovBlockWalkFunc) error
- func (l *Ledger) WalkGapPovBlocksWithHeight(height uint64, visit types.GapPovBlockWalkFunc) error
- func (l *Ledger) WalkSyncCache(visit common.SyncCacheWalkFunc)
- func (l *Ledger) Weight(account types.Address) types.Balance
- type LedgerStore
- type MemoryCache
- func (lc *MemoryCache) BatchUpdate(fn func(c *Cache) error) error
- func (lc *MemoryCache) Delete(key []byte) error
- func (lc *MemoryCache) Get(key []byte) (interface{}, error)
- func (lc *MemoryCache) GetCache() *Cache
- func (lc *MemoryCache) Has(key []byte) (bool, error)
- func (lc *MemoryCache) Put(key []byte, value interface{}) error
- func (lc *MemoryCache) ResetCapacity(size int)
- type PeerInfoStore
- type PendingStore
- type PovStore
- type PrivacyStore
- type Relation
- type RepresentationStore
- type SmartBlockStore
- type Store
- type SyncStore
- type UncheckedBlockStore
- type VmStore
- type VmlogsStore
- type VoteStore
Constants ¶
View Source
const (
DPoSDataLastGapPovHeight byte = iota
)
Variables ¶
View Source
var ( ErrStoreEmpty = errors.New("the store is empty") ErrBlockExists = errors.New("block already exists") ErrBlockNotFound = errors.New("block not found") ErrUncheckedBlockExists = errors.New("unchecked block already exists") ErrUncheckedBlockNotFound = errors.New("unchecked block not found") ErrAccountExists = errors.New("account already exists") ErrAccountNotFound = errors.New("account not found") ErrTokenExists = errors.New("token already exists") ErrTokenNotFound = errors.New("token not found") //ErrTokenInfoExists = errors.New("token info already exists") //ErrTokenInfoNotFound = errors.New("token info not found") ErrPendingExists = errors.New("pending transaction already exists") ErrPendingNotFound = errors.New("pending transaction not found") ErrFrontierExists = errors.New("frontier already exists") ErrFrontierNotFound = errors.New("frontier not found") ErrRepresentationNotFound = errors.New("representation not found") ErrPerformanceNotFound = errors.New("performance not found") //ErrChildExists = errors.New("child already exists") //ErrChildNotFound = errors.New("child not found") ErrVersionNotFound = errors.New("version not found") ErrLinkNotFound = errors.New("link not found") ErrPeerExists = errors.New("peer already exists") ErrPeerNotFound = errors.New("peer not found") )
View Source
var ( ErrGenericTypeExists = errors.New("the GenericType is empty") ErrGenericTypeNotFound = errors.New("GenericType not found") )
View Source
var ( ErrGenericTypeCExists = errors.New("the GenericTypeC is empty") ErrGenericTypeCNotFound = errors.New("GenericTypeC not found") )
View Source
var ( ErrPovKeyNotFound = errors.New("pov key not found") ErrPovHeaderNotFound = errors.New("pov header not found") ErrPovBodyNotFound = errors.New("pov body not found") ErrPovHeightNotFound = errors.New("pov height not found") ErrPovHashNotFound = errors.New("pov hash not found") ErrPovTxLookupNotFound = errors.New("pov tx lookup not found") ErrPovTxLookupNotBest = errors.New("pov tx lookup not best") ErrPovTDNotFound = errors.New("pov total difficulty not found") ErrPovMinerStatNotFound = errors.New("pov miner statistics not found") ErrPovDiffStatNotFound = errors.New("pov difficulty statistics not found") )
View Source
var ( ErrVmLogsExists = errors.New("the VmLogs is empty") ErrVmLogsNotFound = errors.New("VmLogs not found") )
View Source
var ErrKeyDeleted = errors.New("key is deleted")
View Source
var ErrKeyNotInCache = errors.New("key not in cache")
Functions ¶
Types ¶
type Account ¶ added in v1.3.0
type Account struct { Address types.Address `msg:"address,extension" json:"address"` Token types.Hash `msg:"token,extension" json:"token"` Header types.Hash `msg:"header,extension" json:"header"` Representative types.Address `msg:"rep,extension" json:"representative"` OpenBlock types.Hash `msg:"open,extension" json:"open"` Balance types.Balance `msg:"balance,extension" json:"balance"` Modified int64 `msg:"modified" json:"modified"` BlockCount int64 `msg:"blockCount," json:"blockCount"` Certain int `msg:"certain" json:"certain"` // 0(false), 1(true)。 Consecutive int `msg:"consecutive" json:"consecutive"` // 0(false), 1(true)。 }
type AccountStore ¶ added in v1.4.0
type AccountStore interface { GetAccountMeta(address types.Address, c ...storage.Cache) (*types.AccountMeta, error) GetAccountMetas(fn func(am *types.AccountMeta) error) error CountAccountMetas() (uint64, error) HasAccountMetaConfirmed(address types.Address) (bool, error) AddAccountMeta(value *types.AccountMeta, c storage.Cache) error UpdateAccountMeta(value *types.AccountMeta, c storage.Cache) error DeleteAccountMeta(key types.Address, c storage.Cache) error GetAccountMetaConfirmed(address types.Address, c ...storage.Cache) (*types.AccountMeta, error) GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error) HasTokenMeta(address types.Address, tokenType types.Hash) (bool, error) AddTokenMetaConfirmed(address types.Address, meta *types.TokenMeta, c storage.Cache) error DeleteTokenMetaConfirmed(address types.Address, tokenType types.Hash, c storage.Cache) error GetTokenMetaConfirmed(address types.Address, tokenType types.Hash) (*types.TokenMeta, error) AddAccountMetaCache(value *types.AccountMeta, batch ...storage.Batch) error AddOrUpdateAccountMetaCache(value *types.AccountMeta, batch ...storage.Batch) error UpdateAccountMeteCache(value *types.AccountMeta, batch ...storage.Batch) error DeleteAccountMetaCache(key types.Address, batch ...storage.Batch) error GetAccountMeteCache(key types.Address, batch ...storage.Batch) (*types.AccountMeta, error) GetAccountMetaCaches(fn func(am *types.AccountMeta) error) error HasAccountMetaCache(key types.Address) (bool, error) DeleteTokenMetaCache(address types.Address, tokenType types.Hash, batch ...storage.Batch) error Weight(account types.Address) types.Balance CalculateAmount(block *types.StateBlock) (types.Balance, error) AddAccountMetaHistory(tm *types.TokenMeta, block *types.StateBlock, c storage.Cache) error UpdateAccountMetaHistory(tm *types.TokenMeta, block *types.StateBlock, c storage.Cache) error GetAccountMetaByPovHeight(address types.Address, height uint64) (*types.AccountMeta, error) GetTokenMetaByPovHeight(address types.Address, token types.Hash, height uint64) (*types.TokenMeta, error) GetTokenMetaByBlockHash(hash types.Hash) (*types.TokenMeta, error) ContractAddress(b *types.StateBlock) (*types.Address, error) }
type Block ¶ added in v1.3.0
type Block struct { Type types.BlockType `msg:"type" json:"type"` Token types.Hash `msg:"token,extension" json:"token"` Address types.Address `msg:"address,extension" json:"address"` Balance types.Balance `msg:"balance,extension" json:"balance"` Vote types.Balance `msg:"vote,extension" json:"vote"` Network types.Balance `msg:"network,extension" json:"network"` Storage types.Balance `msg:"storage,extension" json:"storage"` Oracle types.Balance `msg:"oracle,extension" json:"oracle"` Previous types.Hash `msg:"previous,extension" json:"previous"` Link types.Hash `msg:"link,extension" json:"link"` Sender []byte `msg:"sender" json:"sender,omitempty"` Receiver []byte `msg:"receiver" json:"receiver,omitempty"` Message types.Hash `msg:"message,extension" json:"message,omitempty"` Data []byte `msg:"data" json:"data,omitempty"` PoVHeight uint64 `msg:"povHeight" json:"povHeight"` Timestamp int64 `msg:"timestamp" json:"timestamp"` Extra types.Hash `msg:"extra,extension" json:"extra,omitempty"` Representative types.Address `msg:"representative,extension" json:"representative"` Work types.Work `msg:"work,extension" json:"work"` Signature types.Signature `msg:"signature,extension" json:"signature"` Hash types.Hash `msg:"hash" json:"hash"` BlockHeight int `msg:"blockHeight" json:"blockHeight"` // 0(block is isolated) InChain int `msg:"inChain" json:"inChain"` // 0(false), 1(true)。 Reason string `msg:"reason" json:"reason"` }
type BlockStore ¶ added in v1.4.0
type BlockStore interface { AddStateBlock(block *types.StateBlock) error GetStateBlock(hash types.Hash, c ...storage.Cache) (*types.StateBlock, error) HasStateBlock(hash types.Hash) (bool, error) GetRandomStateBlock() (*types.StateBlock, error) // UpdateStateBlock(block *types.StateBlock, c storage.Cache) error DeleteStateBlock(key types.Hash, c storage.Cache) error GetStateBlockConfirmed(hash types.Hash, c ...storage.Cache) (*types.StateBlock, error) GetStateBlocksConfirmed(fn func(*types.StateBlock) error) error HasStateBlockConfirmed(hash types.Hash) (bool, error) CountStateBlocks() (uint64, error) AddBlockCache(blk *types.StateBlock, batch ...storage.Batch) error DeleteBlockCache(hash types.Hash, batch ...storage.Batch) error GetBlockCache(key types.Hash) (*types.StateBlock, error) GetBlockCaches(fn func(*types.StateBlock) error) error HasBlockCache(key types.Hash) (bool, error) CountBlocksCache() (uint64, error) GetBlockChild(hash types.Hash, c ...storage.Cache) (types.Hash, error) GetBlockLink(key types.Hash, c ...storage.Cache) (types.Hash, error) }
type Cache ¶ added in v1.3.0
type Cache struct {
// contains filtered or unexported fields
}
type CacheStore ¶ added in v1.4.0
type CacheStore interface { Cache() *MemoryCache GetCacheStat() []*CacheStat GetCacheStatue() map[string]string UCache() *MemoryCache GetUCacheStat() []*CacheStat GetUCacheStatue() map[string]string }
type ContractStore ¶ added in v1.4.0
type ContractStore interface { GetBlockChild(hash types.Hash, c ...storage.Cache) (types.Hash, error) GetStateBlock(hash types.Hash, c ...storage.Cache) (*types.StateBlock, error) GetStateBlockConfirmed(hash types.Hash, c ...storage.Cache) (*types.StateBlock, error) ContractAddress(b *types.StateBlock) (*types.Address, error) GetAccountMeta(address types.Address, c ...storage.Cache) (*types.AccountMeta, error) GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error) HasAccountMetaConfirmed(address types.Address) (bool, error) GetAccountMetaByPovHeight(address types.Address, height uint64) (*types.AccountMeta, error) GetTokenMetaByPovHeight(address types.Address, token types.Hash, height uint64) (*types.TokenMeta, error) GetTokenMetaByBlockHash(hash types.Hash) (*types.TokenMeta, error) GetLatestPovHeader() (*types.PovHeader, error) GetLatestPovBlock() (*types.PovBlock, error) GetPovHeaderByHeight(height uint64) (*types.PovHeader, error) GetPovMinerStat(dayIndex uint32, batch ...storage.Batch) (*types.PovMinerDayStat, error) IsUserAccount(address types.Address) (bool, error) CalculateAmount(block *types.StateBlock) (types.Balance, error) GetRelation(dest interface{}, query string) error SelectRelation(dest interface{}, query string) error NewVMIterator(address *types.Address) *Iterator ListTokens() ([]*types.TokenInfo, error) GetTokenById(tokenId types.Hash) (*types.TokenInfo, error) GetTokenByName(tokenName string) (*types.TokenInfo, error) DBStore() storage.Store EventBus() event.EventBus Get(k []byte, c ...storage.Cache) ([]byte, error) GetObject(k []byte, c ...storage.Cache) (interface{}, []byte, error) Iterator([]byte, []byte, func([]byte, []byte) error) error IteratorObject(prefix []byte, end []byte, fn func([]byte, interface{}) error) error }
type FrontierStore ¶ added in v1.4.0
type FrontierStore interface { AddFrontier(frontier *types.Frontier, c storage.Cache) error DeleteFrontier(key types.Hash, c storage.Cache) error GetFrontier(hash types.Hash, cache ...storage.Cache) (*types.Frontier, error) GetFrontiers() ([]*types.Frontier, error) CountFrontiers() (uint64, error) }
type GenericStore ¶ added in v1.4.0
type GenericStore interface { AddGenericType(key *types.GenericKey, value *types.GenericType) error GetGenericType(key *types.GenericKey) (*types.GenericType, error) DeleteGenericType(key *types.GenericKey) error UpdateGenericType(key *types.GenericKey, value *types.GenericType) error AddOrUpdateGenericType(key *types.GenericKey, value *types.GenericType) error GetGenericTypes(fn func(key *types.GenericKey, value *types.GenericType) error) error HasGenericType(key *types.GenericKey) (bool, error) CountGenericTypes() (uint64, error) }
type Ledger ¶
func NewTestLedger ¶ added in v1.3.0
func NewTestLedger() (func(), *Ledger)
func (*Ledger) Action ¶ added in v1.3.0
func (l *Ledger) Action(at storage.ActionType, t int) (interface{}, error)
func (*Ledger) AddAccountMeta ¶
AccountMeta Confirmed
func (*Ledger) AddAccountMetaCache ¶ added in v1.2.3
AccountMeta UnConfirmed
func (*Ledger) AddAccountMetaHistory ¶ added in v1.4.0
func (*Ledger) AddBlockCache ¶ added in v1.2.3
Block UnConfirmed
func (*Ledger) AddBlockPrivatePayload ¶ added in v1.4.0
func (*Ledger) AddFrontier ¶
func (*Ledger) AddGapDoDSettleStateBlock ¶ added in v1.4.0
func (l *Ledger) AddGapDoDSettleStateBlock(key types.Hash, blk *types.StateBlock, sync types.SynchronizedKind) error
func (*Ledger) AddGapPovBlock ¶ added in v1.3.0
func (l *Ledger) AddGapPovBlock(height uint64, blk *types.StateBlock, sync types.SynchronizedKind) error
func (*Ledger) AddGapPublishBlock ¶ added in v1.4.0
func (l *Ledger) AddGapPublishBlock(key types.Hash, blk *types.StateBlock, sync types.SynchronizedKind) error
func (*Ledger) AddGenericType ¶ added in v1.3.0
func (l *Ledger) AddGenericType(key *types.GenericKey, value *types.GenericType) error
func (*Ledger) AddGenericTypeC ¶ added in v1.4.0
func (l *Ledger) AddGenericTypeC(key *types.GenericKeyC, value *types.GenericTypeC, c storage.Cache) error
func (*Ledger) AddOrUpdateAccountMetaCache ¶ added in v1.2.3
func (*Ledger) AddOrUpdateGenericType ¶ added in v1.3.0
func (l *Ledger) AddOrUpdateGenericType(key *types.GenericKey, value *types.GenericType) error
func (*Ledger) AddOrUpdateGenericTypeC ¶ added in v1.4.0
func (l *Ledger) AddOrUpdateGenericTypeC(key *types.GenericKeyC, value *types.GenericTypeC, c storage.Cache) error
func (*Ledger) AddOrUpdatePeerInfo ¶ added in v1.3.1
func (*Ledger) AddOrUpdateVmLogs ¶ added in v1.4.0
func (*Ledger) AddPeerInfo ¶ added in v1.3.1
func (*Ledger) AddPending ¶
func (l *Ledger) AddPending(key *types.PendingKey, value *types.PendingInfo, c storage.Cache) error
func (*Ledger) AddPovBestHash ¶ added in v1.2.3
func (*Ledger) AddPovBlock ¶ added in v1.2.3
func (*Ledger) AddPovBody ¶ added in v1.2.3
func (*Ledger) AddPovDiffStat ¶ added in v1.3.1
func (l *Ledger) AddPovDiffStat(dayStat *types.PovDiffDayStat) error
func (*Ledger) AddPovHeader ¶ added in v1.2.3
func (*Ledger) AddPovHeight ¶ added in v1.2.3
func (*Ledger) AddPovMinerStat ¶ added in v1.2.3
func (l *Ledger) AddPovMinerStat(dayStat *types.PovMinerDayStat) error
func (*Ledger) AddPovTxLookup ¶ added in v1.2.3
func (*Ledger) AddPovTxLookupInBatch ¶ added in v1.3.0
func (*Ledger) AddRepresentation ¶
func (*Ledger) AddSmartContractBlock ¶ added in v0.0.9
func (l *Ledger) AddSmartContractBlock(value *types.SmartContractBlock) error
func (*Ledger) AddStateBlock ¶ added in v0.0.9
func (l *Ledger) AddStateBlock(block *types.StateBlock) error
func (*Ledger) AddTokenMetaConfirmed ¶ added in v1.4.0
func (*Ledger) AddTrieCleanHeight ¶ added in v1.4.2
func (*Ledger) AddUncheckedBlock ¶
func (l *Ledger) AddUncheckedBlock(key types.Hash, blk *types.StateBlock, kind types.UncheckedKind, sync types.SynchronizedKind) error
func (*Ledger) AddUncheckedSyncBlock ¶ added in v1.3.0
func (*Ledger) AddUnconfirmedSyncBlock ¶ added in v1.3.0
func (*Ledger) AddVoteHistory ¶ added in v1.3.1
func (*Ledger) BatchGetPovHeadersByHeightAsc ¶ added in v1.2.3
func (*Ledger) BatchGetPovHeadersByHeightDesc ¶ added in v1.2.3
func (*Ledger) BlockConfirmed ¶ added in v1.4.0
func (l *Ledger) BlockConfirmed(blk *types.StateBlock)
func (*Ledger) BlocksByAccount ¶ added in v1.4.0
func (*Ledger) BlocksCount ¶ added in v1.4.0
func (*Ledger) BlocksCountByType ¶ added in v1.4.0
func (*Ledger) Cache ¶ added in v1.4.0
func (l *Ledger) Cache() *MemoryCache
func (*Ledger) CalculateAmount ¶ added in v0.0.9
func (*Ledger) CleanAllVoteHistory ¶ added in v1.3.1
func (*Ledger) CleanBlockVoteHistory ¶ added in v1.3.1
func (*Ledger) CleanSyncCache ¶ added in v1.3.0
func (l *Ledger) CleanSyncCache()
func (*Ledger) ContractAddress ¶ added in v1.4.0
func (*Ledger) CountAccountMetas ¶ added in v0.0.5
func (*Ledger) CountBlocksCache ¶ added in v1.4.0
func (*Ledger) CountFrontiers ¶
func (*Ledger) CountGenericTypeCs ¶ added in v1.4.0
func (*Ledger) CountGenericTypes ¶ added in v1.3.0
func (*Ledger) CountPeersInfo ¶ added in v1.3.1
func (*Ledger) CountPovAccountTxs ¶ added in v1.4.0
func (*Ledger) CountPovBestHashs ¶ added in v1.2.3
func (*Ledger) CountPovBlocks ¶ added in v1.2.3
func (*Ledger) CountPovTxs ¶ added in v1.2.3
func (*Ledger) CountRepresentations ¶ added in v1.3.0
func (*Ledger) CountSmartContractBlocks ¶ added in v0.0.9
func (*Ledger) CountStateBlocks ¶ added in v0.0.2
func (*Ledger) CountUncheckedBlocks ¶
func (*Ledger) CountUncheckedBlocksStore ¶ added in v1.4.2
func (*Ledger) CountUncheckedSyncBlocks ¶ added in v1.3.0
func (*Ledger) CountUnconfirmedSyncBlocks ¶ added in v1.3.0
func (*Ledger) CountVmLogs ¶ added in v1.4.0
func (*Ledger) DebugAllPovInfos ¶ added in v1.4.0
func (l *Ledger) DebugAllPovInfos()
func (*Ledger) DeleteAccountMeta ¶
func (*Ledger) DeleteAccountMetaCache ¶ added in v1.2.3
func (*Ledger) DeleteBlockCache ¶ added in v1.2.3
func (*Ledger) DeleteBlockPrivatePayload ¶ added in v1.4.0
func (*Ledger) DeleteFrontier ¶
func (*Ledger) DeleteGapDoDSettleStateBlock ¶ added in v1.4.0
func (*Ledger) DeleteGapPovBlock ¶ added in v1.3.0
func (*Ledger) DeleteGapPublishBlock ¶ added in v1.4.0
func (*Ledger) DeleteGenericType ¶ added in v1.3.0
func (l *Ledger) DeleteGenericType(key *types.GenericKey) error
func (*Ledger) DeleteGenericTypeC ¶ added in v1.4.0
func (*Ledger) DeletePending ¶
func (*Ledger) DeletePovBestHash ¶ added in v1.2.3
func (*Ledger) DeletePovBlock ¶ added in v1.2.3
func (*Ledger) DeletePovBody ¶ added in v1.2.3
func (*Ledger) DeletePovDiffStat ¶ added in v1.3.1
func (*Ledger) DeletePovHeader ¶ added in v1.2.3
func (*Ledger) DeletePovHeight ¶ added in v1.2.3
func (*Ledger) DeletePovMinerStat ¶ added in v1.2.3
func (*Ledger) DeletePovTD ¶ added in v1.2.3
func (*Ledger) DeletePovTxLookup ¶ added in v1.2.3
func (*Ledger) DeletePovTxLookupInBatch ¶ added in v1.3.0
func (*Ledger) DeleteStateBlock ¶ added in v0.0.2
func (*Ledger) DeleteTokenMetaCache ¶ added in v1.2.4
func (l *Ledger) DeleteTokenMetaCache(address types.Address, tokenType types.Hash, batch ...storage.Batch) error
Token UnConfirmed
func (*Ledger) DeleteTokenMetaConfirmed ¶ added in v1.4.0
func (*Ledger) DeleteUncheckedBlock ¶
func (*Ledger) DeleteUncheckedSyncBlock ¶ added in v1.3.0
func (*Ledger) DeleteUnconfirmedSyncBlock ¶ added in v1.3.0
func (*Ledger) DeleteVmLogs ¶ added in v1.4.0
func (*Ledger) DropAllPovBlocks ¶ added in v1.2.3
func (*Ledger) EmptyRelation ¶ added in v1.4.0
func (*Ledger) GenerateChangeBlock ¶ added in v0.0.5
func (l *Ledger) GenerateChangeBlock(account types.Address, representative types.Address, prk ed25519.PrivateKey) (*types.StateBlock, error)
func (*Ledger) GenerateOnlineBlock ¶ added in v1.3.0
func (l *Ledger) GenerateOnlineBlock(account types.Address, prk ed25519.PrivateKey, povHeight uint64) (*types.StateBlock, error)
func (*Ledger) GenerateReceiveBlock ¶ added in v0.0.5
func (l *Ledger) GenerateReceiveBlock(sendBlock *types.StateBlock, prk ed25519.PrivateKey) (*types.StateBlock, error)
func (*Ledger) GenerateSendBlock ¶ added in v0.0.5
func (l *Ledger) GenerateSendBlock(block *types.StateBlock, amount types.Balance, prk ed25519.PrivateKey) (*types.StateBlock, error)
func (*Ledger) GetAccountMeta ¶
func (*Ledger) GetAccountMetaByPovHeight ¶ added in v1.4.0
func (*Ledger) GetAccountMetaCaches ¶ added in v1.3.0
func (l *Ledger) GetAccountMetaCaches(fn func(am *types.AccountMeta) error) error
func (*Ledger) GetAccountMetaConfirmed ¶ added in v1.2.3
func (*Ledger) GetAccountMetas ¶ added in v0.0.5
func (l *Ledger) GetAccountMetas(fn func(am *types.AccountMeta) error) error
func (*Ledger) GetAccountMeteCache ¶ added in v1.4.0
func (*Ledger) GetAllPovBestBlocks ¶ added in v1.2.3
func (*Ledger) GetAllPovBestHashes ¶ added in v1.2.3
func (*Ledger) GetAllPovBestHeaders ¶ added in v1.2.3
func (*Ledger) GetAllPovBlocks ¶ added in v1.2.3
func (*Ledger) GetAllPovDiffStats ¶ added in v1.3.1
func (l *Ledger) GetAllPovDiffStats(fn func(*types.PovDiffDayStat) error) error
func (*Ledger) GetAllPovHeaders ¶ added in v1.2.3
func (*Ledger) GetAllPovMinerStats ¶ added in v1.2.3
func (l *Ledger) GetAllPovMinerStats(fn func(*types.PovMinerDayStat) error) error
func (*Ledger) GetBlockCache ¶ added in v1.2.3
func (*Ledger) GetBlockCaches ¶ added in v1.2.3
func (l *Ledger) GetBlockCaches(fn func(*types.StateBlock) error) error
func (*Ledger) GetBlockChild ¶ added in v1.4.0
Block Child / Link
func (*Ledger) GetBlockLink ¶ added in v1.4.0
func (*Ledger) GetBlockPrivatePayload ¶ added in v1.4.0
func (*Ledger) GetCacheStat ¶ added in v1.4.0
func (*Ledger) GetCacheStatue ¶ added in v1.4.0
func (*Ledger) GetFrontier ¶
func (*Ledger) GetGapDoDSettleStateBlock ¶ added in v1.4.0
func (*Ledger) GetGapPublishBlock ¶ added in v1.4.0
func (*Ledger) GetGenericType ¶ added in v1.3.0
func (l *Ledger) GetGenericType(key *types.GenericKey) (*types.GenericType, error)
func (*Ledger) GetGenericTypeC ¶ added in v1.4.0
func (l *Ledger) GetGenericTypeC(key *types.GenericKeyC, c ...storage.Cache) (*types.GenericTypeC, error)
func (*Ledger) GetGenericTypeCs ¶ added in v1.4.0
func (l *Ledger) GetGenericTypeCs(fn func(key *types.GenericKeyC, value *types.GenericTypeC) error) error
func (*Ledger) GetGenericTypes ¶ added in v1.3.0
func (l *Ledger) GetGenericTypes(fn func(key *types.GenericKey, value *types.GenericType) error) error
func (*Ledger) GetLastGapPovHeight ¶ added in v1.4.0
func (*Ledger) GetLatestPovBestHash ¶ added in v1.2.3
func (*Ledger) GetLatestPovBlock ¶ added in v1.2.3
func (*Ledger) GetLatestPovDiffStat ¶ added in v1.3.1
func (l *Ledger) GetLatestPovDiffStat() (*types.PovDiffDayStat, error)
func (*Ledger) GetLatestPovHeader ¶ added in v1.2.3
func (*Ledger) GetLatestPovMinerStat ¶ added in v1.2.3
func (*Ledger) GetOnlineRepresentations ¶ added in v0.0.9
func (*Ledger) GetPeerInfo ¶ added in v1.3.1
func (*Ledger) GetPeersInfo ¶ added in v1.3.1
func (*Ledger) GetPending ¶
func (l *Ledger) GetPending(pendingKey *types.PendingKey) (*types.PendingInfo, error)
func (*Ledger) GetPendings ¶ added in v1.1.0
func (l *Ledger) GetPendings(fn func(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo) error) error
func (*Ledger) GetPendingsByAddress ¶ added in v1.4.0
func (l *Ledger) GetPendingsByAddress(address types.Address, fn func(key *types.PendingKey, value *types.PendingInfo) error) error
func (*Ledger) GetPendingsByToken ¶ added in v1.4.0
func (*Ledger) GetPovBestHash ¶ added in v1.2.3
func (*Ledger) GetPovBlockByHash ¶ added in v1.2.3
func (*Ledger) GetPovBlockByHeight ¶ added in v1.2.3
func (*Ledger) GetPovBlockByHeightAndHash ¶ added in v1.2.3
func (*Ledger) GetPovBody ¶ added in v1.2.3
func (*Ledger) GetPovDiffStat ¶ added in v1.3.1
func (l *Ledger) GetPovDiffStat(dayIndex uint32) (*types.PovDiffDayStat, error)
func (*Ledger) GetPovHeader ¶ added in v1.2.3
func (*Ledger) GetPovHeaderByHash ¶ added in v1.2.3
func (*Ledger) GetPovHeaderByHeight ¶ added in v1.2.3
func (*Ledger) GetPovHeight ¶ added in v1.2.3
func (*Ledger) GetPovLatestHeight ¶ added in v1.3.0
func (*Ledger) GetPovMinerStat ¶ added in v1.2.3
func (*Ledger) GetPovTxLookup ¶ added in v1.2.3
func (*Ledger) GetPovTxlScanCursor ¶ added in v1.3.0
func (*Ledger) GetRandomStateBlock ¶ added in v0.0.2
func (l *Ledger) GetRandomStateBlock() (*types.StateBlock, error)
func (*Ledger) GetRelation ¶ added in v1.4.0
func (*Ledger) GetRepresentation ¶
func (*Ledger) GetRepresentations ¶ added in v0.0.5
func (*Ledger) GetSmartContractBlock ¶ added in v0.0.9
func (*Ledger) GetSmartContractBlocks ¶ added in v0.0.9
func (l *Ledger) GetSmartContractBlocks(fn func(block *types.SmartContractBlock) error) error
func (*Ledger) GetStateBlock ¶ added in v0.0.2
func (*Ledger) GetStateBlockConfirmed ¶ added in v1.2.3
func (*Ledger) GetStateBlocksConfirmed ¶ added in v1.4.0
func (l *Ledger) GetStateBlocksConfirmed(fn func(*types.StateBlock) error) error
func (*Ledger) GetTokenById ¶ added in v0.0.9
func (*Ledger) GetTokenByName ¶ added in v0.0.9
func (*Ledger) GetTokenMeta ¶
func (l *Ledger) GetTokenMeta(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)
Token
func (*Ledger) GetTokenMetaByBlockHash ¶ added in v1.4.0
func (*Ledger) GetTokenMetaByPovHeight ¶ added in v1.4.0
func (*Ledger) GetTokenMetaConfirmed ¶ added in v1.2.3
func (l *Ledger) GetTokenMetaConfirmed(address types.Address, tokenType types.Hash) (*types.TokenMeta, error)
Token Confirmed
func (*Ledger) GetTrieCleanHeight ¶ added in v1.4.2
func (*Ledger) GetUCacheStat ¶ added in v1.4.2
func (*Ledger) GetUCacheStatue ¶ added in v1.4.2
func (*Ledger) GetUncheckedBlock ¶
func (l *Ledger) GetUncheckedBlock(hash types.Hash, kind types.UncheckedKind) (*types.StateBlock, types.SynchronizedKind, error)
func (*Ledger) GetUncheckedBlocks ¶ added in v1.4.0
func (l *Ledger) GetUncheckedBlocks(visit types.UncheckedBlockWalkFunc) error
func (*Ledger) GetUncheckedSyncBlock ¶ added in v1.3.0
func (*Ledger) GetUnconfirmedSyncBlock ¶ added in v1.3.0
func (*Ledger) GetVerifiedData ¶ added in v1.4.0
func (*Ledger) HasAccountMetaCache ¶ added in v1.2.3
func (*Ledger) HasAccountMetaConfirmed ¶ added in v1.4.0
func (*Ledger) HasBlockCache ¶ added in v1.2.3
func (*Ledger) HasGenericType ¶ added in v1.3.0
func (l *Ledger) HasGenericType(key *types.GenericKey) (bool, error)
func (*Ledger) HasGenericTypeC ¶ added in v1.4.0
func (*Ledger) HasPovBlock ¶ added in v1.2.3
func (*Ledger) HasPovBody ¶ added in v1.2.3
func (*Ledger) HasPovHeader ¶ added in v1.2.3
func (*Ledger) HasPovMinerStat ¶ added in v1.3.0
func (*Ledger) HasPovTxLookup ¶ added in v1.2.3
func (*Ledger) HasSmartContractBlock ¶ added in v0.0.9
func (*Ledger) HasStateBlock ¶ added in v0.0.2
func (*Ledger) HasStateBlockConfirmed ¶ added in v1.2.3
func (*Ledger) HasTokenMeta ¶
func (*Ledger) HasUncheckedBlock ¶
func (*Ledger) HasUncheckedSyncBlock ¶ added in v1.3.0
func (*Ledger) HasUnconfirmedSyncBlock ¶ added in v1.3.0
func (*Ledger) HasVoteHistory ¶ added in v1.3.1
func (*Ledger) IsUserAccount ¶ added in v1.4.0
func (*Ledger) IteratorObject ¶ added in v1.4.0
func (*Ledger) ListTokens ¶ added in v0.0.9
func (*Ledger) NeedToWriteTrie ¶ added in v1.4.2
func (*Ledger) NewVMIterator ¶ added in v1.4.0
func (*Ledger) PendingAmount ¶ added in v1.3.0
func (*Ledger) PovHeightAddGap ¶ added in v1.4.0
func (*Ledger) PovHeightDeleteGap ¶ added in v1.4.0
func (*Ledger) PovHeightHasGap ¶ added in v1.4.0
func (*Ledger) RegisterInterface ¶ added in v1.4.0
func (*Ledger) RegisterRelation ¶ added in v1.4.0
func (*Ledger) RemoveStorage ¶ added in v1.4.0
func (*Ledger) SaveStorage ¶ added in v1.4.0
save storage to cache, value can be slice and interface
func (*Ledger) SaveStorageByConvert ¶ added in v1.4.0
use for rollback, if val is a interface struct
func (*Ledger) SearchVmLogs ¶ added in v1.4.0
func (*Ledger) SelectRelation ¶ added in v1.4.0
func (*Ledger) SetCacheCapacity ¶ added in v1.4.2
func (*Ledger) SetLastGapPovHeight ¶ added in v1.4.0
func (*Ledger) SetOnlineRepresentations ¶ added in v0.0.9
func (*Ledger) SetPovLatestHeight ¶ added in v1.3.0
func (*Ledger) SetPovTxlScanCursor ¶ added in v1.3.0
func (*Ledger) SetStorage ¶ added in v0.0.9
set storage to badger, all value need to be slice
func (*Ledger) SubRepresentation ¶
func (*Ledger) UCache ¶ added in v1.4.2
func (l *Ledger) UCache() *MemoryCache
func (*Ledger) UpdateAccountMeta ¶
func (*Ledger) UpdateAccountMetaHistory ¶ added in v1.4.0
func (*Ledger) UpdateAccountMeteCache ¶ added in v1.4.0
func (*Ledger) UpdateGenericType ¶ added in v1.3.0
func (l *Ledger) UpdateGenericType(key *types.GenericKey, value *types.GenericType) error
func (*Ledger) UpdateGenericTypeC ¶ added in v1.4.0
func (l *Ledger) UpdateGenericTypeC(key *types.GenericKeyC, value *types.GenericTypeC, c storage.Cache) error
func (*Ledger) UpdatePeerInfo ¶ added in v1.3.1
func (*Ledger) UpdateStateBlock ¶ added in v1.4.0
func (*Ledger) WalkGapPovBlocks ¶ added in v1.3.0
func (l *Ledger) WalkGapPovBlocks(visit types.GapPovBlockWalkFunc) error
func (*Ledger) WalkGapPovBlocksWithHeight ¶ added in v1.4.0
func (l *Ledger) WalkGapPovBlocksWithHeight(height uint64, visit types.GapPovBlockWalkFunc) error
func (*Ledger) WalkSyncCache ¶ added in v1.3.0
func (l *Ledger) WalkSyncCache(visit common.SyncCacheWalkFunc)
type LedgerStore ¶ added in v1.4.0
type LedgerStore interface { Close() error DBStore() storage.Store EventBus() event.EventBus Get(k []byte, c ...storage.Cache) ([]byte, error) GetObject(k []byte, c ...storage.Cache) (interface{}, []byte, error) Iterator([]byte, []byte, func([]byte, []byte) error) error IteratorObject(prefix []byte, end []byte, fn func([]byte, interface{}) error) error GenerateSendBlock(block *types.StateBlock, amount types.Balance, prk ed25519.PrivateKey) (*types.StateBlock, error) GenerateReceiveBlock(sendBlock *types.StateBlock, prk ed25519.PrivateKey) (*types.StateBlock, error) GenerateChangeBlock(account types.Address, representative types.Address, prk ed25519.PrivateKey) (*types.StateBlock, error) GenerateOnlineBlock(account types.Address, prk ed25519.PrivateKey, povHeight uint64) (*types.StateBlock, error) GetVerifiedData() map[types.Hash]int Action(at storage.ActionType, t int) (interface{}, error) GetRelation(dest interface{}, query string) error SelectRelation(dest interface{}, query string) error Flush() error FlushU() error BlockConfirmed(blk *types.StateBlock) AddTrieCleanHeight(height uint64) error GetTrieCleanHeight() (uint64, error) NeedToWriteTrie(height uint64) bool }
type MemoryCache ¶ added in v1.4.0
type MemoryCache struct {
// contains filtered or unexported fields
}
func NewMemoryCache ¶ added in v1.4.0
func NewMemoryCache(ledger *Ledger, flushInterval time.Duration, size int, typ cacheType) *MemoryCache
func (*MemoryCache) BatchUpdate ¶ added in v1.4.0
func (lc *MemoryCache) BatchUpdate(fn func(c *Cache) error) error
func (*MemoryCache) Delete ¶ added in v1.4.2
func (lc *MemoryCache) Delete(key []byte) error
func (*MemoryCache) Get ¶ added in v1.4.0
func (lc *MemoryCache) Get(key []byte) (interface{}, error)
func (*MemoryCache) GetCache ¶ added in v1.4.0
func (lc *MemoryCache) GetCache() *Cache
get write cache index
func (*MemoryCache) Put ¶ added in v1.4.0
func (lc *MemoryCache) Put(key []byte, value interface{}) error
func (*MemoryCache) ResetCapacity ¶ added in v1.4.2
func (lc *MemoryCache) ResetCapacity(size int)
type PeerInfoStore ¶ added in v1.4.0
type PeerInfoStore interface { AddPeerInfo(info *types.PeerInfo) error GetPeerInfo(peerID string) (*types.PeerInfo, error) GetPeersInfo(fn func(info *types.PeerInfo) error) error CountPeersInfo() (uint64, error) UpdatePeerInfo(value *types.PeerInfo) error AddOrUpdatePeerInfo(value *types.PeerInfo) error }
type PendingStore ¶ added in v1.4.0
type PendingStore interface { GetPending(pendingKey *types.PendingKey) (*types.PendingInfo, error) GetPendings(fn func(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo) error) error GetPendingsByAddress(address types.Address, fn func(key *types.PendingKey, value *types.PendingInfo) error) error GetPendingsByToken(account types.Address, token types.Hash, fn func(key *types.PendingKey, value *types.PendingInfo) error) error PendingAmount(address types.Address, token types.Hash) (types.Balance, error) AddPending(key *types.PendingKey, value *types.PendingInfo, c storage.Cache) error DeletePending(key *types.PendingKey, c storage.Cache) error }
type PovStore ¶ added in v1.4.0
type PovStore interface { AddPovBlock(blk *types.PovBlock, td *types.PovTD, batch ...storage.Batch) error DeletePovBlock(blk *types.PovBlock) error AddPovHeader(header *types.PovHeader) error DeletePovHeader(height uint64, hash types.Hash) error GetPovHeader(height uint64, hash types.Hash) (*types.PovHeader, error) HasPovHeader(height uint64, hash types.Hash, batch ...storage.Batch) bool AddPovBody(height uint64, hash types.Hash, body *types.PovBody) error DeletePovBody(height uint64, hash types.Hash) error GetPovBody(height uint64, hash types.Hash) (*types.PovBody, error) HasPovBody(height uint64, hash types.Hash, batch ...storage.Batch) bool AddPovHeight(hash types.Hash, height uint64) error DeletePovHeight(hash types.Hash) error GetPovHeight(hash types.Hash) (uint64, error) HasPovHeight(hash types.Hash) bool AddPovTD(hash types.Hash, height uint64, td *types.PovTD) error DeletePovTD(hash types.Hash, height uint64) error GetPovTD(hash types.Hash, height uint64, batch ...storage.Batch) (*types.PovTD, error) AddPovTxLookup(txHash types.Hash, txLookup *types.PovTxLookup, batch ...storage.Batch) error DeletePovTxLookup(txHash types.Hash, batch ...storage.Batch) error GetPovTxLookup(txHash types.Hash) (*types.PovTxLookup, error) HasPovTxLookup(txHash types.Hash) bool AddPovTxLookupInBatch(txHash types.Hash, txLookup *types.PovTxLookup, batch storage.Batch) error DeletePovTxLookupInBatch(txHash types.Hash, batch storage.Batch) error SetPovTxlScanCursor(height uint64, batch ...storage.Batch) error GetPovTxlScanCursor() (uint64, error) AddPovBestHash(height uint64, hash types.Hash, batch ...storage.Batch) error DeletePovBestHash(height uint64, batch ...storage.Batch) error GetPovBestHash(height uint64, batch ...storage.Batch) (types.Hash, error) GetAllPovBestHashes(fn func(height uint64, hash types.Hash) error) error SetPovLatestHeight(height uint64, batch ...storage.Batch) error GetPovLatestHeight() (uint64, error) AddPovMinerStat(dayStat *types.PovMinerDayStat) error DeletePovMinerStat(dayIndex uint32) error GetPovMinerStat(dayIndex uint32, batch ...storage.Batch) (*types.PovMinerDayStat, error) HasPovMinerStat(dayIndex uint32) bool GetLatestPovMinerStat(batch ...storage.Batch) (*types.PovMinerDayStat, error) GetAllPovMinerStats(fn func(*types.PovMinerDayStat) error) error AddPovDiffStat(dayStat *types.PovDiffDayStat) error DeletePovDiffStat(dayIndex uint32) error GetPovDiffStat(dayIndex uint32) (*types.PovDiffDayStat, error) GetLatestPovDiffStat() (*types.PovDiffDayStat, error) GetAllPovDiffStats(fn func(*types.PovDiffDayStat) error) error GetPovBlockByHeightAndHash(height uint64, hash types.Hash) (*types.PovBlock, error) GetPovBlockByHeight(height uint64) (*types.PovBlock, error) GetPovBlockByHash(hash types.Hash) (*types.PovBlock, error) GetPovHeaderByHeight(height uint64) (*types.PovHeader, error) BatchGetPovHeadersByHeightAsc(height uint64, count uint64) ([]*types.PovHeader, error) BatchGetPovHeadersByHeightDesc(height uint64, count uint64) ([]*types.PovHeader, error) GetPovHeaderByHash(hash types.Hash) (*types.PovHeader, error) GetAllPovHeaders(fn func(header *types.PovHeader) error) error GetAllPovBlocks(fn func(*types.PovBlock) error) error GetAllPovBestHeaders(fn func(header *types.PovHeader) error) error GetAllPovBestBlocks(fn func(*types.PovBlock) error) error GetLatestPovBestHash() (types.Hash, error) GetLatestPovHeader() (*types.PovHeader, error) GetLatestPovBlock() (*types.PovBlock, error) HasPovBlock(height uint64, hash types.Hash, batch ...storage.Batch) bool DropAllPovBlocks() error CountPovBlocks() (uint64, error) CountPovTxs() (uint64, error) CountPovAccountTxs() (uint64, error) CountPovBestHashs() (uint64, error) DebugAllPovInfos() }
type PrivacyStore ¶ added in v1.4.0
type RepresentationStore ¶ added in v1.4.0
type RepresentationStore interface { GetRepresentation(key types.Address, c ...storage.Cache) (*types.Benefit, error) GetRepresentations(fn func(types.Address, *types.Benefit) error) error CountRepresentations() (uint64, error) AddRepresentation(address types.Address, diff *types.Benefit, c storage.Cache) error SubRepresentation(address types.Address, diff *types.Benefit, c storage.Cache) error GetOnlineRepresentations() ([]types.Address, error) SetOnlineRepresentations(addresses []*types.Address) error }
type SmartBlockStore ¶ added in v1.4.0
type SmartBlockStore interface { AddSmartContractBlock(value *types.SmartContractBlock) error HasSmartContractBlock(key types.Hash) (bool, error) GetSmartContractBlock(key types.Hash) (*types.SmartContractBlock, error) GetSmartContractBlocks(fn func(block *types.SmartContractBlock) error) error CountSmartContractBlocks() (uint64, error) }
type Store ¶
type Store interface { AccountStore SmartBlockStore BlockStore PendingStore FrontierStore RepresentationStore UncheckedBlockStore PeerInfoStore SyncStore DposStore PovStore VoteStore Relation CacheStore LedgerStore PrivacyStore VmlogsStore VmStore }
func DefaultStore ¶ added in v1.4.0
func DefaultStore() Store
type SyncStore ¶ added in v1.4.0
type SyncStore interface { AddUncheckedSyncBlock(previous types.Hash, blk *types.StateBlock) error GetUncheckedSyncBlock(hash types.Hash) (*types.StateBlock, error) HasUncheckedSyncBlock(hash types.Hash) (bool, error) CountUncheckedSyncBlocks() (uint64, error) DeleteUncheckedSyncBlock(hash types.Hash) error AddUnconfirmedSyncBlock(hash types.Hash, blk *types.StateBlock) error GetUnconfirmedSyncBlock(hash types.Hash) (*types.StateBlock, error) HasUnconfirmedSyncBlock(hash types.Hash) (bool, error) CountUnconfirmedSyncBlocks() (uint64, error) DeleteUnconfirmedSyncBlock(hash types.Hash) error WalkSyncCache(visit common.SyncCacheWalkFunc) CleanSyncCache() }
type UncheckedBlockStore ¶ added in v1.4.0
type UncheckedBlockStore interface { AddUncheckedBlock(key types.Hash, value *types.StateBlock, kind types.UncheckedKind, sync types.SynchronizedKind) error DeleteUncheckedBlock(key types.Hash, kind types.UncheckedKind) error GetUncheckedBlock(parentHash types.Hash, kind types.UncheckedKind) (*types.StateBlock, types.SynchronizedKind, error) GetUncheckedBlocks(visit types.UncheckedBlockWalkFunc) error HasUncheckedBlock(hash types.Hash, kind types.UncheckedKind) (bool, error) CountUncheckedBlocks() (uint64, error) CountUncheckedBlocksStore() (uint64, error) AddGapPovBlock(height uint64, block *types.StateBlock, sync types.SynchronizedKind) error //GetGapPovBlock(height uint64) (types.StateBlockList, []types.SynchronizedKind, error) //CountGapPovBlocks() uint64 DeleteGapPovBlock(height uint64, hash types.Hash) error WalkGapPovBlocksWithHeight(height uint64, visit types.GapPovBlockWalkFunc) error WalkGapPovBlocks(visit types.GapPovBlockWalkFunc) error AddGapPublishBlock(key types.Hash, blk *types.StateBlock, sync types.SynchronizedKind) error DeleteGapPublishBlock(key types.Hash, blkHash types.Hash) error GetGapPublishBlock(key types.Hash, visit types.GapPublishBlockWalkFunc) error AddGapDoDSettleStateBlock(key types.Hash, block *types.StateBlock, sync types.SynchronizedKind) error GetGapDoDSettleStateBlock(key types.Hash, visit types.GapDoDSettleStateBlockWalkFunc) error DeleteGapDoDSettleStateBlock(key, blkHash types.Hash) error PovHeightAddGap(height uint64) error PovHeightHasGap(height uint64) (bool, error) PovHeightDeleteGap(height uint64) error }
type VmStore ¶ added in v1.4.0
type VmStore interface { // NewVMIterator new Iterator by contract address NewVMIterator(address *types.Address) *Iterator SetStorage(val map[string]interface{}) error SaveStorage(val map[string]interface{}, c ...storage.Cache) error SaveStorageByConvert(key []byte, val []byte, c storage.Cache) error RemoveStorage(key []byte, val []byte, c storage.Cache) error ListTokens() ([]*types.TokenInfo, error) GetTokenById(tokenId types.Hash) (*types.TokenInfo, error) GetTokenByName(tokenName string) (*types.TokenInfo, error) }
type VmlogsStore ¶ added in v1.4.0
type VmlogsStore interface { AddOrUpdateVmLogs(value *types.VmLogs, c storage.Cache) error GetVmLogs(key types.Hash, c ...storage.Cache) (*types.VmLogs, error) DeleteVmLogs(key types.Hash, c storage.Cache) error HasVmLogs(key types.Hash, c ...storage.Cache) (bool, error) SearchVmLogs(fn func(key types.Hash, value *types.VmLogs) error) error CountVmLogs() (uint64, error) }
Source Files ¶
- cache.go
- ledger.go
- ledger_account.go
- ledger_block.go
- ledger_dpos.go
- ledger_dump.go
- ledger_frontier.go
- ledger_generic.go
- ledger_generic_cache.go
- ledger_peersInfo.go
- ledger_pending.go
- ledger_pending_cache.go
- ledger_pov.go
- ledger_privacy.go
- ledger_relation.go
- ledger_represention.go
- ledger_smartblock.go
- ledger_store.go
- ledger_sync.go
- ledger_uncheck.go
- ledger_vm_store.go
- ledger_vmlogs.go
- ledger_vote_history.go
- verifieddata.go
Click to show internal directories.
Click to hide internal directories.