plugin_events

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PluginEventService_Publish_FullMethodName     = "/plugin_events.PluginEventService/Publish"
	PluginEventService_Subscribe_FullMethodName   = "/plugin_events.PluginEventService/Subscribe"
	PluginEventService_Unsubscribe_FullMethodName = "/plugin_events.PluginEventService/Unsubscribe"
)

Variables

View Source
var File_proto_plugin_events_proto protoreflect.FileDescriptor
View Source
var PluginEventService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "plugin_events.PluginEventService",
	HandlerType: (*PluginEventServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Publish",
			Handler:    _PluginEventService_Publish_Handler,
		},
		{
			MethodName: "Unsubscribe",
			Handler:    _PluginEventService_Unsubscribe_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Subscribe",
			Handler:       _PluginEventService_Subscribe_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "proto/plugin_events.proto",
}

PluginEventService_ServiceDesc is the grpc.ServiceDesc for PluginEventService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterPluginEventServiceServer

func RegisterPluginEventServiceServer(s grpc.ServiceRegistrar, srv PluginEventServiceServer)

Types

type EventMessage

type EventMessage struct {

	// id is the unique event identifier (UUID)
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// topic is the logical topic name
	Topic string `protobuf:"bytes,2,opt,name=topic,proto3" json:"topic,omitempty"`
	// origin is the node/plugin that created the event
	Origin string `protobuf:"bytes,3,opt,name=origin,proto3" json:"origin,omitempty"`
	// direction indicates the original routing direction (informational)
	// When received via Subscribe, events are always effectively "local"
	Direction int32 `protobuf:"varint,4,opt,name=direction,proto3" json:"direction,omitempty"`
	// payload is the JSON-encoded event payload
	Payload []byte `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

EventMessage is streamed to plugins for matching events

func (*EventMessage) Descriptor deprecated

func (*EventMessage) Descriptor() ([]byte, []int)

Deprecated: Use EventMessage.ProtoReflect.Descriptor instead.

func (*EventMessage) GetDirection

func (x *EventMessage) GetDirection() int32

func (*EventMessage) GetId

func (x *EventMessage) GetId() string

func (*EventMessage) GetOrigin

func (x *EventMessage) GetOrigin() string

func (*EventMessage) GetPayload

func (x *EventMessage) GetPayload() []byte

func (*EventMessage) GetTopic

func (x *EventMessage) GetTopic() string

func (*EventMessage) ProtoMessage

func (*EventMessage) ProtoMessage()

func (*EventMessage) ProtoReflect

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

func (*EventMessage) Reset

func (x *EventMessage) Reset()

func (*EventMessage) String

func (x *EventMessage) String() string

type PluginEventServiceClient

type PluginEventServiceClient interface {
	// Publish sends an event to the host's event bus.
	// The event will be routed based on the direction:
	// - DirLocal (0): stays on local bus only
	// - DirUp (1): forwarded from edge to control
	// - DirDown (2): forwarded from control to edge(s)
	Publish(ctx context.Context, in *PublishRequest, opts ...grpc.CallOption) (*PublishResponse, error)
	// Subscribe creates a subscription and streams events back to the plugin.
	// The stream remains open until the client disconnects or calls Unsubscribe.
	// Events matching the subscription criteria are sent as they occur.
	Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[EventMessage], error)
	// Unsubscribe removes a subscription by ID.
	// This is optional - subscriptions are automatically cleaned up when the
	// Subscribe stream is closed.
	Unsubscribe(ctx context.Context, in *UnsubscribeRequest, opts ...grpc.CallOption) (*UnsubscribeResponse, error)
}

PluginEventServiceClient is the client API for PluginEventService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

PluginEventService provides event pub/sub for plugins via go-plugin broker. This service is implemented by the host (AI Studio or Microgateway) and called by plugins to publish events and subscribe to event streams.

type PluginEventServiceServer

type PluginEventServiceServer interface {
	// Publish sends an event to the host's event bus.
	// The event will be routed based on the direction:
	// - DirLocal (0): stays on local bus only
	// - DirUp (1): forwarded from edge to control
	// - DirDown (2): forwarded from control to edge(s)
	Publish(context.Context, *PublishRequest) (*PublishResponse, error)
	// Subscribe creates a subscription and streams events back to the plugin.
	// The stream remains open until the client disconnects or calls Unsubscribe.
	// Events matching the subscription criteria are sent as they occur.
	Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[EventMessage]) error
	// Unsubscribe removes a subscription by ID.
	// This is optional - subscriptions are automatically cleaned up when the
	// Subscribe stream is closed.
	Unsubscribe(context.Context, *UnsubscribeRequest) (*UnsubscribeResponse, error)
	// contains filtered or unexported methods
}

PluginEventServiceServer is the server API for PluginEventService service. All implementations must embed UnimplementedPluginEventServiceServer for forward compatibility.

PluginEventService provides event pub/sub for plugins via go-plugin broker. This service is implemented by the host (AI Studio or Microgateway) and called by plugins to publish events and subscribe to event streams.

type PluginEventService_SubscribeClient

type PluginEventService_SubscribeClient = grpc.ServerStreamingClient[EventMessage]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type PluginEventService_SubscribeServer

type PluginEventService_SubscribeServer = grpc.ServerStreamingServer[EventMessage]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type PublishRequest

type PublishRequest struct {

	// topic is the logical topic name (e.g., "cache.hit", "config.reload")
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// payload is the JSON-encoded event payload
	Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// direction controls event routing:
	// 0 = DirLocal (stays on local bus)
	// 1 = DirUp (edge to control)
	// 2 = DirDown (control to edge)
	Direction int32 `protobuf:"varint,3,opt,name=direction,proto3" json:"direction,omitempty"`
	// plugin_id identifies the plugin publishing the event (for origin tracking)
	PluginId string `protobuf:"bytes,4,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"`
	// contains filtered or unexported fields
}

PublishRequest is sent by a plugin to publish an event

func (*PublishRequest) Descriptor deprecated

func (*PublishRequest) Descriptor() ([]byte, []int)

Deprecated: Use PublishRequest.ProtoReflect.Descriptor instead.

func (*PublishRequest) GetDirection

func (x *PublishRequest) GetDirection() int32

func (*PublishRequest) GetPayload

func (x *PublishRequest) GetPayload() []byte

func (*PublishRequest) GetPluginId

func (x *PublishRequest) GetPluginId() string

func (*PublishRequest) GetTopic

func (x *PublishRequest) GetTopic() string

func (*PublishRequest) ProtoMessage

func (*PublishRequest) ProtoMessage()

func (*PublishRequest) ProtoReflect

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

func (*PublishRequest) Reset

func (x *PublishRequest) Reset()

func (*PublishRequest) String

func (x *PublishRequest) String() string

type PublishResponse

type PublishResponse struct {

	// success indicates whether the event was published successfully
	Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	// error_message contains the error description if success is false
	ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
	// event_id is the generated UUID for the published event
	EventId string `protobuf:"bytes,3,opt,name=event_id,json=eventId,proto3" json:"event_id,omitempty"`
	// contains filtered or unexported fields
}

PublishResponse is returned after publishing an event

func (*PublishResponse) Descriptor deprecated

func (*PublishResponse) Descriptor() ([]byte, []int)

Deprecated: Use PublishResponse.ProtoReflect.Descriptor instead.

func (*PublishResponse) GetErrorMessage

func (x *PublishResponse) GetErrorMessage() string

func (*PublishResponse) GetEventId

func (x *PublishResponse) GetEventId() string

func (*PublishResponse) GetSuccess

func (x *PublishResponse) GetSuccess() bool

func (*PublishResponse) ProtoMessage

func (*PublishResponse) ProtoMessage()

func (*PublishResponse) ProtoReflect

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

func (*PublishResponse) Reset

func (x *PublishResponse) Reset()

func (*PublishResponse) String

func (x *PublishResponse) String() string

type SubscribeRequest

type SubscribeRequest struct {

	// topic is the topic to subscribe to. If empty and subscribe_all is false,
	// no events will be received.
	Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic,omitempty"`
	// subscribe_all subscribes to all events regardless of topic
	SubscribeAll bool `protobuf:"varint,2,opt,name=subscribe_all,json=subscribeAll,proto3" json:"subscribe_all,omitempty"`
	// plugin_id identifies the subscribing plugin (for tracking/logging)
	PluginId string `protobuf:"bytes,3,opt,name=plugin_id,json=pluginId,proto3" json:"plugin_id,omitempty"`
	// contains filtered or unexported fields
}

