mock

package
v0.0.0-...-56f3d1a Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGenesisConsensusConf

func GetGenesisConsensusConf() []byte

func NewP2P

func NewP2P(node string) (p2p.Server, *nctx.NetCtx, error)

func NewXContent

func NewXContent() *xctx.BaseCtx

Types

type FReaderItem

type FReaderItem struct {
	Bucket string
	Key    []byte
	Value  []byte
}

type FakeBlock

type FakeBlock struct {
	Proposer         string
	Height           int64
	Blockid          []byte
	ConsensusStorage []byte
	Timestamp        int64
	Nonce            int32
	PublicKey        string
	Sign             []byte
	PreHash          []byte
}

func NewBlock

func NewBlock(height int) *FakeBlock

func (*FakeBlock) GetBlockid

func (b *FakeBlock) GetBlockid() []byte

func (*FakeBlock) GetConsensusStorage

func (b *FakeBlock) GetConsensusStorage() ([]byte, error)

func (*FakeBlock) GetHeight

func (b *FakeBlock) GetHeight() int64

func (*FakeBlock) GetInTrunk

func (b *FakeBlock) GetInTrunk() bool

func (*FakeBlock) GetNextHash

func (b *FakeBlock) GetNextHash() []byte

func (*FakeBlock) GetPreHash

func (b *FakeBlock) GetPreHash() []byte

func (*FakeBlock) GetProposer

func (b *FakeBlock) GetProposer() []byte

func (*FakeBlock) GetPublicKey

func (b *FakeBlock) GetPublicKey() string

func (*FakeBlock) GetSign

func (b *FakeBlock) GetSign() []byte

func (*FakeBlock) GetTimestamp

func (b *FakeBlock) GetTimestamp() int64

func (*FakeBlock) GetTxIDs

func (b *FakeBlock) GetTxIDs() []string

func (*FakeBlock) MakeBlockId

func (b *FakeBlock) MakeBlockId() ([]byte, error)

func (*FakeBlock) SetItem

func (b *FakeBlock) SetItem(param string, value interface{}) error

func (*FakeBlock) SetProposer

func (b *FakeBlock) SetProposer(m string)

func (*FakeBlock) SetTimestamp

func (b *FakeBlock) SetTimestamp(t int64)

type FakeKContext

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

func NewFakeKContext

func NewFakeKContext(args map[string][]byte, m map[string]map[string][]byte) *FakeKContext

func (*FakeKContext) AddEvent

func (c *FakeKContext) AddEvent(events ...*protos.ContractEvent)

func (*FakeKContext) AddResourceUsed

func (c *FakeKContext) AddResourceUsed(delta contract.Limits)

func (*FakeKContext) Args

func (c *FakeKContext) Args() map[string][]byte

func (*FakeKContext) AuthRequire

func (c *FakeKContext) AuthRequire() []string

func (*FakeKContext) Call

func (c *FakeKContext) Call(module, contract, method string, args map[string][]byte) (*contract.Response, error)

func (*FakeKContext) Caller

func (c *FakeKContext) Caller() string

func (*FakeKContext) Del

func (c *FakeKContext) Del(bucket string, key []byte) error

func (*FakeKContext) EmitAsyncTask

func (c *FakeKContext) EmitAsyncTask(event string, args interface{}) error

func (*FakeKContext) Flush

func (c *FakeKContext) Flush() error

func (*FakeKContext) Get

func (c *FakeKContext) Get(bucket string, key []byte) ([]byte, error)

func (*FakeKContext) GetAccountAddresses

func (c *FakeKContext) GetAccountAddresses(accountName string) ([]string, error)

func (*FakeKContext) Initiator

func (c *FakeKContext) Initiator() string

func (*FakeKContext) Put

func (c *FakeKContext) Put(bucket string, key, value []byte) error

func (*FakeKContext) QueryBlock

func (c *FakeKContext) QueryBlock(blockid []byte) (*xldgpb.InternalBlock, error)

func (*FakeKContext) QueryTransaction

func (c *FakeKContext) QueryTransaction(txid []byte) (*pb.Transaction, error)

func (*FakeKContext) RWSet

func (c *FakeKContext) RWSet() *contract.RWSet

func (*FakeKContext) ResourceLimit

func (c *FakeKContext) ResourceLimit() contract.Limits

func (*FakeKContext) Select

func (c *FakeKContext) Select(bucket string, startKey []byte, endKey []byte) (contract.Iterator, error)

func (*FakeKContext) Transfer

func (c *FakeKContext) Transfer(from string, to string, amount *big.Int) error

func (*FakeKContext) UTXORWSet

func (c *FakeKContext) UTXORWSet() *contract.UTXORWSet

func (*FakeKContext) VerifyContractOwnerPermission

