transport

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package transport provides an interface that allows for generic transport layers between gggb and a process

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTransport = errors.New("transport with that name does not exist")

ErrNoTransport indicates that a nonexistent transport was requested

Functions

This section is empty.

Types

type Transport

type Transport interface {
	// GetStatus returns the current state of the transport
	GetStatus() util.TransportStatus

	// GetHumanStatus returns the status of the transport in a human readable form
	GetHumanStatus() string

	// Stdout returns a channel that will have lines from stdout sent over it.
	// multiple calls are not supported. This channel should be closed once the source exits
	Stdout() <-chan []byte

	// Stderr returns a channel that will have lines from stdout sent over it.
	// multiple calls are not supported. This channel should be closed once the source exits
	Stderr() <-chan []byte

	// Update updates the Transport with a TransportConfig
	Update(tomlconf.ConfigHolder) error

	// StopOrKiller is for the Ability to stop the process on the other side of the Transport, as is Runner
	interfaces.StopOrKiller

	// Run runs the underlying process on the Transport. It returns the return code of the process (or -1 if start failed)
	// a string representation of the exit, if applicable, and an error. error should be checked first as the string
	// may not be filled for some errors.
	// The passed channel should be closed when the game is started, to allow the controller to start monitoring stdio.
	// the start chan MUST be closed sometime before run returns
	Run(start chan struct{}) (int, string, error)

	// IsRunning returns whether or not the underlying process is currently running. For more information use GetStatus.
	IsRunning() bool

	// Writer and StringWriter versions of all the write methods, for use with Fprintf etc
	io.Writer
	io.StringWriter
}

Transport is a way for a Game to talk to an underlying Process.

func GetTransport

func GetTransport(name string, transportConfig tomlconf.ConfigHolder, logger *log.Logger) (Transport, error)

GetTransport returns a transport based on the given name.

Directories

Path Synopsis
Package network implements a Transport that works over a socket.
Package network implements a Transport that works over a socket.
prog
Prog is the clientside component of networkTransport.
Prog is the clientside component of networkTransport.
protocol
Package protocol holds structs and other constructs that are used by the network transport for cross-network RPC calls
Package protocol holds structs and other constructs that are used by the network transport for cross-network RPC calls
Package process holds a Transport implementation that runs local, unsandboxed processes
Package process holds a Transport implementation that runs local, unsandboxed processes
Package util contains utilities for use in all transport implementations
Package util contains utilities for use in all transport implementations

Jump to

Keyboard shortcuts

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