Documentation ¶
Overview ¶
Support functions for svarmr
Index ¶
- Variables
- func CliConnect() net.Conn
- func ConnectHub(server, port string) net.Conn
- func Debug(s string)
- func HandleConnection(conn net.Conn, Q chan message)
- func HandleInputLoop(conn net.Conn, callback MessageHandler2)
- func SendMessage(conn net.Conn, m Message)
- func SimpleSend(conn net.Conn, selector, arg string)
- func WireFormat(m Message) string
- type Message
- type MessageHandler
- type MessageHandler2
- type SubProx
Constants ¶
This section is empty.
Variables ¶
var AppDir, SvarmrDir string
Functions ¶
func CliConnect ¶
Read command line options, connect to svarmr server as directed from the command line
Command line must be "program host port" where host and port are the connection details for the svarmr server
func ConnectHub ¶
Connect to a svarmr server on host:port
func HandleConnection ¶
func HandleInputLoop ¶
func HandleInputLoop(conn net.Conn, callback MessageHandler2)
Handle incoming messages. This will read a message, unpack the JSON, and call the MessageHandler with the unpacked message
MessageHandler must look like:
func handleMessage (m svarmrgo.Message) []svarmrgo.Message
We call handleMessage with a message, and it returns an array of svarmrgo.Message We then send all the returned messages
func SendMessage ¶
Send a message. Messages will soon contain unique ID numbers, allowing responses to be matched to messages
If conn is nil, then it will use whatever port the message was received on, the same as RespondMessage
func SimpleSend ¶
func WireFormat ¶
Prepares the wire format version of the message, suitable for printing or sending
Types ¶
type Message ¶
type Message struct { Conn net.Conn Selector string Arg string Args []string NamedArgs map[string]string }
type MessageHandler ¶
type MessageHandler2 ¶
type SubProx ¶
type SubProx struct { In io.WriteCloser Out io.ReadCloser Err io.ReadCloser Cmd *exec.Cmd }