wrpc

package
v0.0.0-...-0b38cba Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package wrpc provides a pool of Workers that can run a chain of go functions by being piped into each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(names ...string) (io.Reader, io.WriteCloser)

Call executes functions by chaining them and piping each function's output into the next.

The returned WriteCloser is piped to the first func's Reader and the returned Reader is piped from the last func's Writer.

The returned Reader returns the first error from any function or io.EOF when all functions finish.

func ListenAndServe

func ListenAndServe() error

ListenAndServe runs the server on worker.

func Register

func Register(name string, f HandlerFunc)

Register registers a remote function.

Types

type HandlerFunc

type HandlerFunc func(io.Writer, io.Reader) error

HandlerFunc is a remote function.

type Worker

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

Worker is a Web Worker wrapper.

func NewWorker

func NewWorker(url string) (*Worker, error)

NewWorker spawns a worker.

func (*Worker) Call

func (wk *Worker) Call(w, r *wrpcnet.MessagePort, name string) error

Call synchronously executes a remote call on the worker.

func (*Worker) Close

func (wk *Worker) Close()

Close the worker.

Jump to

Keyboard shortcuts

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