pool

package
v0.0.3-tmp Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: GPL-3.0 Imports: 21 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BCPool

type BCPool struct {
	Id string

	LIMIT_HEIGHT      uint64
	LIMIT_LONGEST_NUM uint64
	// contains filtered or unexported fields
}

func (*BCPool) AddBlock

func (self *BCPool) AddBlock(block commonBlock)

func (*BCPool) CurrentChain

func (self *BCPool) CurrentChain() Chain

func (*BCPool) CurrentModifyToChain

func (self *BCPool) CurrentModifyToChain(target Chain) error

func (*BCPool) CurrentModifyToEmpty

func (self *BCPool) CurrentModifyToEmpty() error

func (*BCPool) LongestChain

func (self *BCPool) LongestChain() Chain

type BlockPool

type BlockPool interface {
	PoolWriter
	PoolReader
	SnapshotProducerWriter
	Start()
	Stop()
	Init(s syncer,
		wt *wallet.Manager,
		snapshotV *verifier.SnapshotVerifier,
		accountV *verifier.AccountVerifier)
	Info(addr *types.Address) string
}

func NewPool

func NewPool(bc ch.Chain) BlockPool

type ByHeight

type ByHeight []commonBlock

func (ByHeight) Len

func (a ByHeight) Len() int

func (ByHeight) Less

func (a ByHeight) Less(i, j int) bool

func (ByHeight) Swap

func (a ByHeight) Swap(i, j int)

type ByTailHeight

type ByTailHeight []*snippetChain

func (ByTailHeight) Len

func (a ByTailHeight) Len() int

func (ByTailHeight) Less

func (a ByTailHeight) Less(i, j int) bool

func (ByTailHeight) Swap

func (a ByTailHeight) Swap(i, j int)

type Chain

type Chain interface {
	HeadHeight() uint64
	ChainId() string
	Head() commonBlock
	GetBlock(height uint64) commonBlock
}

type ChainReader

type ChainReader interface {
	Head() commonBlock
	GetBlock(height uint64) commonBlock
}

type ForkChainError

type ForkChainError struct {
	What string
}

func (ForkChainError) Error

func (e ForkChainError) Error() string

type ForkVersion

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

func (*ForkVersion) Inc

func (self *ForkVersion) Inc()

func (*ForkVersion) String

func (self *ForkVersion) String() string

func (*ForkVersion) Val

func (self *ForkVersion) Val() int

type MockSyncer

type MockSyncer struct {
}

func (*MockSyncer) BroadcastAccountBlock

func (*MockSyncer) BroadcastAccountBlock(addr types.Address, block *ledger.AccountBlock)

func (*MockSyncer) BroadcastAccountBlocks

func (*MockSyncer) BroadcastAccountBlocks(addr types.Address, blocks []*ledger.AccountBlock)

func (*MockSyncer) BroadcastSnapshotBlock

func (*MockSyncer) BroadcastSnapshotBlock(block *ledger.SnapshotBlock)

func (*MockSyncer) FetchAccountBlocks

func (*MockSyncer) FetchAccountBlocks(start types.Hash, count uint64, address *types.Address)

func (*MockSyncer) FetchSnapshotBlocks

func (*MockSyncer) FetchSnapshotBlocks(start types.Hash, count uint64)

func (*MockSyncer) SubscribeAccountBlock

func (*MockSyncer) SubscribeAccountBlock(fn net.AccountblockCallback) (subId int)

func (*MockSyncer) SubscribeSnapshotBlock

func (*MockSyncer) SubscribeSnapshotBlock(fn net.SnapshotBlockCallback) (subId int)

func (*MockSyncer) SubscribeSyncStatus

func (*MockSyncer) SubscribeSyncStatus(fn net.SyncStateCallback) (subId int)

func (*MockSyncer) UnsubscribeAccountBlock

func (*MockSyncer) UnsubscribeAccountBlock(subId int)

func (*MockSyncer) UnsubscribeSnapshotBlock

func (*MockSyncer) UnsubscribeSnapshotBlock(subId int)

func (*MockSyncer) UnsubscribeSyncStatus

func (*MockSyncer) UnsubscribeSyncStatus(subId int)

type PoolReader

type PoolReader interface {
	// received block in current? (key is requestHash)
	ExistInPool(address types.Address, requestHash types.Hash) bool
}

type PoolWriter

type PoolWriter interface {
	// for normal account
	AddDirectAccountBlock(address types.Address, vmAccountBlock *vm_context.VmAccountBlock) error

	// for contract account
	AddDirectAccountBlocks(address types.Address, received *vm_context.VmAccountBlock, sendBlocks []*vm_context.VmAccountBlock) error
}

type SnapshotProducerWriter

type SnapshotProducerWriter interface {
	Lock()

	UnLock()

	AddDirectSnapshotBlock(block *ledger.SnapshotBlock) error

	RollbackAccountTo(addr types.Address, hash types.Hash, height uint64) error
}

Jump to

Keyboard shortcuts

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