event

package
v1.6.5-rc28 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPushReq

type DataPushReq struct {
	DeviceID  string `json:"device_id"`
	EventType string `json:"event_type,omitempty"`
	Payload   string `json:"payload"`
	Timestamp int64  `json:"timestamp,omitempty"`
}

type DataPushReqs

type DataPushReqs []*DataPushReq

func (DataPushReqs) SetDefault

func (reqs DataPushReqs) SetDefault()

type DataPushRsp

type DataPushRsp struct {
	Index   int       `json:"index"`
	Results []*Result `json:"results"`
}

type DataPushRsps

type DataPushRsps []*DataPushRsp

func BatchCreate

func BatchCreate(ctx context.Context, reqs DataPushReqs) (DataPushRsps, error)

type EventCleanupScheduler

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

func NewEventCleanupScheduler

func NewEventCleanupScheduler(d time.Duration, keep time.Duration) *EventCleanupScheduler

func (*EventCleanupScheduler) Run

type EventHandleScheduler

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

func NewEventHandleScheduler

func NewEventHandleScheduler(d time.Duration) *EventHandleScheduler

func (*EventHandleScheduler) Run

func (s *EventHandleScheduler) Run(ctx context.Context)

type EventReq added in v1.1.0

type EventReq struct {
	// From transport source
	From enums.EventSource `in:"query" name:"from,omitempty"`
	// 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"`
}

func Create

func Create(ctx context.Context, r *EventReq) (*EventRsp, error)

func HandleEvent added in v1.1.0

func HandleEvent(ctx context.Context, tpe string, data []byte) (*EventRsp, 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

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