handlerrpc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MessageType_name = map[int32]string{
		0: "Draw",
		1: "Handle",
		2: "Close",
		3: "Cursor",
		4: "Selection",
		5: "Dimensions",
		6: "Resize",
		7: "Request",
		9: "Response",
	}
	MessageType_value = map[string]int32{
		"Draw":       0,
		"Handle":     1,
		"Close":      2,
		"Cursor":     3,
		"Selection":  4,
		"Dimensions": 5,
		"Resize":     6,
		"Request":    7,
		"Response":   9,
	}
)

Enum value maps for MessageType.

View Source
var File_handlerrpc_handler_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type CloseStreamRequest

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

func (*CloseStreamRequest) Descriptor deprecated

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

Deprecated: Use CloseStreamRequest.ProtoReflect.Descriptor instead.

func (*CloseStreamRequest) ProtoMessage

func (*CloseStreamRequest) ProtoMessage()

func (*CloseStreamRequest) ProtoReflect

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

func (*CloseStreamRequest) Reset

func (x *CloseStreamRequest) Reset()

func (*CloseStreamRequest) String

func (x *CloseStreamRequest) String() string

type CloseStreamResponse

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

func (*CloseStreamResponse) Descriptor deprecated

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

Deprecated: Use CloseStreamResponse.ProtoReflect.Descriptor instead.

func (*CloseStreamResponse) ProtoMessage

func (*CloseStreamResponse) ProtoMessage()

func (*CloseStreamResponse) ProtoReflect

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

func (*CloseStreamResponse) Reset

func (x *CloseStreamResponse) Reset()

func (*CloseStreamResponse) String

func (x *CloseStreamResponse) String() string

type CursorStreamRequest

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

func (*CursorStreamRequest) Descriptor deprecated

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

Deprecated: Use CursorStreamRequest.ProtoReflect.Descriptor instead.

func (*CursorStreamRequest) ProtoMessage

func (*CursorStreamRequest) ProtoMessage()

func (*CursorStreamRequest) ProtoReflect

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

func (*CursorStreamRequest) Reset

func (x *CursorStreamRequest) Reset()

func (*CursorStreamRequest) String

func (x *CursorStreamRequest) String() string

type CursorStreamResponse

type CursorStreamResponse struct {
	Position *termrpc.Coordinates `protobuf:"bytes,1,opt,name=position,proto3" json:"position,omitempty"`
	Show     bool                 `protobuf:"varint,2,opt,name=show,proto3" json:"show,omitempty"`
	Style    int32                `protobuf:"varint,3,opt,name=style,proto3" json:"style,omitempty"`
	// contains filtered or unexported fields
}

func (*CursorStreamResponse) Descriptor deprecated

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

Deprecated: Use CursorStreamResponse.ProtoReflect.Descriptor instead.

func (*CursorStreamResponse) GetPosition

func (x *CursorStreamResponse) GetPosition() *termrpc.Coordinates

func (*CursorStreamResponse) GetShow

func (x *CursorStreamResponse) GetShow() bool

func (*CursorStreamResponse) GetStyle

func (x *CursorStreamResponse) GetStyle() int32

func (*CursorStreamResponse) ProtoMessage

func (*CursorStreamResponse) ProtoMessage()

func (*CursorStreamResponse) ProtoReflect

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

func (*CursorStreamResponse) Reset

func (x *CursorStreamResponse) Reset()

func (*CursorStreamResponse) String

func (x *CursorStreamResponse) String() string

type DimensionsStreamRequest

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

func (*DimensionsStreamRequest) Descriptor deprecated

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

Deprecated: Use DimensionsStreamRequest.ProtoReflect.Descriptor instead.

func (*DimensionsStreamRequest) ProtoMessage

func (*DimensionsStreamRequest) ProtoMessage()

func (*DimensionsStreamRequest) ProtoReflect

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

func (*DimensionsStreamRequest) Reset

func (x *DimensionsStreamRequest) Reset()

func (*DimensionsStreamRequest) String

func (x *DimensionsStreamRequest) String() string

type DimensionsStreamResponse

type DimensionsStreamResponse struct {
	Width  int32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
	Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// contains filtered or unexported fields
}

func (*DimensionsStreamResponse) Descriptor deprecated

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

