shim

package
v0.0.0-...-95b87ed Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright IBM Corp. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	LogDebug    = LoggingLevel(logging.DEBUG)
	LogInfo     = LoggingLevel(logging.INFO)
	LogNotice   = LoggingLevel(logging.NOTICE)
	LogWarning  = LoggingLevel(logging.WARNING)
	LogError    = LoggingLevel(logging.ERROR)
	LogCritical = LoggingLevel(logging.CRITICAL)
)
View Source
const (
	STATE_QUERY_RESULT resultType = iota + 1
	HISTORY_QUERY_RESULT
)
View Source
const (
	LogDebug    = LoggingLevel(logging.DEBUG)
	LogInfo     = LoggingLevel(logging.INFO)
	LogNotice   = LoggingLevel(logging.NOTICE)
	LogWarning  = LoggingLevel(logging.WARNING)
	LogError    = LoggingLevel(logging.ERROR)
	LogCritical = LoggingLevel(logging.CRITICAL)
)
View Source
const (
	OK = 200

	ERRORTHRESHOLD = 400

	ERROR = 500
)
View Source
const (
	STATE_QUERY_RESULT resultType = iota + 1
	HISTORY_QUERY_RESULT
)

Variables

This section is empty.

Functions

func CreateCompositeKey

func CreateCompositeKey(objectType string, attributes []string) (string, error)

func Error

func Error(msg string) pb.Response

func IsEnabledForLogLevel

func IsEnabledForLogLevel(logLevel string) bool

func SetLoggingLevel

func SetLoggingLevel(level LoggingLevel)

func SetupChaincodeLogging

func SetupChaincodeLogging()

func Start

func Start(cc Chaincode) error

func StartInProc

func StartInProc(env []string, args []string, cc Chaincode, recv <-chan *pb.ChaincodeMessage, send chan<- *pb.ChaincodeMessage) error

func Success

func Success(payload []byte) pb.Response

Types

type Chaincode

type Chaincode interface {
	Init(stub ChaincodeStubInterface) pb.Response

	Invoke(stub ChaincodeStubInterface) pb.Response
}

type ChaincodeLogger

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

func NewLogger

func NewLogger(name string) *ChaincodeLogger

func (*ChaincodeLogger) Critical

func (c *ChaincodeLogger) Critical(args ...interface{})

func (*ChaincodeLogger) Criticalf

func (c *ChaincodeLogger) Criticalf(format string, args ...interface{})

func (*ChaincodeLogger) Debug

func (c *ChaincodeLogger) Debug(args ...interface{})

func (*ChaincodeLogger) Debugf

func (c *ChaincodeLogger) Debugf(format string, args ...interface{})

func (*ChaincodeLogger) Error

func (c *ChaincodeLogger) Error(args ...interface{})

func (*ChaincodeLogger) Errorf

func (c *ChaincodeLogger) Errorf(format string, args ...interface{})

func (*ChaincodeLogger) Info

func (c *ChaincodeLogger) Info(args ...interface{})

func (*ChaincodeLogger) Infof

func (c *ChaincodeLogger) Infof(format string, args ...interface{})

func (*ChaincodeLogger) IsEnabledFor

func (c *ChaincodeLogger) IsEnabledFor(level LoggingLevel) bool

func (*ChaincodeLogger) Notice

func (c *ChaincodeLogger) Notice(args ...interface{})

func (*ChaincodeLogger) Noticef

func (c *ChaincodeLogger) Noticef(format string, args ...interface{})

func (*ChaincodeLogger) SetLevel

func (c *ChaincodeLogger) SetLevel(level LoggingLevel)

func (*ChaincodeLogger) Warning

func (c *ChaincodeLogger) Warning(args ...interface{})

func (*ChaincodeLogger) Warningf

func (c *ChaincodeLogger) Warningf(format string, args ...interface{})

type ChaincodeStub

type ChaincodeStub struct {
	TxID      string
	ChannelId string
	// contains filtered or unexported fields
}

func (*ChaincodeStub) CreateCompositeKey

func (stub *ChaincodeStub) CreateCompositeKey(objectType string, attributes []string) (string, error)

