ipc

package
v0.0.0-...-b6fc690 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package ipc provides server and client types for inter-process communications.

Index

Constants

This section is empty.

Variables

View Source
var (
	// expose internal errors for outside inspection
	ErrInUse    = flisten.ErrInUse
	ErrConnLost = flisten.ErrConnLost
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(n *SockPath) *Client

func (*Client) PingServer

func (c *Client) PingServer(ctx context.Context) (time.Duration, error)

func (*Client) Request

func (c *Client) Request(ctx context.Context, key string) (string, error)

func (*Client) SockPath

func (c *Client) SockPath() *SockPath

func (*Client) StopServer

func (c *Client) StopServer(ctx context.Context) error

type RequestHandler

type RequestHandler func(key string) (resp string, isMatched bool)

RequestHandler describes a function that receives a key which is used to verify if the handler is useful for a given request. If it is useful, the remainder of the function is used for some special behavior (usually, to simply return some value). This enables dynamic construction of IPC Server handlers/endpoints.

type Server

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

func NewServer

func NewServer(topCtx context.Context, spath *SockPath, reqHandlers ...RequestHandler) *Server

NewServer constructs a reference to a Server instance which can be populated with called-defined handlers, and is preconfigured with ping and stop handlers as a low-level flexibility.

func (*Server) Shutdown

func (ipc *Server) Shutdown()

func (*Server) Start

func (ipc *Server) Start() error

func (*Server) Wait

func (ipc *Server) Wait() error

type ServerDownError

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

func NewServerDownError

func NewServerDownError(err error) *ServerDownError

func (*ServerDownError) Error

func (e *ServerDownError) Error() string

func (*ServerDownError) Unwrap

func (e *ServerDownError) Unwrap() error

type SockPath

type SockPath = sockpath.SockPath

Directories

Path Synopsis
internal
flisten
Package flisten provides a type that manages a file-based unix domain socket.
Package flisten provides a type that manages a file-based unix domain socket.

Jump to

Keyboard shortcuts

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