ipc

package
v0.0.0-...-0798a42 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AercServer

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

func StartServer

func StartServer(handler Handler, startup context.Context) (*AercServer, error)

func (*AercServer) Close

func (as *AercServer) Close()

func (*AercServer) Serve

func (as *AercServer) Serve()

type Handler

type Handler interface {
	Command(args []string) error
}

type Request

type Request struct {
	// Arguments contains the commandline arguments. The detection of what
	// action to take is left to the receiver.
	Arguments []string `json:"arguments"`
}

Request constains all parameters needed for the main instance to respond to a request.

func DecodeMessage

func DecodeMessage(data []byte) (*Request, error)

DecodeMessage consumes a raw message and returns the message contained within.

func DecodeRequest

func DecodeRequest(data []byte) (*Request, error)

DecodeRequest consumes a raw message and returns the message contained within.

func (*Request) Encode

func (msg *Request) Encode() ([]byte, error)

Encode transforms the message in an easier to transfer format

type Response

type Response struct {
	// Error contains the success-state of the command. Error is an empty
	// string if everything ran successfully.
	Error string `json:"error"`
}

Response is used to report the results of a command.

func ConnectAndExec

func ConnectAndExec(args []string) (*Response, error)

func DecodeResponse

func DecodeResponse(data []byte) (*Response, error)

DecodeResponse consumes a raw message and returns the message contained within.

func (*Response) Encode

func (msg *Response) Encode() ([]byte, error)

Encode transforms the message in an easier to transfer format

Jump to

Keyboard shortcuts

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