Documentation
¶
Index ¶
- type Options
- type RunmeHandler
- type Runner
- type Server
- type SocketMessageProcessor
- func (p *SocketMessageProcessor) Context() context.Context
- func (p *SocketMessageProcessor) Recv() (*v2.ExecuteRequest, error)
- func (p *SocketMessageProcessor) RecvMsg(m any) error
- func (p *SocketMessageProcessor) Send(res *v2.ExecuteResponse) error
- func (p *SocketMessageProcessor) SendHeader(md metadata.MD) error
- func (p *SocketMessageProcessor) SendMsg(m any) error
- func (p *SocketMessageProcessor) SetHeader(md metadata.MD) error
- func (p *SocketMessageProcessor) SetTrailer(md metadata.MD)
- type WebSocketHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
Telemetry *config.TelemetryConfig
Server *config.AssistantServerConfig
}
type RunmeHandler ¶
type RunmeHandler struct {
Ctx context.Context
Conn *websocket.Conn
Runner *Runner
// contains filtered or unexported fields
}
RunmeHandler is a processor for messages received over a websocket from a single RunmeConsole element in the DOM.
There is one instance of this struct per websocket connection; i.e. each instance handles a single websocket connection. There is also 1 websocket connection per RunmeConsole element (block) in the UI. So this RunmeHandler is only handling one UI block. However, multiple commands can be sent over the websocket connection. Right now we only support non-interactive commands. So the protocol is client sends a single ExecuteRequest and then the server responds with multiple ExecuteResponses. The runnerv2service.Execute method is invoked once per ExecuteRequest; it will terminate when execution finishes. However, the UI could send additional ExecuteRequests over the same websocket connection. These could be a stop/terminate message to indicate we should abort a long running command.
However, we should also be robust to the case where the UI erroneously sends a new request before the current one has finished.
func NewRunmeHandler ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner lets you run commands using Runme.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the main server for the cloud assistant
type SocketMessageProcessor ¶
type SocketMessageProcessor struct {
Ctx context.Context
Conn *websocket.Conn
ExecuteRequests chan *v2.ExecuteRequest
ExecuteResponses chan *v2.ExecuteResponse
// StopReading is used to signal to the readMessages goroutine that it should stop reading messages
StopReading chan bool
Runner *Runner
}
func NewSocketMessageProcessor ¶
func NewSocketMessageProcessor(ctx context.Context) *SocketMessageProcessor
func (*SocketMessageProcessor) Context ¶
func (p *SocketMessageProcessor) Context() context.Context
func (*SocketMessageProcessor) Recv ¶
func (p *SocketMessageProcessor) Recv() (*v2.ExecuteRequest, error)
func (*SocketMessageProcessor) RecvMsg ¶
func (p *SocketMessageProcessor) RecvMsg(m any) error
func (*SocketMessageProcessor) Send ¶
func (p *SocketMessageProcessor) Send(res *v2.ExecuteResponse) error
Send sends a response message to the client. The server handler may call Send multiple times to send multiple messages to the client. An error is returned if the stream was terminated unexpectedly, and the handler method should return, as the stream is no longer usable.
func (*SocketMessageProcessor) SendHeader ¶
func (p *SocketMessageProcessor) SendHeader(md metadata.MD) error
func (*SocketMessageProcessor) SendMsg ¶
func (p *SocketMessageProcessor) SendMsg(m any) error
func (*SocketMessageProcessor) SetHeader ¶
func (p *SocketMessageProcessor) SetHeader(md metadata.MD) error
func (*SocketMessageProcessor) SetTrailer ¶
func (p *SocketMessageProcessor) SetTrailer(md metadata.MD)
type WebSocketHandler ¶
type WebSocketHandler struct {
// contains filtered or unexported fields
}
WebSocketHandler is a handler for websockets.
func (*WebSocketHandler) Handler ¶
func (h *WebSocketHandler) Handler(w http.ResponseWriter, r *http.Request)