Deprecated: Use DimensionsStreamResponse.ProtoReflect.Descriptor instead.

func (*DimensionsStreamResponse) GetHeight

func (x *DimensionsStreamResponse) GetHeight() int32

func (*DimensionsStreamResponse) GetWidth

func (x *DimensionsStreamResponse) GetWidth() int32

func (*DimensionsStreamResponse) ProtoMessage

func (*DimensionsStreamResponse) ProtoMessage()

func (*DimensionsStreamResponse) ProtoReflect

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

func (*DimensionsStreamResponse) Reset

func (x *DimensionsStreamResponse) Reset()

func (*DimensionsStreamResponse) String

func (x *DimensionsStreamResponse) String() string

type DrawStreamRequest

type DrawStreamRequest struct {
	Width  int32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
	Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// packed_ok signals that the caller can decode a PackedCells frame.
	PackedOk bool `protobuf:"varint,3,opt,name=packed_ok,json=packedOk,proto3" json:"packed_ok,omitempty"`
	// contains filtered or unexported fields
}

func (*DrawStreamRequest) Descriptor deprecated

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

Deprecated: Use DrawStreamRequest.ProtoReflect.Descriptor instead.

func (*DrawStreamRequest) GetHeight

func (x *DrawStreamRequest) GetHeight() int32

func (*DrawStreamRequest) GetPackedOk added in v0.1.2

func (x *DrawStreamRequest) GetPackedOk() bool

func (*DrawStreamRequest) GetWidth

func (x *DrawStreamRequest) GetWidth() int32

func (*DrawStreamRequest) ProtoMessage

func (*DrawStreamRequest) ProtoMessage()

func (*DrawStreamRequest) ProtoReflect

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

func (*DrawStreamRequest) Reset

func (x *DrawStreamRequest) Reset()

func (*DrawStreamRequest) String

func (x *DrawStreamRequest) String() string

type DrawStreamResponse

type DrawStreamResponse struct {
	Rows      []*termrpc.CellRow            `protobuf:"bytes,1,rep,name=rows,proto3" json:"rows,omitempty"`
	Cursor    *DrawStreamResponse_Cursor    `protobuf:"bytes,2,opt,name=cursor,proto3" json:"cursor,omitempty"`
	Selection *DrawStreamResponse_Selection `protobuf:"bytes,3,opt,name=selection,proto3" json:"selection,omitempty"`
	// packed is set instead of rows when the request set packed_ok.
	Packed *termrpc.PackedCells `protobuf:"bytes,4,opt,name=packed,proto3" json:"packed,omitempty"`
	// contains filtered or unexported fields
}

func NewDrawResponse

func NewDrawResponse(
	ctx context.Context, comp tui.Component, width, height int, packed bool,
) *DrawStreamResponse

NewDrawResponse converts a tui.Component into a DrawResponse. When packed is set, the frame is encoded columnar in DrawStreamResponse.Packed instead of the legacy per-cell DrawStreamResponse.Rows.

func (*DrawStreamResponse) Descriptor deprecated

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

Deprecated: Use DrawStreamResponse.ProtoReflect.Descriptor instead.

func (*DrawStreamResponse) GetCursor

func (*DrawStreamResponse) GetPacked added in v0.1.2

func (x *DrawStreamResponse) GetPacked() *termrpc.PackedCells

func (*DrawStreamResponse) GetRows

func (x *DrawStreamResponse) GetRows() []*termrpc.CellRow

func (*DrawStreamResponse) GetSelection

func (*DrawStreamResponse) ProtoMessage

func (*DrawStreamResponse) ProtoMessage()

func (*DrawStreamResponse) ProtoReflect

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

func (*DrawStreamResponse) Reset

func (x *DrawStreamResponse) Reset()

func (*DrawStreamResponse) String

func (x *DrawStreamResponse) String() string

type DrawStreamResponse_Cursor

type DrawStreamResponse_Cursor struct {
	Position *termrpc.Coordinates `protobuf:"bytes,1,opt,name=position,proto3" json:"position,omitempty"`
	Show     bool                 `protobuf:"varint,2,opt,name=show,proto3" json:"show,omitempty"`
	Style    int32                `protobuf:"varint,3,opt,name=style,proto3" json:"style,omitempty"`
	// contains filtered or unexported fields
}