func (*ChaincodeStub) DelPrivateData

func (stub *ChaincodeStub) DelPrivateData(collection string, key string) error

func (*ChaincodeStub) DelState

func (stub *ChaincodeStub) DelState(key string) error

func (*ChaincodeStub) GetArgs

func (stub *ChaincodeStub) GetArgs() [][]byte

func (*ChaincodeStub) GetArgsSlice

func (stub *ChaincodeStub) GetArgsSlice() ([]byte, error)

func (*ChaincodeStub) GetBinding

func (stub *ChaincodeStub) GetBinding() ([]byte, error)

func (*ChaincodeStub) GetChannelID

func (stub *ChaincodeStub) GetChannelID() string

func (*ChaincodeStub) GetCreator

func (stub *ChaincodeStub) GetCreator() ([]byte, error)

func (*ChaincodeStub) GetDecorations

func (stub *ChaincodeStub) GetDecorations() map[string][]byte

func (*ChaincodeStub) GetFunctionAndParameters

func (stub *ChaincodeStub) GetFunctionAndParameters() (function string, params []string)

func (*ChaincodeStub) GetHistoryForKey

func (stub *ChaincodeStub) GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error)

func (*ChaincodeStub) GetPrivateData

func (stub *ChaincodeStub) GetPrivateData(collection string, key string) ([]byte, error)

func (*ChaincodeStub) GetPrivateDataByPartialCompositeKey

func (stub *ChaincodeStub) GetPrivateDataByPartialCompositeKey(collection, objectType string, attributes []string) (StateQueryIteratorInterface, error)

func (*ChaincodeStub) GetPrivateDataByRange

func (stub *ChaincodeStub) GetPrivateDataByRange(collection, startKey, endKey string) (StateQueryIteratorInterface, error)

func (*ChaincodeStub) GetPrivateDataHash

func (stub *ChaincodeStub) GetPrivateDataHash(collection string, key string) ([]byte, error)

func (*ChaincodeStub) GetPrivateDataQueryResult

func (stub *ChaincodeStub) GetPrivateDataQueryResult(collection, query string) (StateQueryIteratorInterface, error)

func (*ChaincodeStub) GetPrivateDataValidationParameter

func (stub *ChaincodeStub) GetPrivateDataValidationParameter(collection, key string) ([]byte, error)

func (*ChaincodeStub) GetQueryResult

func (stub *ChaincodeStub) GetQueryResult(query string) (StateQueryIteratorInterface, error)

func (*ChaincodeStub) GetQueryResultWithPagination

