Documentation
¶
Overview ¶
Package proto provides functions for marshaling and unmarshaling messages and generating NATS subjects for communication.
Index ¶
- Variables
- func Marshal(data any) ([]byte, error)
- func ReplyMessageSubject(agentID, msgID string) string
- func StartWorkerSubject(agentID, workerID string) string
- func StopWorkerSubject(agentID, workerID string) string
- func Unmarshal(b []byte) (any, error)
- func UpdateClientInfoSubject(agentID string) string
- func UpdateWorkerStatusSubject(agentID, workerID string) string
- func WriteWorkerStdinSubject(agentID, workerID string) string
- func WriteWorkerStdoutSubject(agentID, workerID string) string
- type StartWorkerRequest
- type StartWorkerResponse
- type StopWorkerRequest
- type StopWorkerResponse
- type UpdateClientInfo
- type UpdateWorkerStatus
- type UpdateWorkerStdio
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnknownMessage = errors.New("unknown message")
)
Functions ¶
func Marshal ¶ added in v0.4.0
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
ReplyMessageSubject returns the NATS subject for replying to a message.
func StartWorkerSubject ¶ added in v0.4.0
StartWorkerSubject returns the NATS subject for starting a worker.
func StopWorkerSubject ¶ added in v0.4.0
StopWorkerSubject returns the NATS subject for stopping a worker.
func Unmarshal ¶ added in v0.4.0
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
UpdateClientInfoSubject returns the NATS subject for updating client information.
func UpdateWorkerStatusSubject ¶ added in v0.4.0
UpdateWorkerStatusSubject returns the NATS subject for updating a worker's status.
func WriteWorkerStdinSubject ¶ added in v0.4.0
WriteWorkerStdinSubject returns the NATS subject for writing to a worker's stdin.
func WriteWorkerStdoutSubject ¶ added in v0.4.0
WriteWorkerStdoutSubject returns the NATS subject for a worker's stdout stream.
Types ¶
type StartWorkerRequest ¶ added in v0.4.0
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
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.