func (c *FakeKContext) VerifyContractOwnerPermission(contractName string, authRequire []string) error

func (*FakeKContext) VerifyContractPermission

func (c *FakeKContext) VerifyContractPermission(initiator string, authRequire []string, contractName string, methodName string) (bool, error)

type FakeLedger

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

func NewFakeLedger

func NewFakeLedger(conf []byte) *FakeLedger

func (*FakeLedger) CreateSnapshot

func (l *FakeLedger) CreateSnapshot(blkId []byte) (ledger.XMReader, error)

func (*FakeLedger) GetConsensusConf

func (l *FakeLedger) GetConsensusConf() ([]byte, error)

func (*FakeLedger) GetGenesisConsensusConf

func (l *FakeLedger) GetGenesisConsensusConf() []byte

func (*FakeLedger) GetTipBlock

func (l *FakeLedger) GetTipBlock() ledger.BlockHandle

func (*FakeLedger) GetTipSnapshot

func (l *FakeLedger) GetTipSnapshot() (ledger.XMReader, error)

func (*FakeLedger) GetTipXMSnapshotReader

func (l *FakeLedger) GetTipXMSnapshotReader() (ledger.XMSnapshotReader, error)

func (*FakeLedger) Put

func (l *FakeLedger) Put(block *FakeBlock) error

func (*FakeLedger) QueryBlockHeader

func (l *FakeLedger) QueryBlockHeader(blockId []byte) (ledger.BlockHandle, error)

func (*FakeLedger) QueryBlockHeaderByHeight

func (l *FakeLedger) QueryBlockHeaderByHeight(height int64) (ledger.BlockHandle, error)

func (*FakeLedger) QueryTipBlockHeader

func (l *FakeLedger) QueryTipBlockHeader() ledger.BlockHandle

func (*FakeLedger) SetConsensusStorage

func (l *FakeLedger) SetConsensusStorage(height int, s []byte)

func (*FakeLedger) SetSnapshot

func (l *FakeLedger) SetSnapshot(bucket string, key []byte, value []byte)

func (*FakeLedger) VerifyMerkle

func (l *FakeLedger) VerifyMerkle(context.BlockInterface) error

type FakeManager

type FakeManager struct {
	R *FakeRegistry
}

func (*FakeManager) GetKernRegistry

func (m *FakeManager) GetKernRegistry() contract.KernRegistry

func (*FakeManager) NewContext

func (m *FakeManager) NewContext(cfg *contract.ContextConfig) (contract.Context, error)

func (*FakeManager) NewStateSandbox

func (m *FakeManager) NewStateSandbox(cfg *contract.SandboxConfig) (contract.StateSandbox, error)

type FakeMeta

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

func (*FakeMeta) GetTipBlockid

func (m *FakeMeta) GetTipBlockid() []byte

func (*FakeMeta) GetTrunkHeight

func (m *FakeMeta) GetTrunkHeight() int64

type FakeP2p

type FakeP2p struct{}

func (*FakeP2p) GetCurrentPeerAddress

func (p *FakeP2p) GetCurrentPeerAddress() []string

func (*FakeP2p) GetLocalAccount

func (p *FakeP2p) GetLocalAccount() string

type FakeRegistry

type FakeRegistry struct {
	M map[string]contract.KernMethod
}

func (*FakeRegistry) GetKernMethod

func (r *FakeRegistry) GetKernMethod(contract, method string) (contract.KernMethod, error)

func (*FakeRegistry) RegisterKernMethod

func (r *FakeRegistry) RegisterKernMethod(contract, method string, handler contract.KernMethod)

func (*FakeRegistry) RegisterShortcut

func (r *FakeRegistry) RegisterShortcut(oldmethod, contract, method string)

func (*FakeRegistry) UnregisterKernMethod

func (r *FakeRegistry) UnregisterKernMethod(ctract, method string)

type FakeSandBox

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

func (*FakeSandBox) Get

func (s *FakeSandBox) Get(bucket string, key []byte) ([]byte, error)

func (*FakeSandBox) SetContext

func (s *FakeSandBox) SetContext(bucket string, key, value []byte)

type FakeXMReader

type FakeXMReader map[string]FReaderItem

func NewFakeXMReader

func NewFakeXMReader() FakeXMReader

func (FakeXMReader) Get

func (r FakeXMReader) Get(bucket string, key []byte) (*ledger.VersionedData, error)

func (*FakeXMReader) GetUncommited

func (r *FakeXMReader) GetUncommited(bucket string, key []byte) (*ledger.VersionedData, error)

func (*FakeXMReader) Select

func (r *FakeXMReader) Select(bucket string, startKey []byte, endKey []byte) (ledger.XMIterator, error)

Jump to

Keyboard shortcuts

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