Documentation
¶
Index ¶
- Constants
- func FormatMessage(payload interface{}) ([]byte, error)
- func ReadCtlMessage(conn net.Conn) (*hyper.DecodedMessage, error)
- func ReadIoMessageWithConn(conn net.Conn) (*hyper.TtyMessage, error)
- func SendIoMessageWithConn(conn net.Conn, ttyMsg *hyper.TtyMessage) error
- type Hyperstart
- func (h *Hyperstart) CloseSockets() error
- func (h *Hyperstart) IsStarted() bool
- func (h *Hyperstart) OpenSockets() error
- func (h *Hyperstart) ReadIoMessage() (*hyper.TtyMessage, error)
- func (h *Hyperstart) SendCtlMessage(cmd string, data []byte) (*hyper.DecodedMessage, error)
- func (h *Hyperstart) SendIoMessage(ttyMsg *hyper.TtyMessage) error
- func (h *Hyperstart) SetDeadline(t time.Time) error
- func (h *Hyperstart) WaitForPAE(containerID, processID string) (*hyper.ProcessAsyncEvent, error)
- func (h *Hyperstart) WaitForReady() error
- func (h *Hyperstart) WriteCtlMessage(conn net.Conn, m *hyper.DecodedMessage) error
Constants ¶
const ( Version = "version" StartPod = "startpod" DestroyPod = "destroypod" ExecCmd = "execcmd" Ready = "ready" Ack = "ack" Error = "error" WinSize = "winsize" Ping = "ping" FinishPod = "finishpod" Next = "next" WriteFile = "writefile" ReadFile = "readfile" NewContainer = "newcontainer" KillContainer = "killcontainer" RemoveContainer = "removecontainer" OnlineCPUMem = "onlinecpumem" SetupInterface = "setupinterface" SetupRoute = "setuproute" )
Control command IDs Need to be in sync with hyperstart/src/api.h
Variables ¶
This section is empty.
Functions ¶
func FormatMessage ¶
FormatMessage formats hyperstart messages.
func ReadCtlMessage ¶
func ReadCtlMessage(conn net.Conn) (*hyper.DecodedMessage, error)
ReadCtlMessage reads an hyperstart message from conn and returns a decoded message.
This is a low level function, for a full and safe transaction on the hyperstart control serial link, use SendCtlMessage.
func ReadIoMessageWithConn ¶
func ReadIoMessageWithConn(conn net.Conn) (*hyper.TtyMessage, error)
ReadIoMessageWithConn returns data coming from the specified IO channel.
func SendIoMessageWithConn ¶
func SendIoMessageWithConn(conn net.Conn, ttyMsg *hyper.TtyMessage) error
SendIoMessageWithConn sends data to the specified IO channel.
Types ¶
type Hyperstart ¶
type Hyperstart struct {
// contains filtered or unexported fields
}
Hyperstart is the base structure for hyperstart.
func NewHyperstart ¶
func NewHyperstart(ctlSerial, ioSerial, sockType string) *Hyperstart
NewHyperstart returns a new hyperstart structure.
func (*Hyperstart) CloseSockets ¶
func (h *Hyperstart) CloseSockets() error
CloseSockets closes both CTL and IO sockets.
func (*Hyperstart) IsStarted ¶
func (h *Hyperstart) IsStarted() bool
IsStarted returns about connection status.
func (*Hyperstart) OpenSockets ¶
func (h *Hyperstart) OpenSockets() error
OpenSockets opens both CTL and IO sockets.
func (*Hyperstart) ReadIoMessage ¶
func (h *Hyperstart) ReadIoMessage() (*hyper.TtyMessage, error)
ReadIoMessage returns data coming from the IO channel.
func (*Hyperstart) SendCtlMessage ¶
func (h *Hyperstart) SendCtlMessage(cmd string, data []byte) (*hyper.DecodedMessage, error)
SendCtlMessage sends a message to the CTL channel.
This function does a full transaction over the CTL channel: it will rely on the multicaster to register a listener reading over the CTL channel. Then it writes a command and waits for the multicaster to send hyperstart's answer back before it can return. Several concurrent calls to SendCtlMessage are allowed, the function ensuring proper serialization of the communication by making the listener registration and the command writing an atomic operation protected by a mutex. Waiting for the reply from multicaster doesn't need to be protected by this mutex.
func (*Hyperstart) SendIoMessage ¶
func (h *Hyperstart) SendIoMessage(ttyMsg *hyper.TtyMessage) error
SendIoMessage sends data to the IO channel.
func (*Hyperstart) SetDeadline ¶
func (h *Hyperstart) SetDeadline(t time.Time) error
SetDeadline sets a timeout for CTL connection.
func (*Hyperstart) WaitForPAE ¶
func (h *Hyperstart) WaitForPAE(containerID, processID string) (*hyper.ProcessAsyncEvent, error)
WaitForPAE waits for a PROCESSASYNCEVENT message on CTL channel.
func (*Hyperstart) WaitForReady ¶
func (h *Hyperstart) WaitForReady() error
WaitForReady waits for a READY message on CTL channel.
func (*Hyperstart) WriteCtlMessage ¶
func (h *Hyperstart) WriteCtlMessage(conn net.Conn, m *hyper.DecodedMessage) error
WriteCtlMessage writes an hyperstart message to conn.
This is a low level function, for a full and safe transaction on the hyperstart control serial link, use SendCtlMessage.