ipc

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Check

func Check(err error) bool

func Debug

func Debug(a ...interface{})

func Debugc

func Debugc(fn func() string)

func Debugf

func Debugf(format string, a ...interface{})

func Debugs

func Debugs(a interface{})

func Error

func Error(a ...interface{})

func Errorc

func Errorc(fn func() string)

func Errorf

func Errorf(format string, a ...interface{})

func Errors

func Errors(a interface{})

func Fatal

func Fatal(a ...interface{})

func Fatalc

func Fatalc(fn func() string)

func Fatalf

func Fatalf(format string, a ...interface{})

func Fatals

func Fatals(a interface{})

func Info

func Info(a ...interface{})

func Infoc

func Infoc(fn func() string)

func Infof

func Infof(format string, a ...interface{})

func Infos

func Infos(a interface{})

func Trace

func Trace(a ...interface{})

func Tracec

func Tracec(fn func() string)

func Tracef

func Tracef(format string, a ...interface{})

func Traces

func Traces(a interface{})

func Warn

func Warn(a ...interface{})

func Warnc

func Warnc(fn func() string)

func Warnf

func Warnf(format string, a ...interface{})

func Warns

func Warns(a interface{})

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