event

package
v1.6.5-rc1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleEvent added in v1.1.0

func HandleEvent(ctx context.Context, t string, data []byte) (interface{}, error)

HandleEvent support other module call TODO the full project info is not in context so query and set here. this impl is for support other module, which is temporary. And it will be deprecated when rpc/http is ready

Types

type EventReq added in v1.1.0

type EventReq struct {
	// Channel message channel named (intact project name)
	Channel string `in:"path"  name:"channel"`
	// EventType used for filter strategies created in w3b before
	EventType string `in:"query" name:"eventType,omitempty"`
	// EventID unique id for tracing event under channel
	EventID string `in:"query" name:"eventID,omitempty"`
	// Timestamp event time when publisher do send
	Timestamp int64 `in:"query" name:"timestamp,omitempty"`
	// Payload event payload (binary only)
	Payload bytes.Buffer `in:"body" mime:"stream"`
}

func (*EventReq) IsDataPush added in v1.4.3

func (r *EventReq) IsDataPush() bool

func (*EventReq) SetDefault added in v1.1.0

func (r *EventReq) SetDefault()

type EventRsp added in v1.1.0

type EventRsp struct {
	// Channel intact project name
	Channel string `json:"channel"`
	// PublisherID publisher(device) unique id in w3b node
	PublisherID types.SFID `json:"publisherID"`
	// PublisherKey publisher(device) mn unique id of this device
	PublisherKey string `json:"publisherKey"`
	// EventID same as EventReq.EventID
	EventID string `json:"eventID"`
	// Timestamp event respond time when event handled done.
	Timestamp int64 `json:"timestamp"`
	// Results result for each wasm invoke, which hits strategies.
	Results []*Result `json:"results"`
	// Error error message from w3b node (api level), different from Result.Error
	Error string `json:"error,omitempty"`
}

type Result added in v1.1.0

type Result struct {
	// AppletName applet name(unique) under published channel(project)
	AppletName string `json:"appletName"`
	// InstanceID the unique wasm vm  id
	InstanceID types.SFID `json:"instanceID"`
	// Handler invoked wasm entry name
	Handler string `json:"handler"`
	// ReturnValue wasm call returned value
	ReturnValue []byte `json:"returnValue"`
	// ReturnCode wasm call returned code
	ReturnCode int `json:"code"`
	// Error message instance module, presents result for wasm invoking
	Error string `json:"error,omitempty"`
}

func OnEvent added in v1.1.0

func OnEvent(ctx context.Context, data []byte) (ret []*Result)

Jump to

Keyboard shortcuts

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