eventlistener

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventBlock type for block event
	EventBlock = "Block"
	// EventFiltered type for filtered block event
	EventFiltered = "Filtered Block"
	// EventChaincode type for chaincode event
	EventChaincode = "Chaincode"
)

Variables

This section is empty.

Functions

func GetEnvelopeFromBlock

func GetEnvelopeFromBlock(data []byte) (*cb.Envelope, error)

GetEnvelopeFromBlock gets an envelope from a block's Data field.

func UnmarshalChaincodeAction

func UnmarshalChaincodeAction(caBytes []byte) (*peer.ChaincodeAction, error)

UnmarshalChaincodeAction unmarshals bytes to a ChaincodeAction

func UnmarshalChaincodeActionPayload

func UnmarshalChaincodeActionPayload(capBytes []byte) (*peer.ChaincodeActionPayload, error)

UnmarshalChaincodeActionPayload unmarshals bytes to a ChaincodeActionPayload

func UnmarshalChaincodeEvents

func UnmarshalChaincodeEvents(eBytes []byte) (*peer.ChaincodeEvent, error)

UnmarshalChaincodeEvents unmarshals bytes to a ChaincodeEvent

func UnmarshalChaincodeProposalPayload

func UnmarshalChaincodeProposalPayload(bytes []byte) (*peer.ChaincodeProposalPayload, error)

UnmarshalChaincodeProposalPayload unmarshals bytes to a ChaincodeProposalPayload

func UnmarshalChannelHeader

func UnmarshalChannelHeader(bytes []byte) (*cb.ChannelHeader, error)

UnmarshalChannelHeader unmarshals bytes to a ChannelHeader

func UnmarshalPayload

func UnmarshalPayload(encoded []byte) (*cb.Payload, error)

UnmarshalPayload unmarshals bytes to a Payload

func UnmarshalProposalResponsePayload

func UnmarshalProposalResponsePayload(prpBytes []byte) (*peer.ProposalResponsePayload, error)

UnmarshalProposalResponsePayload unmarshals bytes to a ProposalResponsePayload

func UnmarshalTransaction

func UnmarshalTransaction(txBytes []byte) (*peer.Transaction, error)

UnmarshalTransaction unmarshals bytes to a Transaction

Types

type ActionDetail

type ActionDetail struct {
	Chaincode     *ChaincodeID     `json:"chaincode,omitempty"`
	Input         *ChaincodeInput  `json:"input,omitempty"`
	Result        *ChaincodeResult `json:"result,omitempty"`
	EndorserCount int              `json:"endorsers,omitempty"`
}

ActionDetail contains data in a chaincode invocation

type BlockEventDetail

type BlockEventDetail struct {
	Number       uint64               `json:"block"`
	SourceURL    string               `json:"source,omitempty"`
	Transactions []*TransactionDetail `json:"transactions"`
}

BlockEventDetail contains data in a block event

type CCEventDetail

type CCEventDetail struct {
	BlockNumber uint64 `json:"block"`
	SourceURL   string `json:"source,omitempty"`
	TxID        string `json:"txId"`
	ChaincodeID string `json:"chaincode"`
	EventName   string `json:"name"`
	Payload     string `json:"payload"`
}

CCEventDetail contains data in a chaincode event

type ChaincodeEvent

type ChaincodeEvent struct {
	Name    string `json:"name"`
	Payload string `json:"payload,omitempty"`
}

ChaincodeEvent defines event created by a chaincode invocation

type ChaincodeID

type ChaincodeID struct {
	Type    string `json:"type,omitempty"`
	Name    string `json:"name"`
	Version string `json:"version,omitempty"`
}

ChaincodeID defines chaincode identity

type ChaincodeInput

type ChaincodeInput struct {
	Function     string   `json:"function"`
	Args         []string `json:"args,omitempty"`
	TransientMap string   `json:"transient,omitempty"`
}

ChaincodeInput defines input parameters of a chaincode invocation

type ChaincodeResponse

