ipc

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QuitCommand = []byte{255, 255, 255, 255}

Functions

This section is empty.

Types

type Conn

type Conn struct {
	io.Writer
	io.Reader
	Hash hash.Hash64
	Name string
}

func NewConn

func NewConn(name string, in io.Reader, out io.Writer) (c Conn, err error)

func (*Conn) Close

func (c *Conn) Close() (err error)

Close signals the worker process to shut down and closes its tty connection

func (*Conn) Read

func (c *Conn) Read(p []byte) (n int, err error)

Read scans the input for a new message. First 4 bytes are the payload size in uint32 littleendian, second 8 bytes are a highwayhash64 hash of the payload and in the return the decoded length from the header of the incoming bytes which matches the hash, expected message length, or errors are returned. the input byte slice must be truncated to the given n or it isn't guaranteed to be correct data

func (*Conn) Write

func (c *Conn) Write(p []byte) (n int, err error)

Write sends a message over the IPC pipe containing 32 bit length, 64 bit highway hash and the payload

type Controller

type Controller struct {
	*exec.Cmd
	Conn
}

func NewController

func NewController(args []string) (c *Controller, err error)

A controller runs a child process and attaches to its stdin/out append(os.Args[:len(os.Args)-1], "worker")

type Worker

type Worker struct {
	Conn
}

func NewWorker

func NewWorker() (w *Worker, err error)

Jump to

Keyboard shortcuts

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