controls

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2017 License: Apache-2.0 Imports: 5 Imported by: 58

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewPipe = func(c PipeClient, appID string) (string, xfer.Pipe, error) {
	return newPipe(xfer.NewPipe(), c, appID)
}

NewPipe creates a new pipe and connects it to the app.

Functions

func NewPipeFromEnds added in v0.14.0

func NewPipeFromEnds(local, remote io.ReadWriter, c PipeClient, appID string) (string, xfer.Pipe, error)

NewPipeFromEnds creates a new pipe from its ends and connects it to the app.

Types

type HandlerRegistry added in v1.0.0

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

HandlerRegistry uses backend for storing and retrieving control requests handlers.

func NewDefaultHandlerRegistry added in v1.0.0

func NewDefaultHandlerRegistry() *HandlerRegistry

NewDefaultHandlerRegistry creates a registry with a default backend.

func NewHandlerRegistry added in v1.0.0

func NewHandlerRegistry(backend HandlerRegistryBackend) *HandlerRegistry

NewHandlerRegistry creates a registry with a custom backend.

func (*HandlerRegistry) Batch added in v1.0.0

func (r *HandlerRegistry) Batch(toRemove []string, toAdd map[string]xfer.ControlHandlerFunc)

Batch first deletes handlers for given names in toRemove then registers new handlers for given names in toAdd.

func (*HandlerRegistry) HandleControlRequest added in v1.0.0

func (r *HandlerRegistry) HandleControlRequest(req xfer.Request) xfer.Response

HandleControlRequest performs a control request.

func (*HandlerRegistry) Register added in v1.0.0

func (r *HandlerRegistry) Register(control string, f xfer.ControlHandlerFunc)

Register registers a new control handler under a given name.

func (*HandlerRegistry) Rm added in v1.0.0

func (r *HandlerRegistry) Rm(control string)

Rm deletes the handler for a given name.

type HandlerRegistryBackend added in v1.0.0

type HandlerRegistryBackend interface {
	// Lock locks the backend, so the batch insertions or
	// removals can be performed.
	Lock()
	// Unlock unlocks the registry.
	Unlock()
	// Register a new control handler under a given
	// id. Implementations should not call Lock() or Unlock()
	// here, it will be done by HandlerRegistry.
	Register(control string, f xfer.ControlHandlerFunc)
	// Rm deletes the handler for a given name. Implementations
	// should not call Lock() or Unlock() here, it will be done by
	// HandlerRegistry.
	Rm(control string)
	// Handler gets the handler for a control. Implementations
	// should not call Lock() or Unlock() here, it will be done by
	// HandlerRegistry.
	Handler(control string) (xfer.ControlHandlerFunc, bool)
}

HandlerRegistryBackend is an interface for storing control request handlers.

func NewDefaultHandlerRegistryBackend added in v1.0.0

func NewDefaultHandlerRegistryBackend() HandlerRegistryBackend

NewDefaultHandlerRegistryBackend creates a default backend for handler registry.

type PipeClient added in v0.11.0

type PipeClient interface {
	PipeConnection(string, string, xfer.Pipe) error
	PipeClose(string, string) error
}

PipeClient is the type of the thing the probe uses to make pipe connections.

Jump to

Keyboard shortcuts

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