internal

package
v0.4.159 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package internal is a work in progress. It is planned to accomodate modules such as db and models.

Index

Constants

This section is empty.

Variables

View Source
var (
	ShutdownChan chan os.Signal
)
View Source
var UpgradeConnection = websocket.Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
	CheckOrigin:     func(r *http.Request) bool { return true },
}

UpgradeConnection is generic protocol upgrader for entire DMS.

Functions

func HandleWebSocket

func HandleWebSocket(c *gin.Context)

HandleWebSocket godoc

@Summary		Sends a command to specific node and prints back response.
@Description	Sends a command to specific node and prints back response.
@Tags			peers
@Success		200
@Router			/peers/ws [get]

func ListenForWs

func ListenForWs(conn *WebSocketConnection)

ListenForWs listens to the connected client for any message. It is assumed that every message that is coming is a command to be executed.

func SendCommandForExecution

func SendCommandForExecution()

SendCommandForExecution work is to send command for execution and fetch the result This function listens for new commands from commandChan

Types

type Command

type Command struct {
	Command string
	NodeID  string // ID of the node where command will be executed
	Result  string
	Conn    *WebSocketConnection
}

Command represents a command to be executed

type WebSocketConnection

type WebSocketConnection struct {
	*websocket.Conn
}

WebSocketConnection is pointer to gorilla/websocket.Conn

Directories

Path Synopsis
Package messaging contains logic to listen to queues/channels spread over the application.
Package messaging contains logic to listen to queues/channels spread over the application.

Jump to

Keyboard shortcuts

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