SubscribeRequest is sent by a plugin to subscribe to events

func (*SubscribeRequest) Descriptor deprecated

func (*SubscribeRequest) Descriptor() ([]byte, []int)

Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead.

func (*SubscribeRequest) GetPluginId

func (x *SubscribeRequest) GetPluginId() string

func (*SubscribeRequest) GetSubscribeAll

func (x *SubscribeRequest) GetSubscribeAll() bool

func (*SubscribeRequest) GetTopic

func (x *SubscribeRequest) GetTopic() string

func (*SubscribeRequest) ProtoMessage

func (*SubscribeRequest) ProtoMessage()

func (*SubscribeRequest) ProtoReflect

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

func (*SubscribeRequest) Reset

func (x *SubscribeRequest) Reset()

func (*SubscribeRequest) String

func (x *SubscribeRequest) String() string

type UnimplementedPluginEventServiceServer

type UnimplementedPluginEventServiceServer struct{}

UnimplementedPluginEventServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedPluginEventServiceServer) Publish

func (UnimplementedPluginEventServiceServer) Subscribe

func (UnimplementedPluginEventServiceServer) Unsubscribe

type UnsafePluginEventServiceServer

type UnsafePluginEventServiceServer interface {
	// contains filtered or unexported methods
}

UnsafePluginEventServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PluginEventServiceServer will result in compilation errors.