func (*DrawStreamResponse_Cursor) Descriptor deprecated

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

Deprecated: Use DrawStreamResponse_Cursor.ProtoReflect.Descriptor instead.

func (*DrawStreamResponse_Cursor) GetPosition

func (x *DrawStreamResponse_Cursor) GetPosition() *termrpc.Coordinates

func (*DrawStreamResponse_Cursor) GetShow

func (x *DrawStreamResponse_Cursor) GetShow() bool

func (*DrawStreamResponse_Cursor) GetStyle

func (x *DrawStreamResponse_Cursor) GetStyle() int32

func (*DrawStreamResponse_Cursor) ProtoMessage

func (*DrawStreamResponse_Cursor) ProtoMessage()

func (*DrawStreamResponse_Cursor) ProtoReflect

func (*DrawStreamResponse_Cursor) Reset

func (x *DrawStreamResponse_Cursor) Reset()

func (*DrawStreamResponse_Cursor) String

func (x *DrawStreamResponse_Cursor) String() string

type DrawStreamResponse_Selection

type DrawStreamResponse_Selection struct {
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	Ok   bool   `protobuf:"varint,2,opt,name=ok,proto3" json:"ok,omitempty"`
	// contains filtered or unexported fields
}

func (*DrawStreamResponse_Selection) Descriptor deprecated

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

Deprecated: Use DrawStreamResponse_Selection.ProtoReflect.Descriptor instead.

func (*DrawStreamResponse_Selection) GetOk

func (*DrawStreamResponse_Selection) GetText

func (x *DrawStreamResponse_Selection) GetText() string

func (*DrawStreamResponse_Selection) ProtoMessage

func (*DrawStreamResponse_Selection) ProtoMessage()

func (*DrawStreamResponse_Selection) ProtoReflect

func (*DrawStreamResponse_Selection) Reset

func (x *DrawStreamResponse_Selection) Reset()

func (*DrawStreamResponse_Selection) String

type HandleStreamRequest

