proto

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package proto provides functions for marshaling and unmarshaling messages and generating NATS subjects for communication.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownMessage = errors.New("unknown message")
)

Functions

func Marshal added in v0.4.0

func Marshal(data any) ([]byte, error)

Marshal serializes the given data into a byte slice. It supports various request and response types defined in the proto package.

func ReplyMessageSubject added in v0.4.0

func ReplyMessageSubject(agentID, msgID string) string

ReplyMessageSubject returns the NATS subject for replying to a message.

func StartWorkerSubject added in v0.4.0

func StartWorkerSubject(agentID, workerID string) string

StartWorkerSubject returns the NATS subject for starting a worker.

func StopWorkerSubject added in v0.4.0

func StopWorkerSubject(agentID, workerID string) string

StopWorkerSubject returns the NATS subject for stopping a worker.

func Unmarshal added in v0.4.0

func Unmarshal(b []byte) (any, error)

Unmarshal deserializes the given byte slice into a message object. It returns an interface{} which can be type-asserted to the specific message type.

func UpdateClientInfoSubject added in v0.4.0

func UpdateClientInfoSubject(agentID string) string

UpdateClientInfoSubject returns the NATS subject for updating client information.

func UpdateWorkerStatusSubject added in v0.4.0

func UpdateWorkerStatusSubject(agentID, workerID string) string

UpdateWorkerStatusSubject returns the NATS subject for updating a worker's status.

func WriteWorkerStdinSubject added in v0.4.0

func WriteWorkerStdinSubject(agentID, workerID string) string

WriteWorkerStdinSubject returns the NATS subject for writing to a worker's stdin.

func WriteWorkerStdoutSubject added in v0.4.0

func WriteWorkerStdoutSubject(agentID, workerID string) string

WriteWorkerStdoutSubject returns the NATS subject for a worker's stdout stream.

Types

type StartWorkerRequest added in v0.4.0

type StartWorkerRequest struct {
	Command string
	Args    []string
	Env     []string
}

StartWorkerRequest is a request to start a new worker.

type StartWorkerResponse added in v0.4.0

type StartWorkerResponse struct {
	Error error
}

StartWorkerResponse is a response to a StartWorkerRequest.

type StopWorkerRequest added in v0.4.0

type StopWorkerRequest struct{}

StopWorkerRequest is a request to stop a running worker.

type StopWorkerResponse added in v0.4.0

type StopWorkerResponse struct {
	Error error
}

StopWorkerResponse is a response to a StopWorkerRequest.

type UpdateClientInfo added in v0.4.0

type UpdateClientInfo struct {
	Username string
	Hostname string
	System   string
	Address  string
}

UpdateClientInfo contains information about a client.

type UpdateWorkerStatus added in v0.4.0

type UpdateWorkerStatus struct {
	Status int64
}

UpdateWorkerStatus is used to update the status of a worker.

type UpdateWorkerStdio added in v0.4.0

type UpdateWorkerStdio struct {
	Data []byte
}

UpdateWorkerStdio contains data from a worker's stdout or stdin.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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