Documentation ¶
Index ¶
- type BackendInfo
- type Connection
- type LibMesh
- func (m LibMesh) CheckConnections() bool
- func (m *LibMesh) CheckControlSockets() bool
- func (m *LibMesh) CheckKnownConnectionCosts() bool
- func (m *LibMesh) CheckRoutes() bool
- func (m *LibMesh) Destroy()
- func (m *LibMesh) GetDataDir() string
- func (m *LibMesh) GetNodes() map[string]*LibNode
- func (m *LibMesh) NewLibNode(nodeID string) *LibNode
- func (m *LibMesh) Start(_ string) error
- func (m *LibMesh) Status() ([]*netceptor.Status, error)
- func (m *LibMesh) WaitForReady(ctx context.Context) error
- func (m LibMesh) WaitForShutdown()
- type LibNode
- func (n *LibNode) Destroy()
- func (n *LibNode) EstablishRemoteConnections() error
- func (n *LibNode) GetControlSocket() string
- func (n *LibNode) GetDataDir() string
- func (n *LibNode) GetID() string
- func (n *LibNode) Shutdown()
- func (n *LibNode) Start() error
- func (n *LibNode) StartListeners() error
- func (n *LibNode) StartLocalServices() error
- func (n *LibNode) Status() (*netceptor.Status, error)
- func (n *LibNode) TCPDial(address string, cost float64, tlsCfg *tls.Config) error
- func (n *LibNode) TCPListen(listenerCfg ListenerCfg) (*BackendInfo, error)
- func (n *LibNode) UDPDial(address string, cost float64) error
- func (n *LibNode) UDPListen(listenerCfg ListenerCfg) (*BackendInfo, error)
- func (n *LibNode) WaitForShutdown()
- func (n *LibNode) WebSocketDial(address string, cost float64, tlsCfg *tls.Config) error
- func (n *LibNode) WebsocketListen(listenerCfg ListenerCfg) (*BackendInfo, error)
- type ListenerCfg
- type NativeBackend
- type ReceptorControl
- func (r *ReceptorControl) AssertWorkCancelled(ctx context.Context, unitID string) error
- func (r *ReceptorControl) AssertWorkFailed(ctx context.Context, unitID string) error
- func (r *ReceptorControl) AssertWorkPending(ctx context.Context, unitID string) error
- func (r *ReceptorControl) AssertWorkReleased(ctx context.Context, unitID string) error
- func (r *ReceptorControl) AssertWorkResults(unitID string, expectedResults []byte) error
- func (r *ReceptorControl) AssertWorkRunning(ctx context.Context, unitID string) error
- func (r *ReceptorControl) AssertWorkSizeIncreasing(ctx context.Context, unitID string, size int64) error
- func (r *ReceptorControl) AssertWorkSucceeded(ctx context.Context, unitID string) error
- func (r *ReceptorControl) AssertWorkTimedOut(ctx context.Context, unitID string) error
- func (r *ReceptorControl) Close() error
- func (r *ReceptorControl) CloseWrite() error
- func (r *ReceptorControl) Connect(filename string) error
- func (r *ReceptorControl) GetWorkStatus(unitID string) (*workceptor.StatusFileData, error)
- func (r *ReceptorControl) Ping(node string) (string, error)
- func (r *ReceptorControl) Read() ([]byte, error)
- func (r *ReceptorControl) ReadAndParseJSON() (map[string]interface{}, error)
- func (r *ReceptorControl) ReadStr() (string, error)
- func (r *ReceptorControl) Reconnect() error
- func (r *ReceptorControl) Reload() error
- func (r *ReceptorControl) Status() (*netceptor.Status, error)
- func (r *ReceptorControl) WorkCancel(unitID string) (map[string]interface{}, error)
- func (r *ReceptorControl) WorkRelease(unitID string) (map[string]interface{}, error)
- func (r *ReceptorControl) WorkStart(workType string) (string, error)
- func (r *ReceptorControl) WorkSubmit(node, workType string) (string, error)
- func (r *ReceptorControl) WorkSubmitJSON(command string) (string, error)
- func (r *ReceptorControl) Write(data []byte) (int, error)
- func (r *ReceptorControl) WriteStr(data string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendInfo ¶ added in v1.4.1
type BackendInfo struct {
// contains filtered or unexported fields
}
type Connection ¶
Connection is an abstraction that ultimately results in a new running netceptor.Backend.
type LibMesh ¶
type LibMesh struct { Name string // Only used for generating test names DataDir string LogWriter *utils.TestLogWriter Context context.Context // contains filtered or unexported fields }
LibMesh represents a single Receptor mesh network, used for test simulations.
func (LibMesh) CheckConnections ¶
CheckConnections returns true if the connections defined in our mesh definition are consistent with the connections made by the nodes.
func (*LibMesh) CheckControlSockets ¶
CheckControlSockets Checks if the Control sockets in the mesh are all running and accepting connections.
func (*LibMesh) CheckKnownConnectionCosts ¶
CheckKnownConnectionCosts returns true if every node has the same view of the connections in the mesh.
func (*LibMesh) CheckRoutes ¶
CheckRoutes returns true if every node has a route to every other node.
func (*LibMesh) Destroy ¶
func (m *LibMesh) Destroy()
Shutdown stops all running Netceptors and their backends.
func (*LibMesh) GetDataDir ¶
GetDataDir returns the path to the data directory for this mesh.
func (*LibMesh) NewLibNode ¶
m.NewLibNode constructs a node with the name passed as the argument.
func (*LibMesh) WaitForReady ¶
WaitForReady Waits for connections and routes to converge.
func (LibMesh) WaitForShutdown ¶
func (m LibMesh) WaitForShutdown()
WaitForShutdown Waits for all running Netceptors and their backends to stop.
type LibNode ¶
type LibNode struct { Config types.NodeCfg Connections []Connection ListenerCfgs map[listenerName]ListenerCfg ControlSocket string TLSServerConfigs []*netceptor.TLSServerConfig TLSClientConfigs []*netceptor.TLSClientConfig WorkSigningKey *workceptor.SigningKeyPrivateCfg WorkVerificationKey *workceptor.VerifyingKeyPublicCfg // contains filtered or unexported fields }
LibNode represents a node (it's configuration and running services).
func (*LibNode) Destroy ¶
func (n *LibNode) Destroy()
Destroy instructs the node to stop its services.
func (*LibNode) EstablishRemoteConnections ¶
EstablishRemoteConnections discovers which address a remote backend is listening on and then dials out to it.
func (*LibNode) GetControlSocket ¶
GetControlSocket returns the path to the controlsocket.
func (*LibNode) GetDataDir ¶
GetDataDir returns the path to the directory where data is stored for this node.
func (*LibNode) Shutdown ¶
func (n *LibNode) Shutdown()
Shutdown stops the node and waits for it to exit.
func (*LibNode) Start ¶
Start will start local services (netceptor, workceptor, controlsvc), then start any listeners, finally establishing any remote connections. Note that this requires remote nodes to be running since we need to detect which random port was assigned to the backend. This is typically only used when calling Shutdown in the tests. When starting the mesh for the first time we loop over nodes in 2 phases, first calling StartListeners and then EstablishRemoteConnections.
func (*LibNode) StartListeners ¶
StartListeners loops over n.ListenerCfgs, which is an interface that wraps TCPListenerCfg, UDPListenerCfg, and WebsocketListenerCfg and starts listening on the appropriate protocol.
func (*LibNode) StartLocalServices ¶
func (*LibNode) TCPDial ¶
TCPDial registers a new netceptor.Backend that will dial a remote node via TCP.
func (*LibNode) TCPListen ¶
func (n *LibNode) TCPListen(listenerCfg ListenerCfg) (*BackendInfo, error)
TCPListen takes a ListenerCfg (backends.TCPListenerCfg) and listens for TCP traffic.
func (*LibNode) UDPDial ¶
UDPDial registers a new netceptor.Backend that will dial a remote node via UDP.
func (*LibNode) UDPListen ¶
func (n *LibNode) UDPListen(listenerCfg ListenerCfg) (*BackendInfo, error)
UDPListen takes a ListenerCfg (backends.UDPListenerCfg) and listens for UDP traffic.
func (*LibNode) WaitForShutdown ¶
func (n *LibNode) WaitForShutdown()
WaitForShutdown Waits for the node to shutdown completely.
func (*LibNode) WebSocketDial ¶
WebSocketDial registers a new netceptor.Backend that will dial a remote node via a WebSocket.
func (*LibNode) WebsocketListen ¶
func (n *LibNode) WebsocketListen(listenerCfg ListenerCfg) (*BackendInfo, error)
WebsocketListen takes a ListenerCfg (backends.WebsocketListenerCfg) and listens for Websocket traffic.
type ListenerCfg ¶
type NativeBackend ¶
type ReceptorControl ¶
type ReceptorControl struct { SocketFilename string // contains filtered or unexported fields }
ReceptorControl Connects to a control socket and provides basic commands.
func NewReceptorControl ¶
func NewReceptorControl() *ReceptorControl
New Returns an empty ReceptorControl.
func (*ReceptorControl) AssertWorkCancelled ¶
func (r *ReceptorControl) AssertWorkCancelled(ctx context.Context, unitID string) error
AssertWorkCancelled waits until work status is cancelled.
func (*ReceptorControl) AssertWorkFailed ¶
func (r *ReceptorControl) AssertWorkFailed(ctx context.Context, unitID string) error
AssertWorkFailed waits until status is failed.
func (*ReceptorControl) AssertWorkPending ¶
func (r *ReceptorControl) AssertWorkPending(ctx context.Context, unitID string) error
AssertWorkPending waits until status is pending.
func (*ReceptorControl) AssertWorkReleased ¶
func (r *ReceptorControl) AssertWorkReleased(ctx context.Context, unitID string) error
AssertWorkReleased asserts that work is not in work list.
func (*ReceptorControl) AssertWorkResults ¶
func (r *ReceptorControl) AssertWorkResults(unitID string, expectedResults []byte) error
AssertWorkResults makes sure results match expected byte array.
func (*ReceptorControl) AssertWorkRunning ¶
func (r *ReceptorControl) AssertWorkRunning(ctx context.Context, unitID string) error
AssertWorkRunning waits until work status is running.
func (*ReceptorControl) AssertWorkSizeIncreasing ¶
func (r *ReceptorControl) AssertWorkSizeIncreasing(ctx context.Context, unitID string, size int64) error
assert if the work size is increasing.
func (*ReceptorControl) AssertWorkSucceeded ¶
func (r *ReceptorControl) AssertWorkSucceeded(ctx context.Context, unitID string) error
AssertWorkSucceeded waits until status is successful.
func (*ReceptorControl) AssertWorkTimedOut ¶
func (r *ReceptorControl) AssertWorkTimedOut(ctx context.Context, unitID string) error
AssertWorkTimedOut asserts that work failed.
func (*ReceptorControl) Close ¶
func (r *ReceptorControl) Close() error
Close closes the connection to the socket.
func (*ReceptorControl) CloseWrite ¶
func (r *ReceptorControl) CloseWrite() error
CloseWrite closes the write side of the socket.
func (*ReceptorControl) Connect ¶
func (r *ReceptorControl) Connect(filename string) error
Connect connects to the socket at the specified filename and checks the handshake with the control service.
func (*ReceptorControl) GetWorkStatus ¶
func (r *ReceptorControl) GetWorkStatus(unitID string) (*workceptor.StatusFileData, error)
GetWorkStatus returns JSON of status file for a given unitID.
func (*ReceptorControl) Ping ¶
func (r *ReceptorControl) Ping(node string) (string, error)
Ping pings the specified node.
func (*ReceptorControl) Read ¶
func (r *ReceptorControl) Read() ([]byte, error)
Read reads a line from the socket.
func (*ReceptorControl) ReadAndParseJSON ¶
func (r *ReceptorControl) ReadAndParseJSON() (map[string]interface{}, error)
ReadAndParseJSON reads data from the socket and parses it as json.
func (*ReceptorControl) ReadStr ¶
func (r *ReceptorControl) ReadStr() (string, error)
ReadStr reads some data from the socket and converts it to a string.
func (*ReceptorControl) Reconnect ¶
func (r *ReceptorControl) Reconnect() error
Reconnect to unix socket.
func (*ReceptorControl) Reload ¶
func (r *ReceptorControl) Reload() error
func (*ReceptorControl) Status ¶
func (r *ReceptorControl) Status() (*netceptor.Status, error)
Status retrieves the status of the current node.
func (*ReceptorControl) WorkCancel ¶
func (r *ReceptorControl) WorkCancel(unitID string) (map[string]interface{}, error)
WorkCancel cancels work.
func (*ReceptorControl) WorkRelease ¶
func (r *ReceptorControl) WorkRelease(unitID string) (map[string]interface{}, error)
WorkRelease cancels and deletes work.
func (*ReceptorControl) WorkStart ¶
func (r *ReceptorControl) WorkStart(workType string) (string, error)
WorkStart begins work on local node.
func (*ReceptorControl) WorkSubmit ¶
func (r *ReceptorControl) WorkSubmit(node, workType string) (string, error)
WorkSubmit begins work on remote node.
func (*ReceptorControl) WorkSubmitJSON ¶
func (r *ReceptorControl) WorkSubmitJSON(command string) (string, error)
WorkSubmitJSON begins work on remote node via JSON command.