coordinator

package
v0.0.0-...-fa37cd3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package coordinator handles high-level console synchronization for drivers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OBM

type OBM interface {
	// Connect to the console, returning the managing Proc and an
	// error, if any.
	Dial() (Proc, error)
}

A "primitive" OBM, from which the coordinator can build a driver.OBM.

type Proc

type Proc interface {
	// Shutdown disconnects the console session managed by this Proc.
	// If the session is already disconnected, this is a no-op.
	Shutdown() error

	// Reader returns an io.Reader that reads from the console.
	Reader() io.Reader
}

A proc is a live "process" managing a console connection.

type Server

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

An server manages console synchronization for a single OBM. It implements the console related methods of driver.OBM, and may be embedded in another struct which handles the non-console functionality.

The zero value is not meaningful; use NewServer to create a value.

func NewServer

func NewServer(obm OBM) *Server

Create a Server for the given OBM.

func (*Server) DialConsole

func (s *Server) DialConsole() (io.ReadCloser, error)

Connect to the console. This see driver.OBM.DialConsole

func (*Server) DropConsole

func (s *Server) DropConsole() error

Disconnect the current console session. See driver.OBM.DropConsole.

func (*Server) RunInServer

func (s *Server) RunInServer(fn func())

Run `fn` inside the server's main loop. This ensures that no (other) console related functionality is taken by the server while `fn` is running.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context)

Jump to

Keyboard shortcuts

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