ipc

package
v0.0.0-...-e37cea9 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandResponse = "response"
	CommandError    = "error"
)

Variables

View Source
var (
	ErrIPCTimeout        = errors.New("ipc request timeout")
	ErrUnknownCommand    = Error{"unknown-command", "Unknown command"}
	ErrSizeLimitExceeded = Error{Code: "size_limit_exceeded"}
	ErrTimeoutError      = Error{Code: "timeout"}
	ErrUnsupportedError  = Error{Code: "unsupported"}
	ErrNotFound          = Error{Code: "not_found"}
)

Functions

This section is empty.

Types

type Command

type Command string

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

func (Error) Error

func (err Error) Error() string

func (Error) Is

func (err Error) Is(other error) bool

type HandlerFunc

type HandlerFunc func(message json.RawMessage) interface{}

type Message

type Message struct {
	Command Command         `json:"command"`
	ID      int             `json:"id"`
	Data    json.RawMessage `json:"data"`
}

type OutgoingMessage

type OutgoingMessage struct {
	Command Command     `json:"command"`
	ID      int         `json:"id,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

type Processor

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

func NewCustomProcessor

func NewCustomProcessor(output io.Writer, input io.Reader, logger log.Logger, printPayloadContent bool) *Processor

func NewStdioProcessor

func NewStdioProcessor(logger log.Logger, printPayloadContent bool) *Processor

func (*Processor) Loop

func (ipc *Processor) Loop()

func (*Processor) Request

func (ipc *Processor) Request(ctx context.Context, cmd Command, reqData interface{}, respData interface{}) error

func (*Processor) RequestAsync

func (ipc *Processor) RequestAsync(cmd Command, data interface{}) (<-chan *Message, int, error)

func (*Processor) Send

func (ipc *Processor) Send(cmd Command, data interface{}) error

func (*Processor) SetHandler

func (ipc *Processor) SetHandler(command Command, handler HandlerFunc)

Jump to

Keyboard shortcuts

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