Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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.