Documentation ¶
Index ¶
- Variables
- func GetMessageHeaderID(m Msg, fieldName string) int
- func SetMessageHeaderID(m Msg, fieldName string, id int)
- type AckMsg
- type BreakCommandRequestMsg
- type CommandStatus
- type Conn
- type DeployFileFromS3RequestMsg
- type DeployFileFromS3ResponseMsg
- type DeployFileRequestMsg
- type DeployFileResponseMsg
- type DestroyEnvironmentMsg
- type ErrorMsg
- type ExecuteCommandRequestMsg
- type ExecuteCommandResponseMsg
- type ExecuteCommandStatusMsg
- type HelloMsg
- type HelloResponseMsg
- type Listener
- type MessageType
- type Msg
- type MsgHeader
- type PingMsg
- type PrepareEnvironmentReplyMsg
- type PrepareEnvironmentRequestMsg
- type RenameFileRequestMsg
- type RenameFileResponseMsg
- type TerminateCommandRequestMsg
- type UpdateSystemInfoMsg
- type UploadFileToS3RequestMsg
- type UploadFileToS3ResponseMsg
Constants ¶
This section is empty.
Variables ¶
var MessageTypeToTypeMap = map[MessageType]reflect.Type{}
MessageTypeToTypeMap is the reverse of TypeToMessageTypeMap to translate in reverse, and is generated at runtime from the TypeToMessageTypeMap
var TypeToMessageTypeMap = map[reflect.Type]MessageType{ reflect.TypeOf(&HelloMsg{}): MessageType(1), reflect.TypeOf(&AckMsg{}): MessageType(2), reflect.TypeOf(&ErrorMsg{}): MessageType(3), reflect.TypeOf(&PrepareEnvironmentRequestMsg{}): MessageType(4), reflect.TypeOf(&PrepareEnvironmentReplyMsg{}): MessageType(5), reflect.TypeOf(&DestroyEnvironmentMsg{}): MessageType(6), reflect.TypeOf(&DeployFileRequestMsg{}): MessageType(7), reflect.TypeOf(&DeployFileResponseMsg{}): MessageType(8), reflect.TypeOf(&ExecuteCommandRequestMsg{}): MessageType(9), reflect.TypeOf(&ExecuteCommandResponseMsg{}): MessageType(10), reflect.TypeOf(&ExecuteCommandStatusMsg{}): MessageType(11), reflect.TypeOf(&UpdateSystemInfoMsg{}): MessageType(12), reflect.TypeOf(&PingMsg{}): MessageType(13), reflect.TypeOf(&BreakCommandRequestMsg{}): MessageType(15), reflect.TypeOf(&TerminateCommandRequestMsg{}): MessageType(16), reflect.TypeOf(&HelloResponseMsg{}): MessageType(19), reflect.TypeOf(&DeployFileFromS3RequestMsg{}): MessageType(20), reflect.TypeOf(&DeployFileFromS3ResponseMsg{}): MessageType(21), reflect.TypeOf(&RenameFileRequestMsg{}): MessageType(22), reflect.TypeOf(&RenameFileResponseMsg{}): MessageType(23), reflect.TypeOf(&UploadFileToS3RequestMsg{}): MessageType(24), reflect.TypeOf(&UploadFileToS3ResponseMsg{}): MessageType(25), }
TypeToMessageTypeMap helps translate from type (reflect.Type) to MessageType (int16)
Functions ¶
func GetMessageHeaderID ¶
GetMessageHeaderID returns the message ID in the header, if the underlying type has a header and a value for the message ID. If it doesn't have a header , or the ID is not set, this method will return 0
func SetMessageHeaderID ¶
SetMessageHeaderID uses reflection to set the message ID in the header, regardless of the underlying type of message. If the underlying type does not have a header, nothing happens
Types ¶
type AckMsg ¶
type AckMsg struct {
Header MsgHeader
}
AckMsg can be sent from agent to controller or vice versa to indicate the message was received in scenarios where there is no information needed in the return path
type BreakCommandRequestMsg ¶
type BreakCommandRequestMsg struct { Header MsgHeader // The ID of the command to send an os.Interrupt signal to CommandID []byte }
BreakCommandRequestMsg is sent from the controller to the agent to have it send an os.Interrupt signal to a running command identified by CommandID. The agent will respond with an AckMsg or ErrorMsg
type CommandStatus ¶
type CommandStatus int8
CommandStatus is an enumeration of the status in which commands can be
const ( // The command has yielded an error CommandStatusError CommandStatus = -1 // There is no status known yet CommandStatusUnknown CommandStatus = 0 // The command is pending startup CommandStatusPending CommandStatus = 1 // The command is running CommandStatusRunning CommandStatus = 2 // The command completed running CommandStatusFinished CommandStatus = 3 )
type Conn ¶
type Conn struct { Tag string // contains filtered or unexported fields }
Conn describes a connection between agent and coordinator
func NewClient ¶
NewClient will open a TCP connection to the given host and port and return an instance of Conn for the connection that's open
func (*Conn) Recv ¶
Recv will try to read a Msg from the wire connection or return an error if it is unable to do so. The method call will block until either a message or error is available
func (*Conn) SetMessageID ¶
SetMessageID uses an atomic message ID counter kept in the connection to assign a sequential message ID to the instance of a Msg, which is required to have a MsgHeader
type DeployFileFromS3RequestMsg ¶
type DeployFileFromS3RequestMsg struct { Header MsgHeader EnvironmentID []byte // The target path to download the file to, relative to the environment // folder TargetPath string SourceBucket string SourcePath string // Unpack the file if it is either a TAR or TAR.GZ Unpack bool // Ignore directory information in the archive FlatUnpack bool SourceRegion string // Do not create a folder with the base name of the archive UnpackNoDir bool }
DeployFileFromS3RequestMsg is sent from controller to agent to ask the agent to download a particular object from an S3 bucket and optionally unpack it in the given directory within a certain environment
type DeployFileFromS3ResponseMsg ¶
DeployFileFromS3ResponseMsg is sent from agent to controller to inform the controller about the success state of the deploy request
type DeployFileRequestMsg ¶
type DeployFileRequestMsg struct { Header MsgHeader EnvironmentID []byte File common.File Unpack bool Offset int64 ExpectMore bool FlatUnpack bool }
DeployFileRequestMsg is sent from controller to agent to deploy (smaller) files directly over the wire protocol without first having to upload it to S3. This is specifically used for deploying the configuration files which are a few KB in size
type DeployFileResponseMsg ¶
DeployFileResponseMsg is sent from agent to controller to inform the controller about the success state of the deploy request
type DestroyEnvironmentMsg ¶
DestroyEnvironmentMsg is sent from controller to agent to request it to destroy the contents of a given environment
type ErrorMsg ¶
ErrorMsg can be sent from agent to controller or vice versa to indicate an error occurred while processing the message
type ExecuteCommandRequestMsg ¶
type ExecuteCommandRequestMsg struct { Header MsgHeader // The environment in which to execute the command EnvironmentID []byte // The directory, relative to the environment folder to use as working // folder Dir string // Environment variables to set (on top of the os.Environ) Env []string // The command (executable) to run Command string // The command line parameters to give to the command Parameters []string // Gather performance profiling while the command is running Profile bool // Run the command using `perf` to gather additional performance counters PerfProfile bool // The sample rate when running in perf (PerfProfile = true) PerfSampleRate int // Run in `gdb` Debug bool // The region in which the outputs bucket is S3OutputRegion string // The bucket in which to upload command outputs S3OutputBucket string // Gather bandwidth stats RecordNetworkTraffic bool }
ExecuteCommandRequestMsg is sent from controller to agent to start a process on the agent
type ExecuteCommandResponseMsg ¶
type ExecuteCommandResponseMsg struct { Header MsgHeader // The ID under which the command is running - will also match subsequent // ExecyteCommandStatusMsg messages CommandID []byte // Indicates if the command was started succesfully Success bool // If Success is false, this indicates what went wrong Error string }
ExecuteCommandResponseMsg is sent by the agent to the controller in response to a ExecuteCommandRequestMsg to inform the controller wether the command has been executed succesfully. Note that this does not indicate that the command has finished running - only that it has been started. The agent will continue sending ExecuteCommandStatusMsg updates, which will eventually report the status CommandStatusFinished when the command has finished execution.
type ExecuteCommandStatusMsg ¶
type ExecuteCommandStatusMsg struct { Header MsgHeader // The ID of the command for which an update is sent CommandID []byte // The current status of the command Status CommandStatus // If Status is CommandStatusFinished, this will contain the exit code of // the process ExitCode int }
ExecuteCommandStatusMsg is sent by the agent to the controller to inform it of status changes
type HelloMsg ¶
type HelloMsg struct { Header MsgHeader SystemInfo common.AgentSystemInfo AgentVersion string }
HelloMsg is sent from agent to controller upon first connection. It identifies which version the agent is running and provides the initial system information of the agent
type HelloResponseMsg ¶
HelloResponseMsg is sent from controller to agent in response to HelloMsg and both acknowledges to the agent that the coordinator has accepted the HelloMsg, and tells the agent which AgentID it has on the coordinator
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener describes a server that can accept new connections
type MessageType ¶
type MessageType int16
func GetMessageType ¶
func GetMessageType(m Msg) MessageType
GetMessageType inspects a message to determine its type and returns a MessageType (int16)
type Msg ¶
type Msg interface { }
func NewMessage ¶
func NewMessage(mt MessageType) Msg
NewMessage instantiates a new message of the passed MessageType (int16)
type PingMsg ¶
type PingMsg struct {
Header MsgHeader
}
PingMsg is sent from the controller to the agent, which responds with an AckMsg. This message is used to see if the connection to the agent is still alive, and how long the roundtrip of the message takes
type PrepareEnvironmentReplyMsg ¶
PrepareEnvironmentReplyMsg is sent from agent to controller to confirm the succesful creation of an environment, and to inform the controller about the environment's unique ID under which it can be referenced in future calls that require an environment
type PrepareEnvironmentRequestMsg ¶
type PrepareEnvironmentRequestMsg struct {
Header MsgHeader
}
PrepareEnvironmentRequestMsg is sent from controller to agent to request a fresh environment folder on the agent in which the agent can deploy a binary set and execute a test run
type RenameFileRequestMsg ¶
type RenameFileRequestMsg struct { Header MsgHeader EnvironmentID []byte SourcePath string TargetPath string }
RenameFileRequestMsg is send from controller to agent and used to rename a file on the agent. The agent will respond with an RenameFileResponseMsg. Currently only used for renaming shard preseed files
type RenameFileResponseMsg ¶
RenameFileResponseMsg is sent from agent to controller to communicate the result of a Rename action
type TerminateCommandRequestMsg ¶
type TerminateCommandRequestMsg struct { Header MsgHeader // The ID of the command to send an os.Kill signal to CommandID []byte }
TerminateCommandRequestMsg is sent from the controller to the agent to have it send an os.Kill signal to a running command identified by CommandID. The agent will respond with an AckMsg or ErrorMsg
type UpdateSystemInfoMsg ¶
type UpdateSystemInfoMsg struct { Header MsgHeader SystemInfo common.AgentSystemInfo }
UpdateSystemInfoMsg is sent from the agent to the controller to let the controller know the up-to-date system information of the agent. The controller will respond with an AckMsg
type UploadFileToS3RequestMsg ¶
type UploadFileToS3RequestMsg struct { Header MsgHeader EnvironmentID []byte // The source path, relative to the environment's folder, to upload the file // from SourcePath string TargetBucket string TargetPath string TargetRegion string }
UploadFileToS3RequestMsg is sent from controller to agent to request it to upload a file from its file system to an S3 bucket such that the controller can later retrieve it. The transfer via S3 is much more efficient for many agents transferring files at once (as upposed to bottlenecking the built-in wireprotocol for this data transfer). The client sends a UploadFileToS3ResponseMsg in response to this request
type UploadFileToS3ResponseMsg ¶
UploadFileToS3ResponseMsg is a response to UploadFileToS3RequestMsg to indicate the success or failure of the S3 upload