routing

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Function

type Function = string

Function represents the name of a chaincode function.

type Method

type Method struct {
	Type          MethodType // The type of the method.
	ChaincodeFunc Function   // The name of the chaincode function being called.
	MethodName    string     // The actual method name to be invoked.
	RequiresAuth  bool       // Indicates if the method requires authentication.
	NumArgs       int        // Number of arguments the method takes (excluding the receiver).
}

Method represents an endpoint of a contract.

type MethodType

type MethodType int

MethodType represents the type of a method in the contract.

const (
	MethodTypeTransaction MethodType = iota // Tx-prefixed transaction when using reflectx.Router.
	MethodTypeInvoke                        // NBTx-prefixed transaction when using reflectx.Router.
	MethodTypeQuery                         // Query-prefixed transaction when using reflectx.Router.
)

Constants representing the different types of methods.

type Router

type Router interface {
	// Check validates the provided arguments for the specified method.
	// It returns an error if the validation fails.
	Check(stub shim.ChaincodeStubInterface, method string, args ...string) error

	// Invoke calls the specified method with the provided arguments.
	// It returns a byte slice of response and an error if the invocation fails.
	Invoke(stub shim.ChaincodeStubInterface, method string, args ...string) ([]byte, error)

	// Methods retrieves a map of all available methods, keyed by their chaincode function names.
	Methods() map[Function]Method
}

Router defines the interface for managing contract methods and routing calls.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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