protos

package
v0.0.0-...-f8eeb55 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

this file implemented wrap/unwrap between go types and proto Any type

Index

Constants

View Source
const HookPluginAPIVersion = 1

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrIncorrectFormat = errors.New("Incorrect format")

Functions

func RegisterType

func RegisterType(v any)

func WazeroModuleConfig

func WazeroModuleConfig(moduleConfig wazero.ModuleConfig) wazeroConfigOption

func WazeroRuntime

func WazeroRuntime(newRuntime WazeroNewRuntime) wazeroConfigOption

Types

type Any

type Any struct {
	Type  string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

will use "encoding/gob" package to encode/decode data

func WrapValue

func WrapValue(value any) (v *Any, err error)

func (*Any) GetType

func (x *Any) GetType() string

func (*Any) GetValue

func (x *Any) GetValue() []byte

func (*Any) MarshalToSizedBufferVT

func (m *Any) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Any) MarshalToVT

func (m *Any) MarshalToVT(dAtA []byte) (int, error)

func (*Any) MarshalVT

func (m *Any) MarshalVT() (dAtA []byte, err error)

func (*Any) ProtoReflect

func (x *Any) ProtoReflect() protoreflect.Message

func (*Any) SizeVT

func (m *Any) SizeVT() (n int)

func (*Any) UnmarshalVT

func (m *Any) UnmarshalVT(dAtA []byte) error

func (*Any) Unwrap

func (v *Any) Unwrap() (value any, err error)

type Device

type Device struct {
	Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Id   int64  `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
	Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Device) GetHost

func (x *Device) GetHost() string

func (*Device) GetId

func (x *Device) GetId() int64

func (*Device) GetType

func (x *Device) GetType() string

func (*Device) MarshalToSizedBufferVT

func (m *Device) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Device) MarshalToVT

func (m *Device) MarshalToVT(dAtA []byte) (int, error)

func (*Device) MarshalVT

func (m *Device) MarshalVT() (dAtA []byte, err error)

func (*Device) ProtoReflect

func (x *Device) ProtoReflect() protoreflect.Message

func (*Device) SizeVT

func (m *Device) SizeVT() (n int)

func (*Device) UnmarshalVT

func (m *Device) UnmarshalVT(dAtA []byte) error

type DeviceCustomEvent

type DeviceCustomEvent struct {
	Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
	Event  string  `protobuf:"bytes,2,opt,name=event,proto3" json:"event,omitempty"`
	Args   []*Any  `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceCustomEvent) GetArgs

func (x *DeviceCustomEvent) GetArgs() []*Any

func (*DeviceCustomEvent) GetDevice

func (x *DeviceCustomEvent) GetDevice() *Device

func (*DeviceCustomEvent) GetEvent

func (x *DeviceCustomEvent) GetEvent() string

func (*DeviceCustomEvent) MarshalToSizedBufferVT

func (m *DeviceCustomEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DeviceCustomEvent) MarshalToVT

func (m *DeviceCustomEvent) MarshalToVT(dAtA []byte) (int, error)

func (*DeviceCustomEvent) MarshalVT

func (m *DeviceCustomEvent) MarshalVT() (dAtA []byte, err error)

func (*DeviceCustomEvent) ProtoReflect

func (x *DeviceCustomEvent) ProtoReflect() protoreflect.Message

func (*DeviceCustomEvent) SizeVT

func (m *DeviceCustomEvent) SizeVT() (n int)

func (*DeviceCustomEvent) UnmarshalVT

func (m *DeviceCustomEvent) UnmarshalVT(dAtA []byte) error

type DeviceEvent

