machine/

directory
v0.0.0-...-4448a72 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: BSD-3-Clause

README

Machine Server

The machine state server is a centralized management application for device testing.

See the Design Doc.

Code structure

The main code is structure as:

go/machine/
    source/
    processor/
    store/

Where:

  • types contains the Go types used across the rest of the modules.
  • The source module contains source.Source, a way to get update events from machines.
  • The store module contains store.Store, a way to persist and retrieve each machine's state.
  • The processor module contains processor.Processor, a way to update a machine state from an incoming event.

The main loop of machine state server looks like:

for event := range eventCh {
	store.Update(ctx, event.Host.Name, func(previous machine.Description) machine.Description {
		return processor.Process(ctx, previous, event)
	})
}

test_machine_monitor

The application that runs on each switchboard test machine and feeds information into the machine state server.

See the Design Doc.

Current Data Flow

User triggers powercycle for a machine.

initiator message target notes
machineserver >Set(ΔDescription) DB Description.Powercycle=true
powercycle_server_ansible <WebAPI(ListPowerCycleResponse) machineserver GET on /json/v1/powercycle/list
powercycle_server_ansible >WebAPI machineserver POST to /json/v1/powercycle/complete/{id:.+}

powercycle_server_ansible report availability on startup.

initiator message target notes
powercycle_server_ansible >WebAPI(UpdatePowerCycleStateRequest) machineserver POST to /json/v1/powercycle/state/update

How test_machine_monitor keeps machine.Description up to date.

initiator message target notes
test_machine_monitor >PubSub(Event) machineserver Sends results from interrogate.
test_machine_monitor <WebAPI(Description) machineserver GET to /json/v1/machine/description/{id:.+}

Legend

  • initiator - The entity that starts the action.
  • message - Shows the direction of the data flow, the transport, and the struct being moved.
    • Set - A database operation
    • WebAPI - An HTTP Request
    • PubSub - A PubSub message.
  • target - Who the iniator is talking to.
  • Δ is used before a struct if only a part of that struct is being changed.

Directories

Path Synopsis
go
common
Package common has functions useful across its peer modules.
Package common has functions useful across its peer modules.
machine/change/sink/sse
Package sse implements sink.Sink using Server-Sent Events.
Package sse implements sink.Sink using Server-Sent Events.
machine/event/sink
Package sink is for sending machine.Events that are eventually picked up by 'source'.
Package sink is for sending machine.Events that are eventually picked up by 'source'.
machine/event/sink/httpsink
Package httpsink sends event to the machine server via HTTP.
Package httpsink sends event to the machine server via HTTP.
machine/event/source/httpsource
Package httpsource implements event.Source by accepting incoming HTTP requests that contain a machine.Event serialized as JSON.
Package httpsource implements event.Source by accepting incoming HTTP requests that contain a machine.Event serialized as JSON.
machine/pools
Pools handles processing the pool configuration and applying it to Dimensions.
Pools handles processing the pool configuration and applying it to Dimensions.
machine/processor
Package processor does the work of taking incoming events from machines and updating the machine state using that information.
Package processor does the work of taking incoming events from machines and updating the machine state using that information.
machine/store
Package store is for storing and retrieving machine.Descriptions.
Package store is for storing and retrieving machine.Descriptions.
machine/store/cdb
Package cdb contains an implementation of ../store.Store that uses CockroachDB.
Package cdb contains an implementation of ../store.Store that uses CockroachDB.
machine/store/cdb/expectedschema
Package expectedschema contains the schema the database is expected to have.
Package expectedschema contains the schema the database is expected to have.
machine/store/cdb/exportschema
Application exportschema exports the expected schema as a serialized schema.Description.
Application exportschema exports the expected schema as a serialized schema.Description.
machine/store/cdb/mscdbinit
Command line tool to set up the CockroachDB database for machineserver.
Command line tool to set up the CockroachDB database for machineserver.
machine/store/cdb/tosql
This executable generates a go file that contains the SQL schema for machineserver defined as a string.
This executable generates a go file that contains the SQL schema for machineserver defined as a string.
machine/ts
Program to generate TypeScript definition files for Golang structs that are serialized to JSON for the web UI.
Program to generate TypeScript definition files for Golang structs that are serialized to JSON for the web UI.
machineserver/config
Package config contains the configuration for a running machineserver instance.
Package config contains the configuration for a running machineserver instance.
test_machine_monitor
A command-line application where each sub-command implements a get_* call in bot_config.py
A command-line application where each sub-command implements a get_* call in bot_config.py
test_machine_monitor/adb
Package adb is a simple wrapper around calling adb.
Package adb is a simple wrapper around calling adb.
test_machine_monitor/ios
Package ios exposes routines for communicating with locally attached iOS devices via libidevicemobile CLI tools.
Package ios exposes routines for communicating with locally attached iOS devices via libidevicemobile CLI tools.
test_machine_monitor/machine
Package machine is for interacting with the machine state server.
Package machine is for interacting with the machine state server.
test_machine_monitor/pyocd
Package pyocd exposes routines for communicating with locally attached devices via the pyocd CLI tool.
Package pyocd exposes routines for communicating with locally attached devices via the pyocd CLI tool.
test_machine_monitor/server
Package server is the core functionality of test_machine_monitor.
Package server is the core functionality of test_machine_monitor.
test_machine_monitor/standalone/crossplatform
Package common contains interrogation-related code common to multiple platforms.
Package common contains interrogation-related code common to multiple platforms.
test_machine_monitor/standalone/linux
Package linux contains Linux-specific pieces of interrogation which are nonetheless testable on arbitrary platforms.
Package linux contains Linux-specific pieces of interrogation which are nonetheless testable on arbitrary platforms.
test_machine_monitor/standalone/mac
Package mac contains Mac-specific pieces of interrogation which are nonetheless testable on arbitrary platforms.
Package mac contains Mac-specific pieces of interrogation which are nonetheless testable on arbitrary platforms.
test_machine_monitor/standalone/windows
Package windows contains Windows-specific pieces of interrogation which are nonetheless testable on arbitrary platforms.
Package windows contains Windows-specific pieces of interrogation which are nonetheless testable on arbitrary platforms.
test_machine_monitor/swarming
Package swarming downloads and runs the swarming_bot.zip code.
Package swarming downloads and runs the swarming_bot.zip code.

Jump to

Keyboard shortcuts

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