STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
backend.routers.documents Namespace Reference

Classes

class  CreatePayload
class  ReleasePayload

Variables

dict ui = {}
 store
 router = make_router(store, prefix="/api/engine/documents")

Detailed Description

Per-user engine designs with sharing, microversion history and named releases.

A thin binding of :mod:`stardesign.documents` -- the router shared by all three
design tools -- to this app's payload shape and route prefix. Everything of
substance, including ``_resolve_doc`` (the one place cross-user access is
granted), lives there.

The payload here is ``{"config": <dict>, "ui": <dict>}``; pid-designer's is
``{nodes, edges}``. That, the prefix, and the noun are the whole difference.

``ui`` carries the authored state that is not in ``PintleEngineConfig`` -- the
controller commands, the time-series pressure profiles, Layer 4's vehicle
definition, the layer run settings, the plot definition. It is opaque here, as
the config is: the frontend owns its shape (see frontend/src/lib/designState.ts).
It defaults to ``{}`` so every design stored before it existed still loads.

Variable Documentation

◆ router

backend.routers.documents.router = make_router(store, prefix="/api/engine/documents")

Definition at line 73 of file documents.py.

◆ store

backend.routers.documents.store
Initial value:
1= DesignStore(
2 ud=userdata.store,
3 backend=storage.backend,
4 body_model=ConfigPayload,
5 create_model=CreatePayload,
6 release_model=ReleasePayload,
7 to_data=lambda p: {
8 "config": getattr(p, "config", None) or {},
9 "ui": getattr(p, "ui", None) or {},
10 },
11 release_body=lambda p: (
12 None if p.config is None else {"config": p.config, "ui": p.ui or {}}
13 ),
14 noun="design",
15 default_slug="design",
16 # Seconds between automatic microversion snapshots for one design while it
17 # is being actively autosaved. The on-close /flush ignores this.
18 micro_interval=int(os.environ.get("ENGINE_MICRO_INTERVAL", "300")),
19 empty_payload=lambda: {"config": {}, "ui": {}},
20)

Definition at line 52 of file documents.py.

◆ ui

dict backend.routers.documents.ui = {}

Definition at line 37 of file documents.py.