internal

package
v0.0.0-...-00240f3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CallTypeNA contract function isnt callabale by invoke/query
	CallTypeNA = iota
	// CallTypeSubmit contract function should be called by invoke
	CallTypeSubmit
	// CallTypeEvaluate contract function should be called by query
	CallTypeEvaluate
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallType

type CallType int

CallType enum for type of call that should be used for method submit vs evaluate

type ContractFunction

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

ContractFunction contains a description of a function so that it can be called by a chaincode

func NewContractFunctionFromFunc

func NewContractFunctionFromFunc(fn interface{}, callType CallType, contextHandlerType reflect.Type) (*ContractFunction, error)

NewContractFunctionFromFunc creates a new contract function from a given function

func NewContractFunctionFromReflect

func NewContractFunctionFromReflect(typeMethod reflect.Method, valueMethod reflect.Value, callType CallType, contextHandlerType reflect.Type) (*ContractFunction, error)

NewContractFunctionFromReflect creates a new contract function from a reflected method

func (ContractFunction) Call

func (cf ContractFunction) Call(ctx reflect.Value, supplementaryMetadata *metadata.TransactionMetadata, components *metadata.ComponentMetadata, serializer serializer.TransactionSerializer, params ...string) (string, interface{}, error)

Call calls function in a contract using string args and handles formatting the response into useful types

func (ContractFunction) ReflectMetadata

func (cf ContractFunction) ReflectMetadata(name string, existingComponents *metadata.ComponentMetadata) metadata.TransactionMetadata

ReflectMetadata returns the metadata for contract function

type TransactionHandler

type TransactionHandler struct {
	ContractFunction
	// contains filtered or unexported fields
}

TransactionHandler extension of contract function that manages function which handles calls to before, after and unknown transaction functions

func NewTransactionHandler

func NewTransactionHandler(fn interface{}, contextHandlerType reflect.Type, handlesType TransactionHandlerType) (*TransactionHandler, error)

NewTransactionHandler create a new transaction handler from a given function

func (TransactionHandler) Call

func (th TransactionHandler) Call(ctx reflect.Value, data interface{}, serializer serializer.TransactionSerializer) (string, interface{}, error)

Call calls tranaction function using string args and handles formatting the response into useful types

type TransactionHandlerType

type TransactionHandlerType int

TransactionHandlerType enum for type of transaction handled

const (
	// TransactionHandlerTypeBefore before transaction type
	TransactionHandlerTypeBefore TransactionHandlerType = iota + 1
	// TransactionHandlerTypeUnknown before transaction type
	TransactionHandlerTypeUnknown
	// TransactionHandlerTypeAfter before transaction type
	TransactionHandlerTypeAfter
)

func (TransactionHandlerType) String

func (tht TransactionHandlerType) String() (string, error)

Directories

Path Synopsis
functionaltests

Jump to

Keyboard shortcuts

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