habitat.views.flight

Functions for the flight design document.

Contains schema validation and views by flight launch time, window end time and payload name and window end time.

Functions

all_name_map(doc) View: flight/all_name
end_start_including_payloads_map(doc) View: flight/end_start_including_payloads
launch_time_including_payloads_map(doc) View: flight/launch_time_including_payloads
read_json_schema(schemaname)
rfc3339_to_timestamp Mock out external modules that might annoy documentation build systems.
validate(new, old, userctx, secobj) Validate this flight document against the schema, then check that only managers are approving documents and approved documents are only edited by managers.
validate_doc(data, schema) Validate data against schema, raising descriptive errors
version Mock out external modules that might annoy documentation build systems.

Exceptions

ForbiddenError Mock out external modules that might annoy documentation build systems.
UnauthorizedError Mock out external modules that might annoy documentation build systems.
habitat.views.flight.end_start_including_payloads_map(doc)[source]

View: flight/end_start_including_payloads

Emits:

[end_time, start_time, flight_id, 0] -> [payload_configuration ids]
[end_time, start_time, flight_id, 1] -> {linked payload_configuration doc 1}
[end_time, start_time, flight_id, 1] -> {linked payload_configuration doc 2}
...

Or, when a flight has no payloads:

[end_time, start_time, flight_id, 0] -> null

Times are all UNIX timestamps (and therefore in UTC).

Sorts by flight window end time then start time.

If the flight has payloads, emit it with the list of payloads, and emit a link for each payload so that they get included with include_docs. If a flight does not have payloads, it is emitted by itself.

Only shows approved flights.

Used by the parser to find active flights and get the configurations used to decode telemetry from them.

May otherwise be used to find upcoming flights and their associated payloads, though typically the view launch_time_including_payloads would be more useful as it sorts by launch time.

Query using startkey=[current_timestamp] to get all flights whose windows have not yet ended. Use include_docs=true to have the linked payload_configuration documents fetched and returned as the "doc" key for that row, otherwise the row’s value will just contain an object that holds the linked ID. See the CouchDB documentation for details on linked documents.

habitat.views.flight.launch_time_including_payloads_map(doc)[source]

View: flight/launch_time_including_payloads

Emits:

[launch_time, flight_id, 0] -> [payload_configuration ids]
[launch_time, flight_id, 1] -> {linked payload_configuration doc 1}
[launch_time, flight_id, 1] -> {linked payload_configuration doc 2}
...

Or, when a flight has no payloads:

[launch_time, flight_id, 0] -> null

Times are all UNIX timestamps (and therefore in UTC).

Sort by flight launch time.

Only shows approved flights.

Used by the calendar and other interface elements to show a list of upcoming flights.

Query using startkey=[current_timestamp] to get all upcoming flights. Use include_docs=true to have the linked payload_configuration documents fetched and returned as the "doc" key for that row, otherwise the row’s value will just contain an object that holds the linked ID. See the CouchDB documentation for details on linked documents.

habitat.views.flight.unapproved_name_including_payloads_map(doc)[source]

View: flight/unapproved_name_including_payloads

Emits:

[name, flight_id, 0] -> [payload_configuration ids]
[name, flight_id, 1] -> {linked payload_configuration doc 1}
[name, flight_id, 1] -> {linked payload_configuration doc 2}
...

Or, when a flight has no payloads:

[name, flight_id, 0] -> null

Times are all UNIX timestamps (and therefore in UTC).

Sort by flight name.

Only shows unapproved flights.

Used by the administration approval interface to list unapproved flights.

Use include_docs=true to have the linked payload_configuration documents fetched and returned as the "doc" key for that row, otherwise the row’s value will just contain an object that holds the linked ID. See the CouchDB documentation for details on linked documents.

habitat.views.flight.all_name_map(doc)[source]

View: flight/all_name

Emits:

[name] -> null

Sort by flight name.

Show all flights, even those unapproved.

Used where the UI must show all the flights in some usefully searchable sense, for instance when creating a new flight document based on some old or unapproved one, or when approving new flight documents.