type ChaincodeResponse struct {
	Status  int32  `json:"status"`
	Message string `json:"message,omitempty"`
	Payload string `json:"payload,omitempty"`
}

ChaincodeResponse defines response from a chaincode invocation

type ChaincodeResult

type ChaincodeResult struct {
	ReadWriteCount int                `json:"rwset,omitempty"`
	Response       *ChaincodeResponse `json:"response,omitempty"`
	Event          *ChaincodeEvent    `json:"event,omitempty"`
}

ChaincodeResult defines result of a chaincode invocation

type EventHandler

type EventHandler func(data interface{})

EventHandler defines action on event data

type Factory

type Factory struct {
}

Factory to create a trigger

func (*Factory) Metadata

func (f *Factory) Metadata() *trigger.Metadata

Metadata implements trigger.Factory.Metadata

func (*Factory) New

func (f *Factory) New(config *trigger.Config) (trigger.Trigger, error)

New implements trigger.Factory.New

type HandlerSettings

type HandlerSettings struct {
	FabricConnector map[string]interface{} `md:"connectionName,required"`
	EventType       string                 `md:"eventType,required,allowed(Block,Filtered Block,Chaincode)"`
	ChaincodeID     string                 `md:"chaincodeID"`
	EventFilter     string                 `md:"eventFilter"`
	Org             string                 `md:"org"`
	User            string                 `md:"user,required"`
	Validation      bool                   `md:"validation"`
}

HandlerSettings of the trigger

func (*HandlerSettings) FromMap

func (h *HandlerSettings) FromMap(values map[string]interface{}) error

FromMap sets handler setting values from a map

func (*HandlerSettings) ToMap

func (h *HandlerSettings) ToMap() map[string]interface{}

ToMap converts handler settings to a map

type Identity

type Identity struct {
	Mspid   string `json:"mspid"`
	Subject string `json:"subject,omitempty"`
	Issuer  string `json:"issuer,omitempty"`
	Cert    string `json:"cert,omitempty"`
}

Identity contains creator's mspid and certificate

type Listener

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

Listener caches event listener info

func NewListener

func NewListener(spec *Spec, handler EventHandler) (*Listener, error)

NewListener creates a lisenter instance

func (*Listener) Start

func (c *Listener) Start() error

Start starts the event listener

func (*Listener) Stop

func (c *Listener) Stop()

Stop stops the event listener

type Output

type Output struct {
	Data interface{} `md:"data"`
}

Output of the activity

func (*Output) FromMap

func (o *Output) FromMap(values map[string]interface{}) error

FromMap sets trigger output values from a map

func (*Output) ToMap

func (o *Output) ToMap() map[string]interface{}

ToMap converts trigger output to a map

type Reply

type Reply struct {
}

Reply of the trigger

type Settings

type Settings struct {
}

Settings of the trigger

type Spec

type Spec struct {
	Name           string
	NetworkConfig  []byte
	EntityMatchers []byte
	OrgName        string
	UserName       string
	ChannelID      string
	EventType      string
	ChaincodeID    string
	EventFilter    string
}

Spec defines client for fabric events

type TransactionDetail

type TransactionDetail struct {
	TxType          string          `json:"type"`
	TxID            string          `json:"txId"`
	TxTime          string          `json:"txTime,omitempty"`
	ChannelID       string          `json:"channel"`
	CreatorIdentity *Identity       `json:"creator,omitempty"`
	Actions         []*ActionDetail `json:"actions,omitempty"`
}

TransactionDetail contains data in a transaction

type Trigger

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

Trigger eventlistener trigger struct

func (*Trigger) Initialize

func (t *Trigger) Initialize(ctx trigger.InitContext) error

Initialize implements trigger.Trigger.Initialize

func (*Trigger) Start

func (t *Trigger) Start() error

Start implements trigger.Trigger.Start

func (*Trigger) Stop

func (t *Trigger) Stop() error

Stop implements trigger.Trigger.Stop

Jump to

Keyboard shortcuts

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