func (stub *ChaincodeStub) GetQueryResultWithPagination(query string, pageSize int32,
	bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

func (*ChaincodeStub) GetSignedProposal

func (stub *ChaincodeStub) GetSignedProposal() (*pb.SignedProposal, error)

func (*ChaincodeStub) GetState

func (stub *ChaincodeStub) GetState(key string) ([]byte, error)

func (*ChaincodeStub) GetStateByPartialCompositeKey

func (stub *ChaincodeStub) GetStateByPartialCompositeKey(objectType string, attributes []string) (StateQueryIteratorInterface, error)

func (*ChaincodeStub) GetStateByPartialCompositeKeyWithPagination

func (stub *ChaincodeStub) GetStateByPartialCompositeKeyWithPagination(objectType string, keys []string,
	pageSize int32, bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

func (*ChaincodeStub) GetStateByRange

func (stub *ChaincodeStub) GetStateByRange(startKey, endKey string) (StateQueryIteratorInterface, error)

func (*ChaincodeStub) GetStateByRangeWithPagination

func (stub *ChaincodeStub) GetStateByRangeWithPagination(startKey, endKey string, pageSize int32,
	bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

func (*ChaincodeStub) GetStateValidationParameter

func (stub *ChaincodeStub) GetStateValidationParameter(key string) ([]byte, error)

func (*ChaincodeStub) GetStringArgs

func (stub *ChaincodeStub) GetStringArgs() []string

func (*ChaincodeStub) GetTransient

func (stub *ChaincodeStub) GetTransient() (map[string][]byte, error)

func (*ChaincodeStub) GetTxID

func (stub *ChaincodeStub) GetTxID() string

func (*ChaincodeStub) GetTxTimestamp

func (stub *ChaincodeStub) GetTxTimestamp() (*timestamp.Timestamp, error)

func (*ChaincodeStub) InvokeChaincode

func (stub *ChaincodeStub) InvokeChaincode(chaincodeName string, args [][]byte, channel string) pb.Response

func (*ChaincodeStub) PutPrivateData

func (stub *ChaincodeStub) PutPrivateData(collection string, key string, value []byte) error

func (*ChaincodeStub) PutState

func (stub *ChaincodeStub) PutState(key string, value []byte) error

func (*ChaincodeStub) SetEvent

func (stub *ChaincodeStub) SetEvent(name string, payload []byte) error

func (*ChaincodeStub) SetPrivateDataValidationParameter

func (stub *ChaincodeStub) SetPrivateDataValidationParameter(collection, key string, ep []byte) error

func (*ChaincodeStub) SetStateValidationParameter

func (stub *ChaincodeStub) SetStateValidationParameter(key string, ep []byte) error

func (*ChaincodeStub) SplitCompositeKey

func (stub *ChaincodeStub) SplitCompositeKey(compositeKey string) (string, []string, error)

type ChaincodeStubInterface

type ChaincodeStubInterface interface {
	GetArgs() [][]byte

	GetStringArgs() []string

	GetFunctionAndParameters() (string, []string)

	GetArgsSlice() ([]byte, error)

	GetTxID() string

	GetChannelID() string

	InvokeChaincode(chaincodeName string, args [][]byte, channel string) pb.Response

	GetState(key string) ([]byte, error)

	PutState(key string, value []byte) error

	DelState(key string) error

	SetStateValidationParameter(key string, ep []byte) error

	GetStateValidationParameter(key string) ([]byte, error)

	GetStateByRange(startKey, endKey string) (StateQueryIteratorInterface, error)

	GetStateByRangeWithPagination(startKey, endKey string, pageSize int32,
		bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

	GetStateByPartialCompositeKey(objectType string, keys []string) (StateQueryIteratorInterface, error)

	GetStateByPartialCompositeKeyWithPagination(objectType string, keys []string,
		pageSize int32, bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

	CreateCompositeKey(objectType string, attributes []string) (string, error)

	SplitCompositeKey(compositeKey string) (string, []string, error)

	GetQueryResult(query string) (StateQueryIteratorInterface, error)

	GetQueryResultWithPagination(query string, pageSize int32,
		bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

	GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error)

	GetPrivateData(collection, key string) ([]byte, error)

	GetPrivateDataHash(collection, key string) ([]byte, error)

	PutPrivateData(collection string, key string, value []byte) error

	DelPrivateData(collection, key string) error

	SetPrivateDataValidationParameter(collection, key string, ep []byte) error

	GetPrivateDataValidationParameter(collection, key string) ([]byte, error)

	GetPrivateDataByRange(collection, startKey, endKey string) (StateQueryIteratorInterface, error)

	GetPrivateDataByPartialCompositeKey(collection, objectType string, keys []string) (StateQueryIteratorInterface, error)

	GetPrivateDataQueryResult(collection, query string) (StateQueryIteratorInterface, error)

	GetCreator() ([]byte, error)

	GetTransient() (map[string][]byte, error)

	GetBinding() ([]byte, error)

	GetDecorations() map[string][]byte

	GetSignedProposal() (*pb.SignedProposal, error)

	GetTxTimestamp() (*timestamp.Timestamp, error)

	SetEvent(name string, payload []byte) error
}

type CommonIterator

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

func (*CommonIterator) Close

func (iter *CommonIterator) Close() error

func (*CommonIterator) HasNext

func (iter *CommonIterator) HasNext() bool

type CommonIteratorInterface

type CommonIteratorInterface interface {
	HasNext() bool

	Close() error
}

type Handler

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

type HistoryQueryIterator

type HistoryQueryIterator struct {
	*CommonIterator
}

func (*HistoryQueryIterator) Next

func (iter *HistoryQueryIterator) Next() (*queryresult.KeyModification, error)

type HistoryQueryIteratorInterface

type HistoryQueryIteratorInterface interface {
	CommonIteratorInterface

	Next() (*queryresult.KeyModification, error)
}

type LoggingLevel

type LoggingLevel logging.Level

func LogLevel

func LogLevel(levelString string) (LoggingLevel, error)

type MockQueryIteratorInterface

type MockQueryIteratorInterface interface {
	StateQueryIteratorInterface
}

type MockStateRangeQueryIterator

type MockStateRangeQueryIterator struct {
	Closed   bool
	Stub     *MockStub
	StartKey string
	EndKey   string
	Current  *list.Element
}

func NewMockStateRangeQueryIterator

func NewMockStateRangeQueryIterator(stub *MockStub, startKey string, endKey string) *MockStateRangeQueryIterator

func (*MockStateRangeQueryIterator) Close

func (iter *MockStateRangeQueryIterator) Close() error

func (*MockStateRangeQueryIterator) HasNext

func (iter *MockStateRangeQueryIterator) HasNext() bool

func (*MockStateRangeQueryIterator) Next

func (*MockStateRangeQueryIterator) Print

func (iter *MockStateRangeQueryIterator) Print()

type MockStub

type MockStub struct {
	Name string

	State map[string][]byte

	Keys *list.List

	Invokables map[string]*MockStub

	TxID string

	TxTimestamp *timestamp.Timestamp

	ChannelID string

	PvtState map[string]map[string][]byte

	EndorsementPolicies map[string]map[string][]byte

	ChaincodeEventsChannel chan *pb.ChaincodeEvent

	Creator []byte

	Decorations map[string][]byte
	// contains filtered or unexported fields
}

func NewMockStub

func NewMockStub(name string, cc Chaincode) *MockStub

func (*MockStub) CreateCompositeKey

func (stub *MockStub) CreateCompositeKey(objectType string, attributes []string) (string, error)

func (*MockStub) DelPrivateData

func (stub *MockStub) DelPrivateData(collection string, key string) error

func (*MockStub) DelState

func (stub *MockStub) DelState(key string) error

func (*MockStub) GetArgs

func (stub *MockStub) GetArgs() [][]byte

func (*MockStub) GetArgsSlice

func (stub *MockStub) GetArgsSlice() ([]byte, error)

func (*MockStub) GetBinding

func (stub *MockStub) GetBinding() ([]byte, error)

func (*MockStub) GetChannelID

func (stub *MockStub) GetChannelID() string

func (*MockStub) GetCreator

func (stub *MockStub) GetCreator() ([]byte, error)

func (*MockStub) GetDecorations

func (stub *MockStub) GetDecorations() map[string][]byte

func (*MockStub) GetFunctionAndParameters

func (stub *MockStub) GetFunctionAndParameters() (function string, params []string)

func (*MockStub) GetHistoryForKey

func (stub *MockStub) GetHistoryForKey(key string) (HistoryQueryIteratorInterface, error)

func (*MockStub) GetPrivateData

func (stub *MockStub) GetPrivateData(collection string, key string) ([]byte, error)

func (*MockStub) GetPrivateDataByPartialCompositeKey

func (stub *MockStub) GetPrivateDataByPartialCompositeKey(collection, objectType string, attributes []string) (StateQueryIteratorInterface, error)

func (*MockStub) GetPrivateDataByRange

func (stub *MockStub) GetPrivateDataByRange(collection, startKey, endKey string) (StateQueryIteratorInterface, error)

func (*MockStub) GetPrivateDataHash

func (stub *MockStub) GetPrivateDataHash(collection, key string) ([]byte, error)

func (*MockStub) GetPrivateDataQueryResult

func (stub *MockStub) GetPrivateDataQueryResult(collection, query string) (StateQueryIteratorInterface, error)

func (*MockStub) GetPrivateDataValidationParameter

func (stub *MockStub) GetPrivateDataValidationParameter(collection, key string) ([]byte, error)

func (*MockStub) GetQueryResult

func (stub *MockStub) GetQueryResult(query string) (StateQueryIteratorInterface, error)

func (*MockStub) GetQueryResultWithPagination

func (stub *MockStub) GetQueryResultWithPagination(query string, pageSize int32,
	bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

func (*MockStub) GetSignedProposal

func (stub *MockStub) GetSignedProposal() (*pb.SignedProposal, error)

func (*MockStub) GetState

func (stub *MockStub) GetState(key string) ([]byte, error)

func (*MockStub) GetStateByPartialCompositeKey

func (stub *MockStub) GetStateByPartialCompositeKey(objectType string, attributes []string) (StateQueryIteratorInterface, error)

func (*MockStub) GetStateByPartialCompositeKeyWithPagination

func (stub *MockStub) GetStateByPartialCompositeKeyWithPagination(objectType string, keys []string,
	pageSize int32, bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

func (*MockStub) GetStateByRange

func (stub *MockStub) GetStateByRange(startKey, endKey string) (StateQueryIteratorInterface, error)

func (*MockStub) GetStateByRangeWithPagination

func (stub *MockStub) GetStateByRangeWithPagination(startKey, endKey string, pageSize int32,
	bookmark string) (StateQueryIteratorInterface, *pb.QueryResponseMetadata, error)

func (*MockStub) GetStateValidationParameter

func (stub *MockStub) GetStateValidationParameter(key string) ([]byte, error)

func (*MockStub) GetStringArgs

func (stub *MockStub) GetStringArgs() []string

func (*MockStub) GetTransient

func (stub *MockStub) GetTransient() (map[string][]byte, error)

func (*MockStub) GetTxID

func (stub *MockStub) GetTxID() string

func (*MockStub) GetTxTimestamp

func (stub *MockStub) GetTxTimestamp() (*timestamp.Timestamp, error)

func (*MockStub) InvokeChaincode

func (stub *MockStub) InvokeChaincode(chaincodeName string, args [][]byte, channel string) pb.Response

func (*MockStub) MockInit

func (stub *MockStub) MockInit(uuid string, args [][]byte) pb.Response

func (*MockStub) MockInvoke

func (stub *MockStub) MockInvoke(uuid string, args [][]byte) pb.Response

func (*MockStub) MockInvokeWithSignedProposal

func (stub *MockStub) MockInvokeWithSignedProposal(uuid string, args [][]byte, sp *pb.SignedProposal) pb.Response

func (*MockStub) MockPeerChaincode

func (stub *MockStub) MockPeerChaincode(invokableChaincodeName string, otherStub *MockStub, channel string)

func (*MockStub) MockTransactionEnd

func (stub *MockStub) MockTransactionEnd(uuid string)

func (*MockStub) MockTransactionStart

func (stub *MockStub) MockTransactionStart(txid string)

func (*MockStub) PutPrivateData

func (stub *MockStub) PutPrivateData(collection string, key string, value []byte) error

func (*MockStub) PutState

func (stub *MockStub) PutState(key string, value []byte) error

func (*MockStub) SetEvent

func (stub *MockStub) SetEvent(name string, payload []byte) error

func (*MockStub) SetPrivateDataValidationParameter

func (stub *MockStub) SetPrivateDataValidationParameter(collection, key string, ep []byte) error

func (*MockStub) SetStateValidationParameter

func (stub *MockStub) SetStateValidationParameter(key string, ep []byte) error

func (*MockStub) SplitCompositeKey

func (stub *MockStub) SplitCompositeKey(compositeKey string) (string, []string, error)

type PeerChaincodeStream

type PeerChaincodeStream interface {
	Send(*pb.ChaincodeMessage) error
	Recv() (*pb.ChaincodeMessage, error)
	CloseSend() error
}

type SendPanicFailure

type SendPanicFailure string

func (SendPanicFailure) Error

func (e SendPanicFailure) Error() string

type StateQueryIterator

type StateQueryIterator struct {
	*CommonIterator
}

func (*StateQueryIterator) Next

func (iter *StateQueryIterator) Next() (*queryresult.KV, error)

type StateQueryIteratorInterface

type StateQueryIteratorInterface interface {
	CommonIteratorInterface

	Next() (*queryresult.KV, error)
}

Directories

Path Synopsis
ext

Jump to

Keyboard shortcuts

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