events

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallEvent

func CallEvent(stub *sw.StubWrapper, eventTag string, payload []byte) errors.ICCError

func InitEventList

func InitEventList(l []Event)

InitEventList appends custom events to eventList to avoid initialization loop.

Types

type Event

type Event struct {
	// Tag is how the event will be referenced
	Tag string `json:"tag"`

	// Label is the pretty event name for logs
	Label string `json:"label"`

	// Description is a simple explanation describing the meaning of the event.
	Description string `json:"description"`

	// BaseLog is the basisc log message for the event
	BaseLog string `json:"baseLog"`

	// Type is the type of event
	Type EventType `json:"type"`

	// Receivers is an array that specifies which organizations will receive the event.
	// Accepts either basic strings for exact matches
	// eg. []string{'org1MSP', 'org2MSP'}
	// or regular expressions
	// eg. []string{`$org\dMSP`} and cc-tools will
	// check for a match with regular expression `org\dMSP`
	Receivers []string `json:"receivers,omitempty"`

	// Transaction is the transaction that the event triggers (if of type EventTransaction)
	Transaction string `json:"transaction"`

	// Channel is the channel of the transaction that the event triggers (if of type EventTransaction)
	// If empty, the event will trigger on the same channel as the transaction that calls the event
	Channel string `json:"channel"`

	// Chaincode is the chaincode of the transaction that the event triggers (if of type EventTransaction)
	// If empty, the event will trigger on the same chaincode as the transaction that calls the event
	Chaincode string `json:"chaincode"`

	// CustomFunction is used an event of type "EventCustom" is called.
	// It is a function that receives a stub and a payload and returns an error.
	CustomFunction func(*sw.StubWrapper, []byte) error `json:"-"`

	// ReadOnly indicates if the CustomFunction has the ability to alter the world state (if of type EventCustom).
	ReadOnly bool `json:"readOnly"`
}

Event is the struct defining a primitive event.

func EventList

func EventList() []Event

EventList returns a copy of the eventList variable.

func FetchEvent

func FetchEvent(eventTag string) *Event

FetchEvent returns a pointer to the event object or nil if event is not found.

func (Event) CallEvent

func (event Event) CallEvent(stub *sw.StubWrapper, payload []byte) errors.ICCError

type EventType

type EventType float64
const (
	EventLog EventType = iota
	EventTransaction
	EventCustom
)

Jump to

Keyboard shortcuts

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