Documentation
¶
Index ¶
- Variables
- type Command
- type Error
- type HandlerFunc
- type LockedWriter
- type Message
- type OutgoingMessage
- type Processor
- func (ipc *Processor) Loop()
- func (ipc *Processor) Request(ctx context.Context, cmd Command, reqData any, respData any) error
- func (ipc *Processor) RequestAsync(cmd Command, data any) (<-chan *Message, int, error)
- func (ipc *Processor) Send(cmd Command, data any) error
- func (ipc *Processor) SetHandler(command Command, handler HandlerFunc)
Constants ¶
This section is empty.
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 HandlerFunc ¶
type HandlerFunc func(ctx context.Context, message json.RawMessage) any
func NoDataHandler ¶
func NoDataHandler(fn func(ctx context.Context) any) HandlerFunc
func TypedHandler ¶
func TypedHandler[T any](fn func(ctx context.Context, req T) any) HandlerFunc
type LockedWriter ¶
type LockedWriter struct {
// contains filtered or unexported fields
}
func NewLockedWriter ¶
func NewLockedWriter(wr io.Writer) *LockedWriter
func (*LockedWriter) Encode ¶
func (ls *LockedWriter) Encode(msg any) error
func (*LockedWriter) WriteLevel ¶
type Message ¶
type Message struct { Command Command `json:"command"` ResponseTo Command `json:"response_to,omitempty"` ID int `json:"id,omitempty"` Data json.RawMessage `json:"data,omitempty"` }
type OutgoingMessage ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func (*Processor) RequestAsync ¶
func (*Processor) SetHandler ¶
func (ipc *Processor) SetHandler(command Command, handler HandlerFunc)
Click to show internal directories.
Click to hide internal directories.