type HandleStreamRequest struct {
	Event *termrpc.Event `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
	// contains filtered or unexported fields
}

func (*HandleStreamRequest) Descriptor deprecated

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

Deprecated: Use HandleStreamRequest.ProtoReflect.Descriptor instead.

func (*HandleStreamRequest) GetEvent

func (x *HandleStreamRequest) GetEvent() *termrpc.Event

func (*HandleStreamRequest) ProtoMessage

func (*HandleStreamRequest) ProtoMessage()

func (*HandleStreamRequest) ProtoReflect

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

func (*HandleStreamRequest) Reset

func (x *HandleStreamRequest) Reset()

func (*HandleStreamRequest) String

func (x *HandleStreamRequest) String() string

type HandleStreamResponse

type HandleStreamResponse struct {
	Handled bool           `protobuf:"varint,1,opt,name=handled,proto3" json:"handled,omitempty"`
	Quit    bool           `protobuf:"varint,2,opt,name=quit,proto3" json:"quit,omitempty"`
	Request *termrpc.Event `protobuf:"bytes,3,opt,name=request,proto3" json:"request,omitempty"`
	// contains filtered or unexported fields
}

func (*HandleStreamResponse) Descriptor deprecated

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

Deprecated: Use HandleStreamResponse.ProtoReflect.Descriptor instead.

func (*HandleStreamResponse) GetHandled

func (x *HandleStreamResponse) GetHandled() bool

func (*HandleStreamResponse) GetQuit

func (x *HandleStreamResponse) GetQuit() bool

func (*HandleStreamResponse) GetRequest

func (x *HandleStreamResponse) GetRequest() *termrpc.Event

func (*HandleStreamResponse) ProtoMessage

func (*HandleStreamResponse) ProtoMessage()

func (*HandleStreamResponse) ProtoReflect

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

func (*HandleStreamResponse) Reset

func (x *HandleStreamResponse) Reset()

func (*HandleStreamResponse) String

func (x *HandleStreamResponse) String() string

type Handler

type Handler interface {
	tui.Handler
	io.Closer
}

Handler adds Close to a floating handler.

type InstallResourceResponse

type InstallResourceResponse struct {
	WindowId uint64 `protobuf:"varint,1,opt,name=window_id,json=windowId,proto3" json:"window_id,omitempty"`
	// contains filtered or unexported fields
}

func (*InstallResourceResponse) Descriptor deprecated

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

Deprecated: Use InstallResourceResponse.ProtoReflect.Descriptor instead.

func (*InstallResourceResponse) GetWindowId

func (x *InstallResourceResponse) GetWindowId() uint64

func (*InstallResourceResponse) ProtoMessage

func (*InstallResourceResponse) ProtoMessage()

func (*InstallResourceResponse) ProtoReflect

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

func (*InstallResourceResponse) Reset

func (x *InstallResourceResponse) Reset()

func (*InstallResourceResponse) String

func (x *InstallResourceResponse) String() string

type MessageType

type MessageType int32
const (
	MessageType_Draw       MessageType = 0
	MessageType_Handle     MessageType = 1
	MessageType_Close      MessageType = 2
	MessageType_Cursor     MessageType = 3
	MessageType_Selection  MessageType = 4
	MessageType_Dimensions MessageType = 5
	MessageType_Resize     MessageType = 6
	MessageType_Request    MessageType = 7
	MessageType_Response   MessageType = 9
)

func (MessageType) Descriptor

func (MessageType) Enum

func (x MessageType) Enum() *MessageType

func (MessageType) EnumDescriptor deprecated

func (MessageType) EnumDescriptor() ([]byte, []int)

Deprecated: Use MessageType.Descriptor instead.

func (MessageType) Number

func (x MessageType) Number() protoreflect.EnumNumber

func (MessageType) String

func (x MessageType) String() string

func (MessageType) Type

type ResizeStreamRequest

type ResizeStreamRequest struct {
	Width  int32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
	Height int32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// contains filtered or unexported fields
}

func (*ResizeStreamRequest) Descriptor deprecated

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

Deprecated: Use ResizeStreamRequest.ProtoReflect.Descriptor instead.

func (*ResizeStreamRequest) GetHeight

func (x *ResizeStreamRequest) GetHeight() int32

func (*ResizeStreamRequest) GetWidth

func (x *ResizeStreamRequest) GetWidth() int32

func (*ResizeStreamRequest) ProtoMessage

func (*ResizeStreamRequest) ProtoMessage()

func (*ResizeStreamRequest) ProtoReflect

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

func (*ResizeStreamRequest) Reset

func (x *ResizeStreamRequest) Reset()

func (*ResizeStreamRequest) String

func (x *ResizeStreamRequest) String() string

type SelectionStreamRequest

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

func (*SelectionStreamRequest) Descriptor deprecated

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

Deprecated: Use SelectionStreamRequest.ProtoReflect.Descriptor instead.

func (*SelectionStreamRequest) ProtoMessage

func (*SelectionStreamRequest) ProtoMessage()

func (*SelectionStreamRequest) ProtoReflect

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

func (*SelectionStreamRequest) Reset

func (x *SelectionStreamRequest) Reset()

func (*SelectionStreamRequest) String

func (x *SelectionStreamRequest) String() string

type SelectionStreamResponse

type SelectionStreamResponse struct {
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	Ok   bool   `protobuf:"varint,2,opt,name=ok,proto3" json:"ok,omitempty"`
	// contains filtered or unexported fields
}

func (*SelectionStreamResponse) Descriptor deprecated

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

Deprecated: Use SelectionStreamResponse.ProtoReflect.Descriptor instead.

func (*SelectionStreamResponse) GetOk

func (x *SelectionStreamResponse) GetOk() bool

func (*SelectionStreamResponse) GetText

func (x *SelectionStreamResponse) GetText() string

func (*SelectionStreamResponse) ProtoMessage

func (*SelectionStreamResponse) ProtoMessage()

func (*SelectionStreamResponse) ProtoReflect

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

func (*SelectionStreamResponse) Reset

func (x *SelectionStreamResponse) Reset()

func (*SelectionStreamResponse) String

func (x *SelectionStreamResponse) String() string

type ServerMessage

type ServerMessage struct {
	Type       MessageType              `protobuf:"varint,1,opt,name=type,proto3,enum=handler.MessageType" json:"type,omitempty"`
	Draw       *DrawStreamRequest       `protobuf:"bytes,2,opt,name=draw,proto3" json:"draw,omitempty"`
	Handle     *HandleStreamRequest     `protobuf:"bytes,3,opt,name=handle,proto3" json:"handle,omitempty"`
	Close      *CloseStreamRequest      `protobuf:"bytes,4,opt,name=close,proto3" json:"close,omitempty"`
	Cursor     *CursorStreamRequest     `protobuf:"bytes,5,opt,name=cursor,proto3" json:"cursor,omitempty"`
	Selection  *SelectionStreamRequest  `protobuf:"bytes,6,opt,name=selection,proto3" json:"selection,omitempty"`
	Dimensions *DimensionsStreamRequest `protobuf:"bytes,7,opt,name=dimensions,proto3" json:"dimensions,omitempty"`
	Resize     *ResizeStreamRequest     `protobuf:"bytes,8,opt,name=resize,proto3" json:"resize,omitempty"`
	Response   *InstallResourceResponse `protobuf:"bytes,9,opt,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*ServerMessage) Descriptor deprecated

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

Deprecated: Use ServerMessage.ProtoReflect.Descriptor instead.

func (*ServerMessage) GetClose

func (x *ServerMessage) GetClose() *CloseStreamRequest

func (*ServerMessage) GetCursor

func (x *ServerMessage) GetCursor() *CursorStreamRequest

func (*ServerMessage) GetDimensions

func (x *ServerMessage) GetDimensions() *DimensionsStreamRequest

func (*ServerMessage) GetDraw

func (x *ServerMessage) GetDraw() *DrawStreamRequest

func (*ServerMessage) GetHandle

func (x *ServerMessage) GetHandle() *HandleStreamRequest

func (*ServerMessage) GetResize

func (x *ServerMessage) GetResize() *ResizeStreamRequest

func (*ServerMessage) GetResponse

func (x *ServerMessage) GetResponse() *InstallResourceResponse

func (*ServerMessage) GetSelection

func (x *ServerMessage) GetSelection() *SelectionStreamRequest

func (*ServerMessage) GetType

func (x *ServerMessage) GetType() MessageType

func (*ServerMessage) ProtoMessage

func (*ServerMessage) ProtoMessage()

func (*ServerMessage) ProtoReflect

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

func (*ServerMessage) Reset

func (x *ServerMessage) Reset()

func (*ServerMessage) String

func (x *ServerMessage) String() string

type ServerStream

type ServerStream[T StreamMessage] struct {
	// contains filtered or unexported fields
}

ServerStream implements a tui.Handler (+handler.Floating) server over a grpc.ClientStream.

func NewServerStream

func NewServerStream[T StreamMessage](
	stream grpc.ClientStream, handler Handler,
	newT func() T,
) *ServerStream[T]

NewServerStream allocates storage for a new Handler server and initializes it with the given grpc stream, windowID and type parameter constructor.

func (*ServerStream[T]) ReceiveMessages

func (c *ServerStream[T]) ReceiveMessages()

ReceiveMessages receives messages over the grpc stream and responds accordingly.

type StreamMessage

type StreamMessage interface {
	ProtoMessage()

	GetType() MessageType
	GetDraw() *DrawStreamResponse
	GetHandle() *HandleStreamResponse
	GetClose() *CloseStreamResponse
	GetCursor() *CursorStreamResponse
	GetSelection() *SelectionStreamResponse
	GetDimensions() *DimensionsStreamResponse

	SetDraw(*DrawStreamResponse)
	SetHandle(*HandleStreamResponse)
	SetClose(*CloseStreamResponse)
	SetCursor(*CursorStreamResponse)
	SetSelection(*SelectionStreamResponse)
	SetDimensions(*DimensionsStreamResponse)
}

StreamMessage abstracts a generated protobuf message to enable generic usage of ServerStream and ClientStream.

All the getters can be automatically generated by importing the following types and adding them as fields:

message MyMessage {
  handler.MessageType type = ?;
  handler.DrawStreamResponse draw = ?;
  handler.HandleStreamResponse handle = ?;
  handler.CloseStreamResponse close = ?;
  handler.CursorStreamResponse cursor = ?;
  handler.SelectionStreamResponse selection = ?;
  handler.DimensionsStreamResponse dimensions = ?;
  handler.ResizeStreamResponse resize = ?;

The setters must be added manually.

Jump to

Keyboard shortcuts

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