access

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AddAccountBlocksEvent     = byte(1)
	DeleteAccountBlocksEvent  = byte(2)
	AddSnapshotBlocksEvent    = byte(3)
	DeleteSnapshotBlocksEvent = byte(4)
)

Functions

This section is empty.

Types

type Account

type Account struct {
	// contains filtered or unexported fields
}

func NewAccount

func NewAccount(db *leveldb.DB) *Account

func (*Account) GetAccountByAddress

func (accountAccess *Account) GetAccountByAddress(address *types.Address) (*ledger.Account, error)

func (*Account) GetAddressById

func (accountAccess *Account) GetAddressById(accountId uint64) (*types.Address, error)

func (*Account) GetLastAccountId

func (accountAccess *Account) GetLastAccountId() (uint64, error)

func (*Account) IsAccountExisted added in v1.3.0

func (accountAccess *Account) IsAccountExisted(address *types.Address) (bool, error)

func (*Account) WriteAccount

func (accountAccess *Account) WriteAccount(batch *leveldb.Batch, account *ledger.Account) error

func (*Account) WriteAccountIndex

func (accountAccess *Account) WriteAccountIndex(batch *leveldb.Batch, accountId uint64, accountAddress *types.Address)

type AccountChain

type AccountChain struct {
	// contains filtered or unexported fields
}

func NewAccountChain

func NewAccountChain(db *leveldb.DB) *AccountChain

func (*AccountChain) Delete

func (ac *AccountChain) Delete(batch *leveldb.Batch, deleteMap map[uint64]uint64) (map[uint64][]*ledger.AccountBlock, error)

func (*AccountChain) DeleteBeSnapshot

func (ac *AccountChain) DeleteBeSnapshot(batch *leveldb.Batch, blockHash *types.Hash)

func (*AccountChain) DeleteBlock

func (ac *AccountChain) DeleteBlock(batch *leveldb.Batch, accountId uint64, height uint64, hash *types.Hash)

func (*AccountChain) DeleteBlockMeta

func (ac *AccountChain) DeleteBlockMeta(batch *leveldb.Batch, hash *types.Hash)

func (*AccountChain) DeleteVmLogList

func (ac *AccountChain) DeleteVmLogList(batch *leveldb.Batch, logListHash *types.Hash)

func (*AccountChain) GetBeSnapshot

func (ac *AccountChain) GetBeSnapshot(blockHash *types.Hash) (uint64, error)

func (*AccountChain) GetBlock

func (ac *AccountChain) GetBlock(blockHash *types.Hash) (*ledger.AccountBlock, error)

func (*AccountChain) GetBlockByHeight

func (ac *AccountChain) GetBlockByHeight(accountId uint64, height uint64) (*ledger.AccountBlock, error)

func (*AccountChain) GetBlockListByAccountId

func (ac *AccountChain) GetBlockListByAccountId(accountId, startHeight, endHeight uint64, forward bool) ([]*ledger.AccountBlock, error)

func (*AccountChain) GetBlockMeta

func (ac *AccountChain) GetBlockMeta(blockHash *types.Hash) (*ledger.AccountBlockMeta, error)

func (*AccountChain) GetConfirmAccountBlock

func (ac *AccountChain) GetConfirmAccountBlock(snapshotHeight uint64, accountId uint64) (*ledger.AccountBlock, error)

TODO Add cache, call frequently.

func (*AccountChain) GetConfirmHeight

func (ac *AccountChain) GetConfirmHeight(accountBlockHash *types.Hash) (uint64, error)

func (*AccountChain) GetContractGid

func (ac *AccountChain) GetContractGid(accountId uint64) (*types.Gid, error)

func (*AccountChain) GetContractGidFromSendCreateBlock added in v1.2.0

func (ac *AccountChain) GetContractGidFromSendCreateBlock(fromBlock *ledger.AccountBlock) (*types.Gid, error)

func (*AccountChain) GetDeleteMapAndReopenList

func (ac *AccountChain) GetDeleteMapAndReopenList(planToDelete map[uint64]uint64, getAccountByAddress func(*types.Address) (*ledger.Account, error), needExtendDelete, needNoSnapshot bool) (map[uint64]uint64, []*ledger.HashHeight, error)

func (*AccountChain) GetFirstConfirmedBlockBeforeOrAtAbHeight

func (ac *AccountChain) GetFirstConfirmedBlockBeforeOrAtAbHeight(accountId, accountBlockHeight uint64) (*ledger.AccountBlock, error)

func (*AccountChain) GetHashByHeight

func (ac *AccountChain) GetHashByHeight(accountId uint64, height uint64) (*types.Hash, error)

func (*AccountChain) GetLatestBlock

func (ac *AccountChain) GetLatestBlock(accountId uint64) (*ledger.AccountBlock, error)

func (*AccountChain) GetPlanToDelete

func (ac *AccountChain) GetPlanToDelete(maxAccountId uint64, snapshotBlockHeight uint64) (map[uint64]uint64, error)

TODO: cache

func (*AccountChain) GetSendAndReceiveBlocks added in v1.3.2

func (ac *AccountChain) GetSendAndReceiveBlocks(accountId uint64, snapshotBlockHeight uint64) ([]*ledger.AccountBlock, []*ledger.AccountBlock, error)

func (*AccountChain) GetSendBlocks added in v1.3.2

func (ac *AccountChain) GetSendBlocks(accountId uint64, snapshotBlockHeight uint64) ([]*ledger.AccountBlock, error)

