Documentation ¶
Index ¶
- Variables
- func CloseLedger()
- type Account
- type ActionType
- type Block
- type BlockLink
- type Cache
- func (c *Cache) AddAccountPending(address types.Address, token types.Hash, amount types.Balance) error
- func (c *Cache) DeleteAccountMetaConfirmed(address types.Address)
- func (c *Cache) DeleteAccountMetaUnConfirmed(address types.Address)
- func (c *Cache) DeleteAccountPending(address types.Address, token types.Hash)
- func (c *Cache) DeleteBlockConfirmed(hash types.Hash)
- func (c *Cache) DeleteBlockUnConfirmed(hash types.Hash)
- func (c *Cache) GetAccountMetaConfirmed(address types.Address) (*types.AccountMeta, error)
- func (c *Cache) GetAccountMetaUnConfirmed(address types.Address) (*types.AccountMeta, error)
- func (c *Cache) GetAccountPending(address types.Address, token types.Hash) (types.Balance, error)
- func (c *Cache) GetBlockConfirmed(hash types.Hash) (*types.StateBlock, error)
- func (c *Cache) GetBlockUnConfirmed(hash types.Hash) (*types.StateBlock, error)
- func (c *Cache) UpdateAccountMetaConfirmed(am *types.AccountMeta) error
- func (c *Cache) UpdateAccountMetaUnConfirmed(am *types.AccountMeta) error
- func (c *Cache) UpdateAccountPending(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo, add bool) error
- func (c *Cache) UpdateBlockConfirmed(block *types.StateBlock) error
- func (c *Cache) UpdateBlockUnConfirmed(block *types.StateBlock) error
- type Ledger
- func (l *Ledger) Account(hash types.Hash, txns ...db.StoreTxn) (*types.AccountMeta, error)
- func (l *Ledger) Action(action ActionType) (string, error)
- func (l *Ledger) AddAccountMeta(value *types.AccountMeta, txns ...db.StoreTxn) error
- func (l *Ledger) AddAccountMetaCache(value *types.AccountMeta, txns ...db.StoreTxn) error
- func (l *Ledger) AddBlockCache(value *types.StateBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddFrontier(frontier *types.Frontier, txns ...db.StoreTxn) error
- func (l *Ledger) AddGapPovBlock(height uint64, block *types.StateBlock, sync types.SynchronizedKind, ...) error
- func (l *Ledger) AddGenericType(key types.GenericKey, value *types.GenericType, txns ...db.StoreTxn) error
- func (l *Ledger) AddMessageInfo(key types.Hash, value []byte, txns ...db.StoreTxn) error
- func (l *Ledger) AddOrUpdateAccountMeta(value *types.AccountMeta, txns ...db.StoreTxn) error
- func (l *Ledger) AddOrUpdateAccountMetaCache(value *types.AccountMeta, txns ...db.StoreTxn) error
- func (l *Ledger) AddOrUpdateGenericType(key types.GenericKey, value *types.GenericType, txns ...db.StoreTxn) error
- func (l *Ledger) AddOrUpdatePeerInfo(value *types.PeerInfo, txns ...db.StoreTxn) error
- func (l *Ledger) AddOrUpdatePerformance(value *types.PerformanceTime, txns ...db.StoreTxn) error
- func (l *Ledger) AddOrUpdateTokenMeta(address types.Address, meta *types.TokenMeta, txns ...db.StoreTxn) error
- func (l *Ledger) AddPeerInfo(info *types.PeerInfo, txns ...db.StoreTxn) error
- func (l *Ledger) AddPending(key *types.PendingKey, value *types.PendingInfo, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovBestHash(height uint64, hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovBlock(blk *types.PovBlock, td *types.PovTD, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovBody(height uint64, hash types.Hash, body *types.PovBody, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovDiffStat(dayStat *types.PovDiffDayStat, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovHeader(header *types.PovHeader, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovHeight(hash types.Hash, height uint64, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovMinerStat(dayStat *types.PovMinerDayStat, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovTD(hash types.Hash, height uint64, td *types.PovTD, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovTxLookup(txHash types.Hash, txLookup *types.PovTxLookup, txns ...db.StoreTxn) error
- func (l *Ledger) AddPovTxLookupInBatch(txHash types.Hash, txLookup *types.PovTxLookup, batch db.StoreBatch) error
- func (l *Ledger) AddRepresentation(key types.Address, diff *types.Benefit, txns ...db.StoreTxn) error
- func (l *Ledger) AddSmartContractBlock(value *types.SmartContractBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddStateBlock(value *types.StateBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddSyncCacheBlock(value *types.StateBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddSyncStateBlock(value *types.StateBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddTokenMeta(address types.Address, meta *types.TokenMeta, txns ...db.StoreTxn) error
- func (l *Ledger) AddUncheckedBlock(key types.Hash, value *types.StateBlock, kind types.UncheckedKind, ...) error
- func (l *Ledger) AddUncheckedSyncBlock(previous types.Hash, blk *types.StateBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddUnconfirmedSyncBlock(hash types.Hash, blk *types.StateBlock, txns ...db.StoreTxn) error
- func (l *Ledger) AddVoteHistory(hash types.Hash, address types.Address, txns ...db.StoreTxn) error
- func (l *Ledger) Balance(account types.Address, txns ...db.StoreTxn) (map[types.Hash]types.Balance, error)
- func (l *Ledger) BatchGetPovHeadersByHeightAsc(height uint64, count uint64, txns ...db.StoreTxn) ([]*types.PovHeader, error)
- func (l *Ledger) BatchGetPovHeadersByHeightDesc(height uint64, count uint64, txns ...db.StoreTxn) ([]*types.PovHeader, error)
- func (l *Ledger) BatchUpdate(fn func(txn db.StoreTxn) error) error
- func (l *Ledger) BatchView(fn func(txn db.StoreTxn) error) error
- func (l *Ledger) BatchWrite(fn func(batch db.StoreBatch) error) error
- func (l *Ledger) CalculateAmount(block *types.StateBlock, txns ...db.StoreTxn) (types.Balance, error)
- func (l *Ledger) CleanAllVoteHistory(txns ...db.StoreTxn) error
- func (l *Ledger) CleanBlockVoteHistory(hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) CleanSyncCache(txns ...db.StoreTxn)
- func (l *Ledger) Close() error
- func (l *Ledger) CountAccountMetas(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountBlockCache(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountFrontiers(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountGapPovBlocks(txns ...db.StoreTxn) uint64
- func (l *Ledger) CountGenericTypes(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountPeersInfo(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountPovBestHashs(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountPovBlocks(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountPovTxs(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountRepresentations(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountSmartContractBlocks(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountStateBlocks(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountUncheckedBlocks(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountUncheckedSyncBlocks(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) CountUnconfirmedSyncBlocks(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) DBStore() db.Store
- func (l *Ledger) DeleteAccountMeta(key types.Address, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteAccountMetaCache(key types.Address, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteBlockCache(key types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteFrontier(key types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteGapPovBlock(height uint64, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteGenericType(key types.GenericKey, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePending(key *types.PendingKey, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovBestHash(height uint64, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovBlock(blk *types.PovBlock, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovBody(height uint64, hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovDiffStat(dayIndex uint32, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovHeader(height uint64, hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovHeight(hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovMinerStat(dayIndex uint32, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovTD(hash types.Hash, height uint64, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovTxLookup(txHash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeletePovTxLookupInBatch(txHash types.Hash, batch db.StoreBatch) error
- func (l *Ledger) DeleteStateBlock(key types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteSyncCacheBlock(key types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteTokenMeta(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteTokenMetaCache(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteUncheckedBlock(key types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteUncheckedSyncBlock(hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DeleteUnconfirmedSyncBlock(hash types.Hash, txns ...db.StoreTxn) error
- func (l *Ledger) DropAllPovBlocks() error
- func (l *Ledger) Dump() (string, error)
- func (l *Ledger) Empty(txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) EventBus() event.EventBus
- func (l *Ledger) GC() 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) GetAccountMeta(key types.Address, txns ...db.StoreTxn) (*types.AccountMeta, error)
- func (l *Ledger) GetAccountMetaCache(key types.Address, txns ...db.StoreTxn) (*types.AccountMeta, error)
- func (l *Ledger) GetAccountMetaCaches(fn func(am *types.AccountMeta) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAccountMetaConfirmed(key types.Address, txns ...db.StoreTxn) (*types.AccountMeta, error)
- func (l *Ledger) GetAccountMetas(fn func(am *types.AccountMeta) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovBestBlocks(fn func(*types.PovBlock) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovBestHashes(fn func(height uint64, hash types.Hash) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovBestHeaders(fn func(header *types.PovHeader) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovBlocks(fn func(*types.PovBlock) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovDiffStats(fn func(*types.PovDiffDayStat) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovHeaders(fn func(header *types.PovHeader) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetAllPovMinerStats(fn func(*types.PovMinerDayStat) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetBlockCache(key types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) GetBlockCaches(fn func(*types.StateBlock) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetChild(key types.Hash, txns ...db.StoreTxn) (types.Hash, error)
- func (l *Ledger) GetFrontier(key types.Hash, txns ...db.StoreTxn) (*types.Frontier, error)
- func (l *Ledger) GetFrontiers(txns ...db.StoreTxn) ([]*types.Frontier, error)
- func (l *Ledger) GetGapPovBlock(height uint64, txns ...db.StoreTxn) (types.StateBlockList, []types.SynchronizedKind, error)
- func (l *Ledger) GetGenericType(key types.GenericKey, txns ...db.StoreTxn) (*types.GenericType, error)
- func (l *Ledger) GetGenericTypes(fn func(key types.GenericKey, value *types.GenericType) error, ...) error
- func (l *Ledger) GetGenesis(txns ...db.StoreTxn) ([]*types.StateBlock, error)
- func (l *Ledger) GetLatestPovBestHash(txns ...db.StoreTxn) (types.Hash, error)
- func (l *Ledger) GetLatestPovBlock(txns ...db.StoreTxn) (*types.PovBlock, error)
- func (l *Ledger) GetLatestPovDiffStat(txns ...db.StoreTxn) (*types.PovDiffDayStat, error)
- func (l *Ledger) GetLatestPovHeader(txns ...db.StoreTxn) (*types.PovHeader, error)
- func (l *Ledger) GetLatestPovMinerStat(txns ...db.StoreTxn) (*types.PovMinerDayStat, error)
- func (l *Ledger) GetLinkBlock(key types.Hash, txns ...db.StoreTxn) (types.Hash, error)
- func (l *Ledger) GetMessageInfo(key types.Hash, txns ...db.StoreTxn) ([]byte, error)
- func (l *Ledger) GetOnlineRepresentations(txns ...db.StoreTxn) ([]types.Address, error)
- func (l *Ledger) GetPeerInfo(peerID string, txns ...db.StoreTxn) (*types.PeerInfo, error)
- func (l *Ledger) GetPeersInfo(fn func(info *types.PeerInfo) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetPending(key *types.PendingKey, txns ...db.StoreTxn) (*types.PendingInfo, error)
- func (l *Ledger) GetPendings(fn func(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo) error, ...) error
- func (l *Ledger) GetPerformanceTime(key types.Hash, txns ...db.StoreTxn) (*types.PerformanceTime, error)
- func (l *Ledger) GetPovBestHash(height uint64, txns ...db.StoreTxn) (types.Hash, error)
- func (l *Ledger) GetPovBlockByHash(hash types.Hash, txns ...db.StoreTxn) (*types.PovBlock, error)
- func (l *Ledger) GetPovBlockByHeight(height uint64, txns ...db.StoreTxn) (*types.PovBlock, error)
- func (l *Ledger) GetPovBlockByHeightAndHash(height uint64, hash types.Hash, txns ...db.StoreTxn) (*types.PovBlock, error)
- func (l *Ledger) GetPovBody(height uint64, hash types.Hash, txns ...db.StoreTxn) (*types.PovBody, error)
- func (l *Ledger) GetPovDiffStat(dayIndex uint32, txns ...db.StoreTxn) (*types.PovDiffDayStat, error)
- func (l *Ledger) GetPovHeader(height uint64, hash types.Hash, txns ...db.StoreTxn) (*types.PovHeader, error)
- func (l *Ledger) GetPovHeaderByHash(hash types.Hash, txns ...db.StoreTxn) (*types.PovHeader, error)
- func (l *Ledger) GetPovHeaderByHeight(height uint64, txns ...db.StoreTxn) (*types.PovHeader, error)
- func (l *Ledger) GetPovHeight(hash types.Hash, txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) GetPovLatestHeight(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) GetPovMinerStat(dayIndex uint32, txns ...db.StoreTxn) (*types.PovMinerDayStat, error)
- func (l *Ledger) GetPovTD(hash types.Hash, height uint64, txns ...db.StoreTxn) (*types.PovTD, error)
- func (l *Ledger) GetPovTxLookup(txHash types.Hash, txns ...db.StoreTxn) (*types.PovTxLookup, error)
- func (l *Ledger) GetPovTxlScanCursor(txns ...db.StoreTxn) (uint64, error)
- func (l *Ledger) GetRandomStateBlock(txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) GetRepresentation(key types.Address, txns ...db.StoreTxn) (*types.Benefit, error)
- func (l *Ledger) GetRepresentations(fn func(types.Address, *types.Benefit) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetRepresentationsCache(address types.Address, ...) error
- func (l *Ledger) GetSmartContractBlock(key types.Hash, txns ...db.StoreTxn) (*types.SmartContractBlock, error)
- func (l *Ledger) GetSmartContractBlocks(fn func(block *types.SmartContractBlock) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetStateBlock(key types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) GetStateBlockConfirmed(key types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) GetStateBlocks(fn func(*types.StateBlock) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetSyncCacheBlock(hash types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) GetSyncCacheBlocks(fn func(*types.StateBlock) error, txns ...db.StoreTxn) error
- func (l *Ledger) GetTokenMeta(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) (*types.TokenMeta, error)
- func (l *Ledger) GetTokenMetaConfirmed(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) (*types.TokenMeta, error)
- func (l *Ledger) GetUncheckedBlock(key types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) (*types.StateBlock, types.SynchronizedKind, error)
- func (l *Ledger) GetUncheckedSyncBlock(hash types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) GetUnconfirmedSyncBlock(hash types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error)
- func (l *Ledger) HasAccountMeta(key types.Address, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasAccountMetaCache(key types.Address, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasBlockCache(key types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasGenericType(key types.GenericKey, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasPovBlock(height uint64, hash types.Hash, txns ...db.StoreTxn) bool
- func (l *Ledger) HasPovBody(height uint64, hash types.Hash, txns ...db.StoreTxn) bool
- func (l *Ledger) HasPovHeader(height uint64, hash types.Hash, txns ...db.StoreTxn) bool
- func (l *Ledger) HasPovHeight(hash types.Hash, txns ...db.StoreTxn) bool
- func (l *Ledger) HasPovMinerStat(dayIndex uint32, txns ...db.StoreTxn) bool
- func (l *Ledger) HasPovTxLookup(txHash types.Hash, txns ...db.StoreTxn) bool
- func (l *Ledger) HasSmartContractBlock(key types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasStateBlock(key types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasStateBlockConfirmed(key types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasTokenMeta(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasUncheckedBlock(key types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasUncheckedSyncBlock(hash types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasUnconfirmedSyncBlock(hash types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) HasVoteHistory(hash types.Hash, address types.Address, txns ...db.StoreTxn) bool
- func (l *Ledger) IsPerformanceTimeExist(key types.Hash, txns ...db.StoreTxn) (bool, error)
- func (l *Ledger) Latest(account types.Address, token types.Hash, txns ...db.StoreTxn) types.Hash
- func (l *Ledger) Pending(account types.Address, txns ...db.StoreTxn) ([]*types.PendingKey, error)
- func (l *Ledger) PendingAmount(address types.Address, token types.Hash, txns ...db.StoreTxn) (types.Balance, error)
- func (l *Ledger) PerformanceTimes(fn func(*types.PerformanceTime), txns ...db.StoreTxn) error
- func (l *Ledger) SearchAllKindPending(address types.Address, ...) error
- func (l *Ledger) SearchPending(address types.Address, ...) error
- func (l *Ledger) SetOnlineRepresentations(addresses []*types.Address, txns ...db.StoreTxn) error
- func (l *Ledger) SetPovLatestHeight(height uint64, txns ...db.StoreTxn) error
- func (l *Ledger) SetPovTxlScanCursor(height uint64, txns ...db.StoreTxn) error
- func (l *Ledger) Size() (int64, int64)
- func (l *Ledger) SubRepresentation(key types.Address, diff *types.Benefit, txns ...db.StoreTxn) error
- func (l *Ledger) Token(hash types.Hash, txns ...db.StoreTxn) (*types.TokenMeta, error)
- func (l *Ledger) TokenBalance(account types.Address, token types.Hash, txns ...db.StoreTxn) (types.Balance, error)
- func (l *Ledger) TokenPending(account types.Address, token types.Hash, txns ...db.StoreTxn) ([]*types.PendingKey, error)
- func (l *Ledger) TokenPendingInfo(account types.Address, token types.Hash, txns ...db.StoreTxn) ([]*types.PendingInfo, error)
- func (l *Ledger) UpdateAccountMeta(value *types.AccountMeta, txns ...db.StoreTxn) error
- func (l *Ledger) UpdateAccountMetaCache(value *types.AccountMeta, txns ...db.StoreTxn) error
- func (l *Ledger) UpdateGenericType(key types.GenericKey, value *types.GenericType, txns ...db.StoreTxn) error
- func (l *Ledger) UpdatePeerInfo(value *types.PeerInfo, txns ...db.StoreTxn) error
- func (l *Ledger) UpdatePending(key *types.PendingKey, kind types.PendingKind, txns ...db.StoreTxn) error
- func (l *Ledger) UpdateTokenMeta(address types.Address, meta *types.TokenMeta, txns ...db.StoreTxn) error
- func (l *Ledger) WalkGapPovBlocks(visit types.GapPovBlockWalkFunc, txns ...db.StoreTxn) error
- func (l *Ledger) WalkSyncCache(visit common.SyncCacheWalkFunc, txns ...db.StoreTxn)
- func (l *Ledger) WalkUncheckedBlocks(visit types.UncheckedBlockWalkFunc, txns ...db.StoreTxn) error
- func (l *Ledger) Weight(account types.Address, txns ...db.StoreTxn) types.Balance
- type LedgerCache
- type MigrationV1ToV2
- type MigrationV1ToV7
- type MigrationV2ToV3
- type MigrationV3ToV4
- type MigrationV4ToV5
- type MigrationV5ToV6
- type MigrationV7ToV8
- type MigrationV8ToV9
- type MigrationV9ToV10
- type RepresentationCache
- type RepresentationCacheType
- type Store
Constants ¶
This section is empty.
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 ( 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") )
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)。 }
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 int64 `msg:"blockHeight" json:"blockHeight"` InChain int `msg:"inChain" json:"inChain"` Reason string `msg:"reason" json:"reason"` }
type Cache ¶ added in v1.3.0
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) AddAccountPending ¶ added in v1.3.0
func (*Cache) DeleteAccountMetaConfirmed ¶ added in v1.3.0
func (*Cache) DeleteAccountMetaUnConfirmed ¶ added in v1.3.0
func (*Cache) DeleteAccountPending ¶ added in v1.3.0
func (*Cache) DeleteBlockConfirmed ¶ added in v1.3.0
func (*Cache) DeleteBlockUnConfirmed ¶ added in v1.3.0
func (*Cache) GetAccountMetaConfirmed ¶ added in v1.3.0
func (*Cache) GetAccountMetaUnConfirmed ¶ added in v1.3.0
func (*Cache) GetAccountPending ¶ added in v1.3.0
func (*Cache) GetBlockConfirmed ¶ added in v1.3.0
func (*Cache) GetBlockUnConfirmed ¶ added in v1.3.0
func (*Cache) UpdateAccountMetaConfirmed ¶ added in v1.3.0
func (c *Cache) UpdateAccountMetaConfirmed(am *types.AccountMeta) error
func (*Cache) UpdateAccountMetaUnConfirmed ¶ added in v1.3.0
func (c *Cache) UpdateAccountMetaUnConfirmed(am *types.AccountMeta) error
func (*Cache) UpdateAccountPending ¶ added in v1.3.0
func (c *Cache) UpdateAccountPending(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo, add bool) error
func (*Cache) UpdateBlockConfirmed ¶ added in v1.3.0
func (c *Cache) UpdateBlockConfirmed(block *types.StateBlock) error
func (*Cache) UpdateBlockUnConfirmed ¶ added in v1.3.0
func (c *Cache) UpdateBlockUnConfirmed(block *types.StateBlock) error
type Ledger ¶
type Ledger struct { io.Closer Store db.Store RollbackChan chan types.Hash EB event.EventBus // contains filtered or unexported fields }
func NewTestLedger ¶ added in v1.3.0
func NewTestLedger() (func(), *Ledger)
func (*Ledger) AddAccountMeta ¶
func (*Ledger) AddAccountMetaCache ¶ added in v1.2.3
func (*Ledger) AddBlockCache ¶ added in v1.2.3
func (*Ledger) AddFrontier ¶
func (*Ledger) AddGapPovBlock ¶ added in v1.3.0
func (l *Ledger) AddGapPovBlock(height uint64, block *types.StateBlock, sync types.SynchronizedKind, txns ...db.StoreTxn) error
func (*Ledger) AddGenericType ¶ added in v1.3.0
func (l *Ledger) AddGenericType(key types.GenericKey, value *types.GenericType, txns ...db.StoreTxn) error
func (*Ledger) AddMessageInfo ¶ added in v0.0.9
func (*Ledger) AddOrUpdateAccountMeta ¶
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, txns ...db.StoreTxn) error
func (*Ledger) AddOrUpdatePeerInfo ¶ added in v1.3.1
func (*Ledger) AddOrUpdatePerformance ¶ added in v0.0.5
func (*Ledger) AddOrUpdateTokenMeta ¶
func (*Ledger) AddPeerInfo ¶ added in v1.3.1
func (*Ledger) AddPending ¶
func (l *Ledger) AddPending(key *types.PendingKey, value *types.PendingInfo, txns ...db.StoreTxn) 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 (*Ledger) AddPovHeader ¶ added in v1.2.3
func (*Ledger) AddPovHeight ¶ added in v1.2.3
func (*Ledger) AddPovMinerStat ¶ added in v1.2.3
func (*Ledger) AddPovTxLookup ¶ added in v1.2.3
func (*Ledger) AddPovTxLookupInBatch ¶ added in v1.3.0
func (l *Ledger) AddPovTxLookupInBatch(txHash types.Hash, txLookup *types.PovTxLookup, batch db.StoreBatch) error
func (*Ledger) AddRepresentation ¶
func (*Ledger) AddSmartContractBlock ¶ added in v0.0.9
func (*Ledger) AddStateBlock ¶ added in v0.0.9
func (*Ledger) AddSyncCacheBlock ¶ added in v1.3.0
func (*Ledger) AddSyncStateBlock ¶ added in v1.3.0
func (*Ledger) AddTokenMeta ¶
func (*Ledger) AddUncheckedBlock ¶
func (l *Ledger) AddUncheckedBlock(key types.Hash, value *types.StateBlock, kind types.UncheckedKind, sync types.SynchronizedKind, txns ...db.StoreTxn) 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) BatchUpdate ¶
BatchUpdate MUST pass the same txn
func (*Ledger) BatchWrite ¶ added in v1.3.0
func (l *Ledger) BatchWrite(fn func(batch db.StoreBatch) error) error
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 (*Ledger) CountAccountMetas ¶ added in v0.0.5
func (*Ledger) CountBlockCache ¶ added in v1.2.3
func (*Ledger) CountFrontiers ¶
func (*Ledger) CountGapPovBlocks ¶ added in v1.3.0
func (*Ledger) CountGenericTypes ¶ added in v1.3.0
func (*Ledger) CountPeersInfo ¶ added in v1.3.1
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) CountUncheckedSyncBlocks ¶ added in v1.3.0
func (*Ledger) CountUnconfirmedSyncBlocks ¶ added in v1.3.0
func (*Ledger) DeleteAccountMeta ¶
func (*Ledger) DeleteAccountMetaCache ¶ added in v1.2.3
func (*Ledger) DeleteBlockCache ¶ added in v1.2.3
func (*Ledger) DeleteFrontier ¶
func (*Ledger) DeleteGapPovBlock ¶ added in v1.3.0
func (*Ledger) DeleteGenericType ¶ added in v1.3.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) DeleteSyncCacheBlock ¶ added in v1.3.0
func (*Ledger) DeleteTokenMeta ¶
func (*Ledger) DeleteTokenMetaCache ¶ added in v1.2.4
func (*Ledger) DeleteUncheckedBlock ¶
func (*Ledger) DeleteUncheckedSyncBlock ¶ added in v1.3.0
func (*Ledger) DeleteUnconfirmedSyncBlock ¶ added in v1.3.0
func (*Ledger) DropAllPovBlocks ¶ added in v1.2.3
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) GetAccountMetaCache ¶ added in v1.2.3
func (*Ledger) GetAccountMetaCaches ¶ added in v1.3.0
func (*Ledger) GetAccountMetaConfirmed ¶ added in v1.2.3
func (*Ledger) GetAccountMetas ¶ added in v0.0.5
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 (*Ledger) GetAllPovHeaders ¶ added in v1.2.3
func (*Ledger) GetAllPovMinerStats ¶ added in v1.2.3
func (*Ledger) GetBlockCache ¶ added in v1.2.3
func (*Ledger) GetBlockCaches ¶ added in v1.2.3
func (*Ledger) GetFrontier ¶
func (*Ledger) GetFrontiers ¶
func (*Ledger) GetGapPovBlock ¶ added in v1.3.0
func (l *Ledger) GetGapPovBlock(height uint64, txns ...db.StoreTxn) (types.StateBlockList, []types.SynchronizedKind, error)
func (*Ledger) GetGenericType ¶ added in v1.3.0
func (l *Ledger) GetGenericType(key types.GenericKey, txns ...db.StoreTxn) (*types.GenericType, error)
func (*Ledger) GetGenericTypes ¶ added in v1.3.0
func (l *Ledger) GetGenericTypes(fn func(key types.GenericKey, value *types.GenericType) error, txns ...db.StoreTxn) error
func (*Ledger) GetGenesis ¶ added in v0.0.9
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 (*Ledger) GetLatestPovHeader ¶ added in v1.2.3
func (*Ledger) GetLatestPovMinerStat ¶ added in v1.2.3
func (*Ledger) GetLinkBlock ¶ added in v1.2.3
func (*Ledger) GetMessageInfo ¶ added in v0.0.9
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(key *types.PendingKey, txns ...db.StoreTxn) (*types.PendingInfo, error)
func (*Ledger) GetPendings ¶ added in v1.1.0
func (l *Ledger) GetPendings(fn func(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo) error, txns ...db.StoreTxn) error
func (*Ledger) GetPerformanceTime ¶ added in v0.0.5
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 (*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 (*Ledger) GetRepresentation ¶
func (*Ledger) GetRepresentations ¶ added in v0.0.5
func (*Ledger) GetRepresentationsCache ¶ added in v1.2.3
func (*Ledger) GetSmartContractBlock ¶ added in v0.0.9
func (*Ledger) GetSmartContractBlocks ¶ added in v0.0.9
func (*Ledger) GetStateBlock ¶ added in v0.0.2
func (*Ledger) GetStateBlockConfirmed ¶ added in v1.2.3
func (*Ledger) GetStateBlocks ¶ added in v0.0.2
func (*Ledger) GetSyncCacheBlock ¶ added in v1.3.0
func (*Ledger) GetSyncCacheBlocks ¶ added in v1.3.0
func (*Ledger) GetTokenMeta ¶
func (*Ledger) GetTokenMetaConfirmed ¶ added in v1.2.3
func (*Ledger) GetUncheckedBlock ¶
func (l *Ledger) GetUncheckedBlock(key types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) (*types.StateBlock, types.SynchronizedKind, error)
func (*Ledger) GetUncheckedSyncBlock ¶ added in v1.3.0
func (*Ledger) GetUnconfirmedSyncBlock ¶ added in v1.3.0
func (*Ledger) HasAccountMeta ¶
func (*Ledger) HasAccountMetaCache ¶ added in v1.2.3
func (*Ledger) HasBlockCache ¶ added in v1.2.3
func (*Ledger) HasGenericType ¶ added in v1.3.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) HasPovHeight ¶ 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) IsPerformanceTimeExist ¶ added in v0.0.5
func (*Ledger) PendingAmount ¶ added in v1.3.0
func (*Ledger) PerformanceTimes ¶ added in v0.0.5
func (*Ledger) SearchAllKindPending ¶ added in v1.3.0
func (l *Ledger) SearchAllKindPending(address types.Address, fn func(key *types.PendingKey, value *types.PendingInfo, kind types.PendingKind) error, txns ...db.StoreTxn) error
func (*Ledger) SearchPending ¶ added in v0.0.9
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) SubRepresentation ¶
func (*Ledger) TokenBalance ¶
func (*Ledger) TokenPending ¶
func (*Ledger) TokenPendingInfo ¶ added in v0.0.2
func (*Ledger) UpdateAccountMeta ¶
func (*Ledger) UpdateAccountMetaCache ¶ added in v1.2.3
func (*Ledger) UpdateGenericType ¶ added in v1.3.0
func (l *Ledger) UpdateGenericType(key types.GenericKey, value *types.GenericType, txns ...db.StoreTxn) error
func (*Ledger) UpdatePeerInfo ¶ added in v1.3.1
func (*Ledger) UpdatePending ¶ added in v1.2.7
func (l *Ledger) UpdatePending(key *types.PendingKey, kind types.PendingKind, txns ...db.StoreTxn) error
func (*Ledger) UpdateTokenMeta ¶
func (*Ledger) WalkGapPovBlocks ¶ added in v1.3.0
func (*Ledger) WalkSyncCache ¶ added in v1.3.0
func (l *Ledger) WalkSyncCache(visit common.SyncCacheWalkFunc, txns ...db.StoreTxn)
func (*Ledger) WalkUncheckedBlocks ¶
type LedgerCache ¶ added in v1.3.0
type LedgerCache interface {
// contains filtered or unexported methods
}
type MigrationV1ToV2 ¶ added in v1.0.4
type MigrationV1ToV2 struct { }
func (MigrationV1ToV2) EndVersion ¶ added in v1.0.4
func (m MigrationV1ToV2) EndVersion() int
func (MigrationV1ToV2) Migrate ¶ added in v1.0.4
func (m MigrationV1ToV2) Migrate(txn db.StoreTxn) error
func (MigrationV1ToV2) StartVersion ¶ added in v1.0.4
func (m MigrationV1ToV2) StartVersion() int
type MigrationV1ToV7 ¶ added in v1.2.5
type MigrationV1ToV7 struct { }
func (MigrationV1ToV7) EndVersion ¶ added in v1.2.5
func (m MigrationV1ToV7) EndVersion() int
func (MigrationV1ToV7) Migrate ¶ added in v1.2.5
func (m MigrationV1ToV7) Migrate(txn db.StoreTxn) error
func (MigrationV1ToV7) StartVersion ¶ added in v1.2.5
func (m MigrationV1ToV7) StartVersion() int
type MigrationV2ToV3 ¶ added in v1.0.4
type MigrationV2ToV3 struct { }
func (MigrationV2ToV3) EndVersion ¶ added in v1.0.4
func (m MigrationV2ToV3) EndVersion() int
func (MigrationV2ToV3) Migrate ¶ added in v1.0.4
func (m MigrationV2ToV3) Migrate(txn db.StoreTxn) error
func (MigrationV2ToV3) StartVersion ¶ added in v1.0.4
func (m MigrationV2ToV3) StartVersion() int
type MigrationV3ToV4 ¶ added in v1.1.0
type MigrationV3ToV4 struct { }
func (MigrationV3ToV4) EndVersion ¶ added in v1.1.0
func (m MigrationV3ToV4) EndVersion() int
func (MigrationV3ToV4) Migrate ¶ added in v1.1.0
func (m MigrationV3ToV4) Migrate(txn db.StoreTxn) error
func (MigrationV3ToV4) StartVersion ¶ added in v1.1.0
func (m MigrationV3ToV4) StartVersion() int
type MigrationV4ToV5 ¶ added in v1.1.1
type MigrationV4ToV5 struct { }
func (MigrationV4ToV5) EndVersion ¶ added in v1.1.1
func (m MigrationV4ToV5) EndVersion() int
func (MigrationV4ToV5) Migrate ¶ added in v1.1.1
func (m MigrationV4ToV5) Migrate(txn db.StoreTxn) error
func (MigrationV4ToV5) StartVersion ¶ added in v1.1.1
func (m MigrationV4ToV5) StartVersion() int
type MigrationV5ToV6 ¶ added in v1.2.3
type MigrationV5ToV6 struct { }
func (MigrationV5ToV6) EndVersion ¶ added in v1.2.3
func (m MigrationV5ToV6) EndVersion() int
func (MigrationV5ToV6) Migrate ¶ added in v1.2.3
func (m MigrationV5ToV6) Migrate(txn db.StoreTxn) error
func (MigrationV5ToV6) StartVersion ¶ added in v1.2.3
func (m MigrationV5ToV6) StartVersion() int
type MigrationV7ToV8 ¶ added in v1.2.7
type MigrationV7ToV8 struct { }
func (MigrationV7ToV8) EndVersion ¶ added in v1.2.7
func (m MigrationV7ToV8) EndVersion() int
func (MigrationV7ToV8) Migrate ¶ added in v1.2.7
func (m MigrationV7ToV8) Migrate(txn db.StoreTxn) error
func (MigrationV7ToV8) StartVersion ¶ added in v1.2.7
func (m MigrationV7ToV8) StartVersion() int
type MigrationV8ToV9 ¶ added in v1.3.0
type MigrationV8ToV9 struct { }
func (MigrationV8ToV9) EndVersion ¶ added in v1.3.0
func (m MigrationV8ToV9) EndVersion() int
func (MigrationV8ToV9) Migrate ¶ added in v1.3.0
func (m MigrationV8ToV9) Migrate(txn db.StoreTxn) error
func (MigrationV8ToV9) StartVersion ¶ added in v1.3.0
func (m MigrationV8ToV9) StartVersion() int
type MigrationV9ToV10 ¶ added in v1.3.0
type MigrationV9ToV10 struct { }
func (MigrationV9ToV10) EndVersion ¶ added in v1.3.0
func (m MigrationV9ToV10) EndVersion() int
func (MigrationV9ToV10) Migrate ¶ added in v1.3.0
func (m MigrationV9ToV10) Migrate(txn db.StoreTxn) error
func (MigrationV9ToV10) StartVersion ¶ added in v1.3.0
func (m MigrationV9ToV10) StartVersion() int
type RepresentationCache ¶ added in v1.3.0
type RepresentationCache struct {
// contains filtered or unexported fields
}
func NewRepresentationCache ¶ added in v1.3.0
func NewRepresentationCache() *RepresentationCache
type RepresentationCacheType ¶ added in v1.3.0
type RepresentationCacheType struct {
// contains filtered or unexported fields
}
type Store ¶
type Store interface { Empty(txns ...db.StoreTxn) (bool, error) BatchUpdate(fn func(txn db.StoreTxn) error) error BatchView(fn func(txn db.StoreTxn) error) error BatchWrite(fn func(batch db.StoreBatch) error) error DBStore() db.Store EventBus() event.EventBus // account meta CURD AddAccountMeta(meta *types.AccountMeta, txns ...db.StoreTxn) error GetAccountMeta(address types.Address, txns ...db.StoreTxn) (*types.AccountMeta, error) GetAccountMetas(fn func(am *types.AccountMeta) error, txns ...db.StoreTxn) error CountAccountMetas(txns ...db.StoreTxn) (uint64, error) UpdateAccountMeta(meta *types.AccountMeta, txns ...db.StoreTxn) error DeleteAccountMeta(address types.Address, txns ...db.StoreTxn) error HasAccountMeta(address types.Address, txns ...db.StoreTxn) (bool, error) // token meta CURD AddTokenMeta(address types.Address, meta *types.TokenMeta, txns ...db.StoreTxn) error GetTokenMeta(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) (*types.TokenMeta, error) UpdateTokenMeta(address types.Address, meta *types.TokenMeta, txns ...db.StoreTxn) error DeleteTokenMeta(address types.Address, tokenType types.Hash, txns ...db.StoreTxn) error // state block CURD AddStateBlock(blk *types.StateBlock, txns ...db.StoreTxn) error GetStateBlock(hash types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error) GetStateBlockConfirmed(key types.Hash, txns ...db.StoreTxn) (*types.StateBlock, error) GetStateBlocks(fn func(*types.StateBlock) error, txns ...db.StoreTxn) error DeleteStateBlock(hash types.Hash, txns ...db.StoreTxn) error HasStateBlock(hash types.Hash, txns ...db.StoreTxn) (bool, error) HasStateBlockConfirmed(key types.Hash, txns ...db.StoreTxn) (bool, error) CountStateBlocks(txns ...db.StoreTxn) (uint64, error) GetRandomStateBlock(txns ...db.StoreTxn) (*types.StateBlock, error) // smart contract block CURD AddSmartContractBlock(blk *types.SmartContractBlock, txns ...db.StoreTxn) error GetSmartContractBlock(hash types.Hash, txns ...db.StoreTxn) (*types.SmartContractBlock, error) HasSmartContractBlock(hash types.Hash, txns ...db.StoreTxn) (bool, error) GetSmartContractBlocks(fn func(block *types.SmartContractBlock) error, txns ...db.StoreTxn) error CountSmartContractBlocks(txns ...db.StoreTxn) (uint64, error) // representation CURD AddRepresentation(address types.Address, benefit *types.Benefit, txns ...db.StoreTxn) error SubRepresentation(address types.Address, benefit *types.Benefit, txns ...db.StoreTxn) error GetRepresentation(address types.Address, txns ...db.StoreTxn) (*types.Benefit, error) GetRepresentations(fn func(types.Address, *types.Benefit) error, txns ...db.StoreTxn) error GetOnlineRepresentations(txns ...db.StoreTxn) ([]types.Address, error) SetOnlineRepresentations(addresses []*types.Address, txns ...db.StoreTxn) error // unchecked CURD AddUncheckedBlock(parentHash types.Hash, blk *types.StateBlock, kind types.UncheckedKind, sync types.SynchronizedKind, txns ...db.StoreTxn) error GetUncheckedBlock(parentHash types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) (*types.StateBlock, types.SynchronizedKind, error) DeleteUncheckedBlock(parentHash types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) error HasUncheckedBlock(hash types.Hash, kind types.UncheckedKind, txns ...db.StoreTxn) (bool, error) WalkUncheckedBlocks(visit types.UncheckedBlockWalkFunc, txns ...db.StoreTxn) error CountUncheckedBlocks(txns ...db.StoreTxn) (uint64, error) // pending CURD AddPending(pendingKey *types.PendingKey, pending *types.PendingInfo, txns ...db.StoreTxn) error GetPending(pendingKey *types.PendingKey, txns ...db.StoreTxn) (*types.PendingInfo, error) GetPendings(fn func(pendingKey *types.PendingKey, pendingInfo *types.PendingInfo) error, txns ...db.StoreTxn) error DeletePending(pendingKey *types.PendingKey, txns ...db.StoreTxn) error SearchPending(address types.Address, fn func(key *types.PendingKey, value *types.PendingInfo) error, txns ...db.StoreTxn) error // frontier CURD AddFrontier(frontier *types.Frontier, txns ...db.StoreTxn) error GetFrontier(hash types.Hash, txns ...db.StoreTxn) (*types.Frontier, error) GetFrontiers(txns ...db.StoreTxn) ([]*types.Frontier, error) DeleteFrontier(hash types.Hash, txns ...db.StoreTxn) error CountFrontiers(txns ...db.StoreTxn) (uint64, error) // posterior GetChild(hash types.Hash, txns ...db.StoreTxn) (types.Hash, error) // performance AddOrUpdatePerformance(p *types.PerformanceTime, txns ...db.StoreTxn) error PerformanceTimes(fn func(*types.PerformanceTime), txns ...db.StoreTxn) error GetPerformanceTime(hash types.Hash, txns ...db.StoreTxn) (*types.PerformanceTime, error) IsPerformanceTimeExist(hash types.Hash, txns ...db.StoreTxn) (bool, error) GetLinkBlock(hash types.Hash, txns ...db.StoreTxn) (types.Hash, error) //Latest block hash by account and token type, if not exist, return zero hash Latest(account types.Address, token types.Hash, txns ...db.StoreTxn) types.Hash //Account get account meta by block hash Account(hash types.Hash, txns ...db.StoreTxn) (*types.AccountMeta, error) //Token get token meta by block hash Token(hash types.Hash, txns ...db.StoreTxn) (*types.TokenMeta, error) //Pending get account pending (token_hash->pending) Pending(account types.Address, txns ...db.StoreTxn) ([]*types.PendingKey, error) //Balance get account balance (token_hash->pending) Balance(account types.Address, txns ...db.StoreTxn) (map[types.Hash]types.Balance, error) //TokenPending get account token pending TokenPending(account types.Address, token types.Hash, txns ...db.StoreTxn) ([]*types.PendingKey, error) //TokenBalance get account token balance TokenBalance(account types.Address, token types.Hash, txns ...db.StoreTxn) (types.Balance, error) //Weight get vote weight for PoS Weight(account types.Address, txns ...db.StoreTxn) types.Balance //GenerateBlock 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) //Token //ListTokens(txns ...db.StoreTxn) ([]*types.TokenInfo, error) //GetTokenById(tokenId types.Hash, txns ...db.StoreTxn) (*types.TokenInfo, error) //GetTokenByName(tokenName string, txns ...db.StoreTxn) (*types.TokenInfo, error) GetGenesis(txns ...db.StoreTxn) ([]*types.StateBlock, error) //CalculateAmount calculate block amount by balance and check block type CalculateAmount(block *types.StateBlock, txns ...db.StoreTxn) (types.Balance, error) AddMessageInfo(mHash types.Hash, message []byte, txns ...db.StoreTxn) error GetMessageInfo(mHash types.Hash, txns ...db.StoreTxn) ([]byte, error) //POV blocks base CRUD AddPovBlock(blk *types.PovBlock, td *types.PovTD, txns ...db.StoreTxn) error DeletePovBlock(blk *types.PovBlock, txns ...db.StoreTxn) error AddPovHeader(header *types.PovHeader, txns ...db.StoreTxn) error DeletePovHeader(height uint64, hash types.Hash, txns ...db.StoreTxn) error GetPovHeader(height uint64, hash types.Hash, txns ...db.StoreTxn) (*types.PovHeader, error) HasPovHeader(height uint64, hash types.Hash, txns ...db.StoreTxn) bool AddPovBody(height uint64, hash types.Hash, body *types.PovBody, txns ...db.StoreTxn) error DeletePovBody(height uint64, hash types.Hash, txns ...db.StoreTxn) error GetPovBody(height uint64, hash types.Hash, txns ...db.StoreTxn) (*types.PovBody, error) HasPovBody(height uint64, hash types.Hash, txns ...db.StoreTxn) bool AddPovHeight(hash types.Hash, height uint64, txns ...db.StoreTxn) error DeletePovHeight(hash types.Hash, txns ...db.StoreTxn) error GetPovHeight(hash types.Hash, txns ...db.StoreTxn) (uint64, error) HasPovHeight(hash types.Hash, txns ...db.StoreTxn) bool AddPovTD(hash types.Hash, height uint64, td *types.PovTD, txns ...db.StoreTxn) error DeletePovTD(hash types.Hash, height uint64, txns ...db.StoreTxn) error GetPovTD(hash types.Hash, height uint64, txns ...db.StoreTxn) (*types.PovTD, error) AddPovTxLookup(txHash types.Hash, txLookup *types.PovTxLookup, txns ...db.StoreTxn) error DeletePovTxLookup(txHash types.Hash, txns ...db.StoreTxn) error GetPovTxLookup(txHash types.Hash, txns ...db.StoreTxn) (*types.PovTxLookup, error) HasPovTxLookup(txHash types.Hash, txns ...db.StoreTxn) bool AddPovTxLookupInBatch(txHash types.Hash, txLookup *types.PovTxLookup, batch db.StoreBatch) error DeletePovTxLookupInBatch(txHash types.Hash, batch db.StoreBatch) error SetPovTxlScanCursor(height uint64, txns ...db.StoreTxn) error GetPovTxlScanCursor(txns ...db.StoreTxn) (uint64, error) // POV best chain CURD AddPovBestHash(height uint64, hash types.Hash, txns ...db.StoreTxn) error DeletePovBestHash(height uint64, txns ...db.StoreTxn) error GetPovBestHash(height uint64, txns ...db.StoreTxn) (types.Hash, error) SetPovLatestHeight(height uint64, txns ...db.StoreTxn) error GetPovLatestHeight(txns ...db.StoreTxn) (uint64, error) AddPovMinerStat(dayStat *types.PovMinerDayStat, txns ...db.StoreTxn) error DeletePovMinerStat(dayIndex uint32, txns ...db.StoreTxn) error GetPovMinerStat(dayIndex uint32, txns ...db.StoreTxn) (*types.PovMinerDayStat, error) GetLatestPovMinerStat(txns ...db.StoreTxn) (*types.PovMinerDayStat, error) AddPovDiffStat(dayStat *types.PovDiffDayStat, txns ...db.StoreTxn) error DeletePovDiffStat(dayIndex uint32, txns ...db.StoreTxn) error GetPovDiffStat(dayIndex uint32, txns ...db.StoreTxn) (*types.PovDiffDayStat, error) GetLatestPovDiffStat(txns ...db.StoreTxn) (*types.PovDiffDayStat, error) GetAllPovDiffStats(fn func(*types.PovDiffDayStat) error, txns ...db.StoreTxn) error // POV blocks complex queries GetPovBlockByHeightAndHash(height uint64, hash types.Hash, txns ...db.StoreTxn) (*types.PovBlock, error) GetPovBlockByHeight(height uint64, txns ...db.StoreTxn) (*types.PovBlock, error) GetPovBlockByHash(hash types.Hash, txns ...db.StoreTxn) (*types.PovBlock, error) BatchGetPovHeadersByHeightAsc(height uint64, count uint64, txns ...db.StoreTxn) ([]*types.PovHeader, error) BatchGetPovHeadersByHeightDesc(height uint64, count uint64, txns ...db.StoreTxn) ([]*types.PovHeader, error) GetPovHeaderByHash(hash types.Hash, txns ...db.StoreTxn) (*types.PovHeader, error) GetPovHeaderByHeight(height uint64, txns ...db.StoreTxn) (*types.PovHeader, error) GetAllPovHeaders(fn func(header *types.PovHeader) error, txns ...db.StoreTxn) error GetAllPovBlocks(fn func(*types.PovBlock) error, txns ...db.StoreTxn) error GetAllPovBestHeaders(fn func(header *types.PovHeader) error, txns ...db.StoreTxn) error GetAllPovBestBlocks(fn func(*types.PovBlock) error, txns ...db.StoreTxn) error GetLatestPovHeader(txns ...db.StoreTxn) (*types.PovHeader, error) GetLatestPovBlock(txns ...db.StoreTxn) (*types.PovBlock, error) HasPovBlock(height uint64, hash types.Hash, txns ...db.StoreTxn) bool DropAllPovBlocks() error CountPovBlocks(txns ...db.StoreTxn) (uint64, error) CountPovTxs(txns ...db.StoreTxn) (uint64, error) CountPovBestHashs(txns ...db.StoreTxn) (uint64, error) AddPeerInfo(info *types.PeerInfo, txns ...db.StoreTxn) error GetPeerInfo(peerID string, txns ...db.StoreTxn) (*types.PeerInfo, error) GetPeersInfo(fn func(info *types.PeerInfo) error, txns ...db.StoreTxn) error CountPeersInfo(txns ...db.StoreTxn) (uint64, error) UpdatePeerInfo(value *types.PeerInfo, txns ...db.StoreTxn) error AddOrUpdatePeerInfo(value *types.PeerInfo, txns ...db.StoreTxn) error }
Source Files ¶
- ledger.go
- ledger_account.go
- ledger_account_cache.go
- ledger_block.go
- ledger_block_cache.go
- ledger_cache.go
- ledger_dump.go
- ledger_frontier.go
- ledger_generic.go
- ledger_migration.go
- ledger_peersInfo.go
- ledger_pending.go
- ledger_pending_cache.go
- ledger_performance.go
- ledger_pov.go
- ledger_represention.go
- ledger_sync.go
- ledger_uncheck.go
- ledger_vote_history.go
- ledgerstore.go
Click to show internal directories.
Click to hide internal directories.