type DeviceEvent struct {
	Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
	Event  string  `protobuf:"bytes,2,opt,name=event,proto3" json:"event,omitempty"`
	Args   []*Any  `protobuf:"bytes,3,rep,name=args,proto3" json:"args,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceEvent) GetArgs

func (x *DeviceEvent) GetArgs() []*Any

func (*DeviceEvent) GetDevice

func (x *DeviceEvent) GetDevice() *Device

func (*DeviceEvent) GetEvent

func (x *DeviceEvent) GetEvent() string

func (*DeviceEvent) MarshalToSizedBufferVT

func (m *DeviceEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DeviceEvent) MarshalToVT

func (m *DeviceEvent) MarshalToVT(dAtA []byte) (int, error)

func (*DeviceEvent) MarshalVT

func (m *DeviceEvent) MarshalVT() (dAtA []byte, err error)

func (*DeviceEvent) ProtoReflect

func (x *DeviceEvent) ProtoReflect() protoreflect.Message

func (*DeviceEvent) SizeVT

func (m *DeviceEvent) SizeVT() (n int)

func (*DeviceEvent) UnmarshalVT

func (m *DeviceEvent) UnmarshalVT(dAtA []byte) error

type DeviceJoinEvent

type DeviceJoinEvent struct {
	Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceJoinEvent) GetDevice

func (x *DeviceJoinEvent) GetDevice() *Device

func (*DeviceJoinEvent) MarshalToSizedBufferVT

func (m *DeviceJoinEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DeviceJoinEvent) MarshalToVT

func (m *DeviceJoinEvent) MarshalToVT(dAtA []byte) (int, error)

func (*DeviceJoinEvent) MarshalVT

func (m *DeviceJoinEvent) MarshalVT() (dAtA []byte, err error)

func (*DeviceJoinEvent) ProtoReflect

func (x *DeviceJoinEvent) ProtoReflect() protoreflect.Message

func (*DeviceJoinEvent) SizeVT

func (m *DeviceJoinEvent) SizeVT() (n int)

func (*DeviceJoinEvent) UnmarshalVT

func (m *DeviceJoinEvent) UnmarshalVT(dAtA []byte) error

type DeviceLeaveEvent

type DeviceLeaveEvent struct {
	Device *Device `protobuf:"bytes,1,opt,name=device,proto3" json:"device,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceLeaveEvent) GetDevice

func (x *DeviceLeaveEvent) GetDevice() *Device

func (*DeviceLeaveEvent) MarshalToSizedBufferVT

func (m *DeviceLeaveEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*DeviceLeaveEvent) MarshalToVT

func (m *DeviceLeaveEvent) MarshalToVT(dAtA []byte) (int, error)

func (*DeviceLeaveEvent) MarshalVT

func (m *DeviceLeaveEvent) MarshalVT() (dAtA []byte, err error)

func (*DeviceLeaveEvent) ProtoReflect

func (x *DeviceLeaveEvent) ProtoReflect() protoreflect.Message

func (*DeviceLeaveEvent) SizeVT

func (m *DeviceLeaveEvent) SizeVT() (n int)

func (*DeviceLeaveEvent) UnmarshalVT

func (m *DeviceLeaveEvent) UnmarshalVT(dAtA []byte) error

type Empty

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

func (*Empty) MarshalToSizedBufferVT

func (m *Empty) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Empty) MarshalToVT

func (m *Empty) MarshalToVT(dAtA []byte) (int, error)

func (*Empty) MarshalVT

func (m *Empty) MarshalVT() (dAtA []byte, err error)

func (*Empty) ProtoReflect

func (x *Empty) ProtoReflect() protoreflect.Message

func (*Empty) SizeVT

func (m *Empty) SizeVT() (n int)

func (*Empty) UnmarshalVT

func (m *Empty) UnmarshalVT(dAtA []byte) error

type FireEventReq

