chaincode

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEndorseView

func NewEndorseView(chaincode, function string, args ...interface{}) *endorseChaincodeView

func NewInvokeView

func NewInvokeView(chaincode, function string, args ...interface{}) *invokeChaincodeView

func NewQueryView

func NewQueryView(chaincode, function string, args ...interface{}) *queryChaincodeView

Types

type Chaincode

type Chaincode interface {
	IsPrivate() bool
	Endorse(function string, args ...interface{}) Endorse
	Query(function string, args ...interface{}) Query
}

type Endorse

type Endorse interface {
	WithInvokerIdentity(identity view.Identity) Endorse
	WithTransientEntry(k string, v interface{}) error
	WithEndorsersByMSPIDs(ds ...string)
	WithEndorsersFromMyOrg()
	WithTxID(txID fabric.TxID) Endorse
	Call() (*fabric.Envelope, error)
	WithNumRetries(retries uint)
	WithRetrySleep(sleep time.Duration)
}

type Event

type Event = committer.ChaincodeEvent

Event models a chaincode event

type EventCallback

type EventCallback func(event *Event) (bool, error)

EventCallback is used to parse the received events. It takes in input the generated event and return a boolean and an error. If the boolean is true, no more events are passed to this callback function. If an error occurred, no more events are passed as well.

type InvokeCall

type InvokeCall struct {
	InvokerIdentity        view.Identity
	Network                string
	Channel                string
	ChaincodePath          string
	ChaincodeName          string
	ChaincodeVersion       string
	TransientMap           map[string]interface{}
	EndorsersMSPIDs        []string
	EndorsersFromMyOrg     bool
	Function               string
	Args                   []interface{}
	MatchEndorsementPolicy bool
	SetNumRetries          bool
	NumRetries             uint
	SetRetrySleep          bool
	RetrySleep             time.Duration
	TxID                   fabric.TxID
}

type ListenToEventsView added in v0.4.0

type ListenToEventsView struct {
	*RegisterChaincodeCall
}

func NewListenToEventsView

func NewListenToEventsView(chaincode string, callBack EventCallback) *ListenToEventsView

NewListenToEventsView register a listener for the events generated by the passed chaincode and call the passed callback when an event is caught.

func NewListenToEventsViewWithContext added in v0.4.0

func NewListenToEventsViewWithContext(context context.Context, chaincode string, callBack EventCallback) *ListenToEventsView

func (*ListenToEventsView) Call added in v0.4.0

func (r *ListenToEventsView) Call(context view.Context) (interface{}, error)

func (*ListenToEventsView) RegisterChaincodeEvents added in v0.4.0

func (r *ListenToEventsView) RegisterChaincodeEvents(viewContext view.Context) error

type Query

type Query interface {
	WithInvokerIdentity(identity view.Identity) Query
	WithTransientEntry(k string, v interface{}) error
	WithEndorsersByMSPIDs(ds ...string)
	WithEndorsersFromMyOrg()
	WithMatchEndorsementPolicy()
	Call() ([]byte, error)
	WithNumRetries(retries uint)
	WithRetrySleep(sleep time.Duration)
}

type RegisterChaincodeCall

type RegisterChaincodeCall struct {
	Context          context.Context
	InvokerIdentity  view.Identity
	Network          string
	Channel          string
	ChaincodePath    string
	ChaincodeName    string
	ChaincodeVersion string
	CallBack         EventCallback
}

Jump to

Keyboard shortcuts

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