model

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2018 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxReceiveErrCount = 3
)

Variables

This section is empty.

Functions

func AddrListDbDeserialize

func AddrListDbDeserialize(buf []byte) ([]types.Address, error)

func AddrListDbSerialize

func AddrListDbSerialize(addrList []types.Address) ([]byte, error)

Types

type OnroadAccountInfo

type OnroadAccountInfo struct {
	AccountAddress      *types.Address
	TotalNumber         uint64
	TokenBalanceInfoMap map[types.TokenTypeId]*TokenBalanceInfo
	// contains filtered or unexported fields
}

type OnroadBlocksPool

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

obtaining the account info from cache or db and manage the cache lifecycle

func NewOnroadBlocksPool

func NewOnroadBlocksPool(dbAccess *UAccess) *OnroadBlocksPool

func (*OnroadBlocksPool) AcquireFullOnroadBlocksCache

func (p *OnroadBlocksPool) AcquireFullOnroadBlocksCache(addr types.Address)

func (*OnroadBlocksPool) AddCommonTxLis

func (p *OnroadBlocksPool) AddCommonTxLis(addr types.Address, f func())

func (*OnroadBlocksPool) AddContractLis

func (p *OnroadBlocksPool) AddContractLis(gid types.Gid, f func(address types.Address))

func (*OnroadBlocksPool) Close

func (p *OnroadBlocksPool) Close() error

func (*OnroadBlocksPool) DeleteDirect

func (p *OnroadBlocksPool) DeleteDirect(sendBlock *ledger.AccountBlock) error

func (*OnroadBlocksPool) GetNextCommonTx

func (p *OnroadBlocksPool) GetNextCommonTx(addr types.Address) *ledger.AccountBlock

func (*OnroadBlocksPool) GetOnroadAccountInfo

func (p *OnroadBlocksPool) GetOnroadAccountInfo(addr types.Address) (*OnroadAccountInfo, error)

func (*OnroadBlocksPool) NewSignalToWorker

func (p *OnroadBlocksPool) NewSignalToWorker(block *ledger.AccountBlock)

func (*OnroadBlocksPool) ReleaseFullOnroadBlocksCache

func (p *OnroadBlocksPool) ReleaseFullOnroadBlocksCache(addr types.Address) error

func (*OnroadBlocksPool) RemoveCommonTxLis

func (p *OnroadBlocksPool) RemoveCommonTxLis(addr types.Address)

func (*OnroadBlocksPool) RemoveContractLis

func (p *OnroadBlocksPool) RemoveContractLis(gid types.Gid)

func (*OnroadBlocksPool) ResetCacheCursor

func (p *OnroadBlocksPool) ResetCacheCursor(addr types.Address)

func (*OnroadBlocksPool) RevertOnroad

func (p *OnroadBlocksPool) RevertOnroad(batch *leveldb.Batch, subLedger map[types.Address][]*ledger.AccountBlock) error

RevertOnroad means to revert according to bifurcation

func (*OnroadBlocksPool) RevertOnroadSuccess

func (p *OnroadBlocksPool) RevertOnroadSuccess(subLedger map[types.Address][]*ledger.AccountBlock)

func (*OnroadBlocksPool) WriteOnroad

func (p *OnroadBlocksPool) WriteOnroad(batch *leveldb.Batch, blockList []*vm_context.VmAccountBlock) error

func (*OnroadBlocksPool) WriteOnroadSuccess

func (p *OnroadBlocksPool) WriteOnroadSuccess(blocks []*vm_context.VmAccountBlock)

type OnroadMeta

type OnroadMeta struct {
	Gid     []byte
	Address types.Address
	Hash    types.Hash
}

type OnroadSet

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

func NewOnroadSet

func NewOnroadSet(chain chain.Chain) *OnroadSet

func (*OnroadSet) DecreaseReceiveErrCount

func (ucf *OnroadSet) DecreaseReceiveErrCount(batch *leveldb.Batch, hash *types.Hash, addr *types.Address) error

func (*OnroadSet) DeleteMeta

func (ucf *OnroadSet) DeleteMeta(batch *leveldb.Batch, addr *types.Address, hash *types.Hash) error

func (*OnroadSet) DeleteReceiveErrCount

func (ucf *OnroadSet) DeleteReceiveErrCount(batch *leveldb.Batch, hash *types.Hash, addr *types.Address) error

func (*OnroadSet) GetContractAddrList

func (ucf *OnroadSet) GetContractAddrList(gid *types.Gid) ([]types.Address, error)

func (*OnroadSet) GetCountByAddress

func (ucf *OnroadSet) GetCountByAddress(addr *types.Address) (count uint64, err error)

func (*OnroadSet) GetHashList

func (ucf *OnroadSet) GetHashList(addr *types.Address) (hashs []*types.Hash, err error)

func (*OnroadSet) GetHashsByCount

func (ucf *OnroadSet) GetHashsByCount(count uint64, addr *types.Address) (hashs []*types.Hash, err error)

func (*OnroadSet) GetReceiveErrCount

func (ucf *OnroadSet) GetReceiveErrCount(hash *types.Hash, addr *types.Address) (uint8, error)

func (*OnroadSet) IncreaseReceiveErrCount

func (ucf *OnroadSet) IncreaseReceiveErrCount(batch *leveldb.Batch, hash *types.Hash, addr *types.Address) error

func (*OnroadSet) WriteGidAddrList

func (ucf *OnroadSet) WriteGidAddrList(batch *leveldb.Batch, gid *types.Gid, addrList []types.Address) error

func (*OnroadSet) WriteMeta

func (ucf *OnroadSet) WriteMeta(batch *leveldb.Batch, addr *types.Address, hash *types.Hash) error

type TokenBalanceInfo

type TokenBalanceInfo struct {
	TotalAmount big.Int
	Number      uint64
}

type UAccess

type UAccess struct {
	Chain chain.Chain
	// contains filtered or unexported fields
}

func NewUAccess

func NewUAccess() *UAccess

func (*UAccess) DeleteContractAddrFromGid

func (access *UAccess) DeleteContractAddrFromGid(batch *leveldb.Batch, gid types.Gid, address types.Address) error

func (*UAccess) GetAllOnroadBlocks

func (access *UAccess) GetAllOnroadBlocks(addr types.Address) (blockList []*ledger.AccountBlock, err error)

func (*UAccess) GetCommonAccInfo

func (access *UAccess) GetCommonAccInfo(addr *types.Address) (info *OnroadAccountInfo, err error)

func (*UAccess) GetCommonAccTokenInfoMap

func (access *UAccess) GetCommonAccTokenInfoMap(addr *types.Address) (map[types.TokenTypeId]*TokenBalanceInfo, uint64, error)

func (*UAccess) GetContractAddrListByGid

func (access *UAccess) GetContractAddrListByGid(gid *types.Gid) ([]types.Address, error)

func (*UAccess) GetOnroadBlocks

func (access *UAccess) GetOnroadBlocks(index, num, count uint64, addr *types.Address) (blockList []*ledger.AccountBlock, err error)

func (*UAccess) GetOnroadHashs

func (access *UAccess) GetOnroadHashs(index, num, count uint64, addr *types.Address) ([]*types.Hash, error)

func (*UAccess) Init

func (access *UAccess) Init(chain chain.Chain)

func (*UAccess) IsSuccessReceived

func (access *UAccess) IsSuccessReceived(addr *types.Address, hash *types.Hash) bool

func (*UAccess) WriteContractAddrToGid

func (access *UAccess) WriteContractAddrToGid(batch *leveldb.Batch, gid types.Gid, address types.Address) error

Jump to

Keyboard shortcuts

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