type FireEventReq struct {
	Target *Device         `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
	Data   map[string]*Any `` /* 149-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*FireEventReq) GetData

func (x *FireEventReq) GetData() map[string]*Any

func (*FireEventReq) GetTarget

func (x *FireEventReq) GetTarget() *Device

func (*FireEventReq) MarshalToSizedBufferVT

func (m *FireEventReq) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*FireEventReq) MarshalToVT

func (m *FireEventReq) MarshalToVT(dAtA []byte) (int, error)

func (*FireEventReq) MarshalVT

func (m *FireEventReq) MarshalVT() (dAtA []byte, err error)

func (*FireEventReq) ProtoReflect

func (x *FireEventReq) ProtoReflect() protoreflect.Message

func (*FireEventReq) SizeVT

func (m *FireEventReq) SizeVT() (n int)

func (*FireEventReq) UnmarshalVT

func (m *FireEventReq) UnmarshalVT(dAtA []byte) error

type Hook

type Hook interface {
	Metadata(context.Context, *Empty) (*HookMetadata, error)
	OnLoad(context.Context, *HookLoadEvent) (*Empty, error)
	OnUnload(context.Context, *HookUnloadEvent) (*Empty, error)
	OnDeviceJoin(context.Context, *DeviceJoinEvent) (*Empty, error)
	OnDeviceLeave(context.Context, *DeviceLeaveEvent) (*Empty, error)
	OnDeviceEvent(context.Context, *DeviceEvent) (*Empty, error)
	OnDeviceCustomEvent(context.Context, *DeviceCustomEvent) (*Empty, error)
}

go:plugin type=plugin version=1

type HookAPI

type HookAPI interface {
	FireEvent(context.Context, *FireEventReq) (*Empty, error)
}

go:plugin type=host version=1

type HookLoadEvent

type HookLoadEvent struct {
	Reload bool `protobuf:"varint,1,opt,name=reload,proto3" json:"reload,omitempty"`
	// contains filtered or unexported fields
}

func (*HookLoadEvent) GetReload

func (x *HookLoadEvent) GetReload() bool

func (*HookLoadEvent) MarshalToSizedBufferVT

func (m *HookLoadEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*HookLoadEvent) MarshalToVT

func (m *HookLoadEvent) MarshalToVT(dAtA []byte) (int, error)

func (*HookLoadEvent) MarshalVT

func (m *HookLoadEvent) MarshalVT() (dAtA []byte, err error)

func (*HookLoadEvent) ProtoReflect

func (x *HookLoadEvent) ProtoReflect() protoreflect.Message

func (*HookLoadEvent) SizeVT

func (m *HookLoadEvent) SizeVT() (n int)

func (*HookLoadEvent) UnmarshalVT

func (m *HookLoadEvent) UnmarshalVT(dAtA []byte) error

type HookMetadata

type HookMetadata struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

func (*HookMetadata) GetId

func (x *HookMetadata) GetId() string

func (*HookMetadata) GetVersion

func (x *HookMetadata) GetVersion() string

func (*HookMetadata) MarshalToSizedBufferVT

func (m *HookMetadata) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*HookMetadata) MarshalToVT

func (m *HookMetadata) MarshalToVT(dAtA []byte) (int, error)

func (*HookMetadata) MarshalVT

func (m *HookMetadata) MarshalVT() (dAtA []byte, err error)

func (*HookMetadata) ProtoReflect

func (x *HookMetadata) ProtoReflect() protoreflect.Message

func (*HookMetadata) SizeVT

func (m *HookMetadata) SizeVT() (n int)

func (*HookMetadata) UnmarshalVT

func (m *HookMetadata) UnmarshalVT(dAtA []byte) error

type HookPlugin

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

func NewHookPlugin

func NewHookPlugin(ctx context.Context, opts ...wazeroConfigOption) (*HookPlugin, error)

func (*HookPlugin) Load

func (p *HookPlugin) Load(ctx context.Context, pluginPath string, hostFunctions HookAPI) (hook, error)

type HookUnloadEvent

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

func (*HookUnloadEvent) MarshalToSizedBufferVT

func (m *HookUnloadEvent) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*HookUnloadEvent) MarshalToVT

func (m *HookUnloadEvent) MarshalToVT(dAtA []byte) (int, error)

func (*HookUnloadEvent) MarshalVT

func (m *HookUnloadEvent) MarshalVT() (dAtA []byte, err error)

func (*HookUnloadEvent) ProtoReflect

func (x *HookUnloadEvent) ProtoReflect() protoreflect.Message

func (*HookUnloadEvent) SizeVT

func (m *HookUnloadEvent) SizeVT() (n int)

func (*HookUnloadEvent) UnmarshalVT

func (m *HookUnloadEvent) UnmarshalVT(dAtA []byte) error

type UnknownTypeErr

type UnknownTypeErr struct {
	Type string
}

func (*UnknownTypeErr) Error

func (e *UnknownTypeErr) Error() string

type UnsupportTypeErr

type UnsupportTypeErr struct {
	Type reflect.Type
}

func (*UnsupportTypeErr) Error

func (e *UnsupportTypeErr) Error() string

type WazeroConfig

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

type WazeroNewRuntime

type WazeroNewRuntime func(context.Context) (wazero.Runtime, error)

func DefaultWazeroRuntime

func DefaultWazeroRuntime() WazeroNewRuntime

Jump to

Keyboard shortcuts

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