tilie_server.routers.flows#
The flow routes: a timeline’s flow control played, and its flows written.
A manifest states where the flow of a timeline jumps and breaks (its flow
control); in which order its stretches are then played is computed, and the
computation is timetoalign’s alone. The editor asks for the flows of one
timeline (POST /api/flows): its atomic sections, and for each convention
the runs played, the sections they cover and what playing found, each
finding with its cause where timetoalign names one. When its user wants
those flows in the manifest, it asks for the manifest with them written
(POST /api/flows/flow-maps): the atomic sections as Regions of the
timeline and the computed FlowMaps. A manifest that holds flows written
before is written again: a Region whose stretch is an atomic section no
longer stays and is rejected as one, which needs the actor who asks. The
server stores nothing; what is done with either answer is the editor’s.
Both requests are a JSON object of parameters behind its length, as the MatchClaim provenance routes take them, followed by the manifest file’s text, in any serialization timetoshare reads, to the end of the body. The manifest is read whole by timetoalign, which checks it as a manifest reader does, before the timeline is looked for.
timetoalign’s engine and what reads a posted manifest for it are imported when a request needs them, so a server whose installed timetoalign cannot play flow control still starts and answers every other route; these routes then answer 501.
- tilie_server.routers.flows.REQUIRED_PARAMETERS = ('timeline',)#
The parameter both routes require.
- tilie_server.routers.flows.FLOWS_PARAMETERS = ('convention', 'believer', 'beliefs')#
The parameters the computing route takes besides, each optional.
- tilie_server.routers.flows.WRITING_PARAMETERS = ('believer', 'beliefs', 'actor', 'date')#
The parameters the writing route takes besides, each optional.
- tilie_server.routers.flows.MANIFEST_MEDIA_TYPE = 'application/json'#
The media type of the writing route’s answer, a manifest file in JSON.
- tilie_server.routers.flows.asked_reading(parameters)[source]#
Whose beliefs decide which elements are read, where a request says so.
believeris an actor, compared as timetoalign’s engine compares it with the actors of the elements’ beliefs as the manifest writes them;beliefsthe belief states read for it (true,undecided,unlikely,false), every state butfalsewithout it. An element is read when the believer’s state in it,undecidedwhere they hold no belief, is one of them; without a believer, when no actor rejects it.- Returns:
The keyword arguments of timetoalign’s
play,atomic_sectionsandcreate_flow_maps_from_flow_controlthat say so: none without a believer.- Raises:
Refusal – 422 at
["believer"]if the believer is no string; at["beliefs"]if the states are no list of belief states, or are given without a believer.- Parameters:
- Return type:
- tilie_server.routers.flows.asked_rejection(parameters)[source]#
Who asks for the flows to be written, and on which day, where a request says so.
- Returns:
The actor whose belief rejects the atomic sections that are none any more, and the day of that belief (
YYYY-MM-DD); None for each the request leaves out.- Raises:
Refusal – 422 at
["actor"]if the actor is no non-empty string, at["date"]if the date is no calendar date writtenYYYY-MM-DD.- Parameters:
- Return type:
- tilie_server.routers.flows.asked_conventions(parameters)[source]#
The conventions to answer: the one named, else all, in timetoalign’s order.
- tilie_server.routers.flows.read_request(body, optional)[source]#
The parameters of a request and its manifest, as its file writes it (IDs
#id) and with every ID made bare.- Parameters:
- Raises:
Refusal – As
tilie_server.routers.claim_provenance.split_parameters()andtilie_server.manifests.read_manifest().- Return type:
- tilie_server.routers.flows.asked_timeline(parameters, manifest, bare)[source]#
The timeline a request names, as timetoalign reads it in its manifest.
- Parameters:
- Returns:
The bundle timetoalign reads the manifest into, and the timeline in it.
- Raises:
Refusal – 422 at
["timeline"]if the parameter is no string or names no timeline of the manifest, at any depth; astilie_server.claim_columns.manifest_bundle()if timetoalign refuses the manifest.- Return type:
- tilie_server.routers.flows.flows_answer(body)[source]#
The flows of the timeline a request names.
- Returns:
{"timeline", "number_type", "atomic_sections", "conventions"}, the timeline’s bare ID and number type; its atomic sections in the order of the axis, each{"name", "start", "end"}; and under each convention answered{"runs", "sections"}, the runs played as[start, end]pairs (stretches played one after the other without a jump between them are one run) and the names of the atomic sections they cover, in the order played, andfindings, what playing found, each{"kind", "coordinate", "message"}with theendof a stretch never played and, where timetoalign names one, thecause(single_playback: a stretch thesingleflow leaves out that thedefaultflow plays);printedfinds nothing. Every value on the axis is written as a manifest writes a value on the timeline’s own axis: an integer, a number or a[numerator, denominator]pair, as the number type says. A timeline without flow control answers one section and one run over its whole length.- Raises:
Refusal – 501 as
flow_engine(); 422 asread_request(),asked_conventions(),asked_reading()andasked_timeline(); 422 at["timeline"]with timetoalign’s message if the timeline’s length is unknown or its flow control cannot be played.- Parameters:
body (bytes)
- Return type:
- tilie_server.routers.flows.written_manifest(body)[source]#
The manifest of a request with the flows of the timeline it names written.
- Returns:
A manifest file’s text in timetoshare’s JSON serialization, the manifest as timetoalign writes it, in the minimal form, after writing the timeline’s atomic sections as Regions and its computed FlowMaps. A child timeline’s Regions are written on the child and its FlowMaps on the root of its tree, which a FlowMap names. A timeline without flow control has nothing written. Where the manifest holds flows written before, an atomic section whose stretch is still one keeps its Region, a new stretch gets a new Region, and a Region whose stretch is none any more stays, with the belief
falseof the request’sactoron the request’sdate(the server’s day without one) in its type statement; the computed FlowMaps keep their IDs and list the sections standing now. The Regions and FlowMaps written anew get random IDs, minted in that order from one seed:seed_fromof the manifest as timetoalign writes it before the call (its minimal JSON text), the timeline’s ID,believerandbeliefs(Nonewhere not given), so one request is answered alike in either form of its manifest and on every asking.- Raises:
Refusal – 501 as
flow_engine(); 422 asread_request(),asked_reading(),asked_rejection()andasked_timeline(); 422 at["timeline"]with timetoalign’s message if it does not write the flows: the timeline’s length is unknown, its flow control cannot be played, or it holds an atomic section that is none any more and the request names noactorto reject it.- Parameters:
body (bytes)
- Return type:
- tilie_server.routers.flows.flows(body)[source]#
Answer the flows of one timeline of the posted manifest.
The body is the parameters’ length in bytes (a little-endian 32-bit integer), the parameters
{"timeline": <bare ID>, "convention"?: "default" | "single" | "printed", "believer"?: <actor>, "beliefs"?: [<belief state>, …]}as JSON, then the manifest file’s text: the elements read are those whose state forbelieveris one ofbeliefs(every state butfalsewithout it), or, without a believer, those no actor rejects. The answer is JSON (flows_answer()), with all three conventions where none is named. A request that cannot be answered is answered 422 with{"detail": {"path", "message"}}, a parameter’s at its name; a timetoalign that cannot play flow control, 501.
- tilie_server.routers.flows.flow_maps(body)[source]#
Answer the posted manifest with the flows of one timeline written.
The body is the parameters’ length in bytes (a little-endian 32-bit integer), the parameters
{"timeline": <bare ID>, "believer"?: <actor>, "beliefs"?: [<belief state>, …], "actor"?: <actor>, "date"?: "YYYY-MM-DD"}as JSON, then the manifest file’s text;believerandbeliefsread the elements as the computing route does.actoris who asks: the one whose belief rejects an atomic section written before that is none any more, ondate. The answer is a manifest file in JSON (written_manifest()); nothing is stored. Refusals answer as the computing route’s.