func (*AccountChain) GetUnConfirmAccountBlocks

func (ac *AccountChain) GetUnConfirmAccountBlocks(accountId uint64, beforeHeight uint64) ([]*ledger.AccountBlock, error)

func (*AccountChain) GetUnConfirmedSubLedger

func (ac *AccountChain) GetUnConfirmedSubLedger(maxAccountId uint64) (map[uint64][]*ledger.AccountBlock, error)

func (*AccountChain) GetUnConfirmedSubLedgerByAccounts added in v1.2.0

func (ac *AccountChain) GetUnConfirmedSubLedgerByAccounts(accountIds []uint64) (map[uint64][]*ledger.AccountBlock, error)

func (*AccountChain) GetVmLogList

func (ac *AccountChain) GetVmLogList(logListHash *types.Hash) (ledger.VmLogList, error)

func (*AccountChain) IsBlockExisted added in v1.2.0

func (ac *AccountChain) IsBlockExisted(hash types.Hash) (bool, error)

func (*AccountChain) ReopenSendBlocks

func (ac *AccountChain) ReopenSendBlocks(batch *leveldb.Batch, reopenList []*ledger.HashHeight, deletedMap map[uint64]uint64) error

func (*AccountChain) WriteBeSnapshot

func (ac *AccountChain) WriteBeSnapshot(batch *leveldb.Batch, blockHash *types.Hash, snapshotBlockHeight uint64) error

func (*AccountChain) WriteBlock

func (ac *AccountChain) WriteBlock(batch *leveldb.Batch, accountId uint64, block *ledger.AccountBlock) error

func (*AccountChain) WriteBlockMeta

func (ac *AccountChain) WriteBlockMeta(batch *leveldb.Batch, blockHash *types.Hash, blockMeta *ledger.AccountBlockMeta) error

func (*AccountChain) WriteVmLogList

func (ac *AccountChain) WriteVmLogList(batch *leveldb.Batch, logList ledger.VmLogList) error

type BlockEvent

type BlockEvent struct {
	// contains filtered or unexported fields
}

func NewBlockEvent

func NewBlockEvent(db *leveldb.DB) *BlockEvent

func (*BlockEvent) AddAccountBlocks

func (be *BlockEvent) AddAccountBlocks(batch *leveldb.Batch, blockHashList []types.Hash)

func (*BlockEvent) AddSnapshotBlocks

func (be *BlockEvent) AddSnapshotBlocks(batch *leveldb.Batch, blockHashList []types.Hash)

func (*BlockEvent) DeleteAccountBlocks

func (be *BlockEvent) DeleteAccountBlocks(batch *leveldb.Batch, blockHashList []types.Hash)

func (*BlockEvent) DeleteSnapshotBlocks

func (be *BlockEvent) DeleteSnapshotBlocks(batch *leveldb.Batch, blockHashList []types.Hash)

func (*BlockEvent) GetEvent

func (be *BlockEvent) GetEvent(eventId uint64) (byte, []types.Hash, error)

func (*BlockEvent) LatestEventId

func (be *BlockEvent) LatestEventId() (uint64, error)

type OnRoad

type OnRoad struct {
	// contains filtered or unexported fields
}

func NewOnRoad

func NewOnRoad(db *leveldb.DB) *OnRoad

func (*OnRoad) GetMeta

func (or *OnRoad) GetMeta(addr *types.Address, hash *types.Hash) ([]byte, error)

type SnapshotChain

type SnapshotChain struct {
	// contains filtered or unexported fields
}

func NewSnapshotChain

func NewSnapshotChain(db *leveldb.DB) *SnapshotChain

func (*SnapshotChain) DeleteToHeight

func (sc *SnapshotChain) DeleteToHeight(batch *leveldb.Batch, toHeight uint64) ([]*ledger.SnapshotBlock, error)

Delete list contains the to height

func (*SnapshotChain) GetLatestBlock

func (sc *SnapshotChain) GetLatestBlock() (*ledger.SnapshotBlock, error)

func (*SnapshotChain) GetSnapshotBlock

func (sc *SnapshotChain) GetSnapshotBlock(height uint64, containsSnapshotContent bool) (*ledger.SnapshotBlock, error)

func (*SnapshotChain) GetSnapshotBlockHeight

func (sc *SnapshotChain) GetSnapshotBlockHeight(snapshotHash *types.Hash) (uint64, error)

func (*SnapshotChain) GetSnapshotBlocks

func (sc *SnapshotChain) GetSnapshotBlocks(height uint64, count uint64, forward, containSnapshotContent bool) ([]*ledger.SnapshotBlock, error)

func (*SnapshotChain) GetSnapshotContent

func (sc *SnapshotChain) GetSnapshotContent(snapshotBlockHeight uint64) (ledger.SnapshotContent, error)

func (*SnapshotChain) WriteSnapshotBlock

func (sc *SnapshotChain) WriteSnapshotBlock(batch *leveldb.Batch, snapshotBlock *ledger.SnapshotBlock) error

func (*SnapshotChain) WriteSnapshotContent

func (sc *SnapshotChain) WriteSnapshotContent(batch *leveldb.Batch, snapshotHeight uint64, snapshotContent ledger.SnapshotContent) error

func (*SnapshotChain) WriteSnapshotHash

func (sc *SnapshotChain) WriteSnapshotHash(batch *leveldb.Batch, hash *types.Hash, height uint64)

Jump to

Keyboard shortcuts

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