type UnsubscribeRequest

type UnsubscribeRequest struct {

	// subscription_id is the ID returned from Subscribe (client-generated)
	SubscriptionId string `protobuf:"bytes,1,opt,name=subscription_id,json=subscriptionId,proto3" json:"subscription_id,omitempty"`
	// contains filtered or unexported fields
}

UnsubscribeRequest is sent to remove a subscription

func (*UnsubscribeRequest) Descriptor deprecated

func (*UnsubscribeRequest) Descriptor() ([]byte, []int)

Deprecated: Use UnsubscribeRequest.ProtoReflect.Descriptor instead.

func (*UnsubscribeRequest) GetSubscriptionId

func (x *UnsubscribeRequest) GetSubscriptionId() string

func (*UnsubscribeRequest) ProtoMessage

func (*UnsubscribeRequest) ProtoMessage()

func (*UnsubscribeRequest) ProtoReflect

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

func (*UnsubscribeRequest) Reset

func (x *UnsubscribeRequest) Reset()

func (*UnsubscribeRequest) String

func (x *UnsubscribeRequest) String() string

type UnsubscribeResponse

type UnsubscribeResponse struct {

	// success indicates whether the unsubscribe was successful
	Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
	// error_message contains the error description if success is false
	ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
	// contains filtered or unexported fields
}

UnsubscribeResponse is returned after unsubscribing

func (*UnsubscribeResponse) Descriptor deprecated

func (*UnsubscribeResponse) Descriptor() ([]byte, []int)

Deprecated: Use UnsubscribeResponse.ProtoReflect.Descriptor instead.

func (*UnsubscribeResponse) GetErrorMessage

func (x *UnsubscribeResponse) GetErrorMessage() string

func (*UnsubscribeResponse) GetSuccess

func (x *UnsubscribeResponse) GetSuccess() bool

func (*UnsubscribeResponse) ProtoMessage

func (*UnsubscribeResponse) ProtoMessage()

func (*UnsubscribeResponse) ProtoReflect

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

func (*UnsubscribeResponse) Reset

func (x *UnsubscribeResponse) Reset()

func (*UnsubscribeResponse) String

func (x *UnsubscribeResponse) String() string

Jump to

Keyboard shortcuts

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