A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::flow::graph Namespace Reference

Classes

struct  Analysis
 Who reads and who writes each ref a body owns. More...
 
struct  Body
 A block of steps: a flow's top level, or a loop or branch body. More...
 
struct  Expr
 One resolved expression, and the streams it reads. More...
 
struct  FlowGraph
 The executable graph of one flow. More...
 
class  GraphBuilder
 Appends to a [FlowGraph] while the resolver walks a flow. More...
 
struct  LogTail
 One resolved pipeline stage. More...
 
struct  Ref
 One stream in the plan. More...
 
struct  Stage
 
struct  Step
 One resolved statement. More...
 

Typedefs

using RefId = size_t
 Everything in a graph is named by index into the graph that owns it.
 
using StepId = size_t
 
using BodyId = size_t
 
using ExprId = size_t
 

Enumerations

enum class  RefKind {
  kFlowPort , kCallPort , kNode , kNodeId ,
  kStatus , kHeader , kExpr , kDerived ,
  kZip , kMerge , kWinner , kBound
}
 What a stream in the plan is. More...
 
enum class  StepKind {
  kCall , kPipe , kSkip , kWait ,
  kDrain , kCancel , kAbort , kFail ,
  kLog , kCapture , kForEach , kRepeat ,
  kIf , kBlock
}
 What a statement became. More...
 

Functions

std::string_view StepKindName (StepKind kind)
 
Analysis Analyse (const FlowGraph &flow, BodyId body)
 Work out who reads and writes what in one body.
 
bool RecordsOutcome (StepKind kind)
 Whether a step records an outcome of its own for a name to read.
 

Variables

constexpr size_t kNone = static_cast<size_t>(-1)
 No such thing – the absent id, for the many fields only some kinds use.
 

Typedef Documentation

◆ BodyId

using a11::flow::graph::BodyId = typedef size_t

◆ ExprId

using a11::flow::graph::ExprId = typedef size_t

◆ RefId

using a11::flow::graph::RefId = typedef size_t

Everything in a graph is named by index into the graph that owns it.

Not pointers: the vectors grow while the graph is built, and a plan is handed across a language boundary and held for as long as a flow is registered. An index survives both.

◆ StepId

using a11::flow::graph::StepId = typedef size_t

Enumeration Type Documentation

◆ RefKind

enum class a11::flow::graph::RefKind
strong

What a stream in the plan is.

Enumerator
kFlowPort 

A declared port of this flow.

kCallPort 

A port of an action this flow calls: x.out.

kNode 

A node of the flow's own: a stream it can write and read back.

kNodeId 

A node's id, as one value – what a flow hands to an action that expects to be told where to write.

kStatus 

The outcome of a call, a node, a port or a barrier, as a status record.

kHeader 

One header of the call running this flow, as a single value.

kExpr 

A stream of one value: an expression evaluated once.

kDerived 

One stage applied to another stream.

kZip 

Several streams read in step, as one stream of tuples: zip(a, b).

kMerge 

Several streams read at once, as one stream of their values in the order they arrive: interleave(a, b).

kWinner 

Which subject of a wait first of finished first, counted from zero, as one value.

Produced by the barrier rather than read from anywhere, the way a status is produced by the thing it is the status of.

kBound 

A stream the runtime binds per pass: a loop's value, its index, or a repeat's carry.

◆ StepKind

enum class a11::flow::graph::StepKind
strong

What a statement became.

Enumerator
kCall 
kPipe 
kSkip 
kWait 
kDrain 
kCancel 
kAbort 

abort node ..: end a node with a failure rather than with an end.

kFail 
kLog 
kCapture 

Remember a stream's first value for the loop that owns this body: what <- and an until condition compile to.

kForEach 
kRepeat 
kIf 
kBlock 

[try] { ... }: a body run as one step, whose outcome is its own.

Function Documentation

◆ Analyse()

Analysis a11::flow::graph::Analyse ( const FlowGraph &  flow,
BodyId  body 
)

Work out who reads and writes what in one body.

◆ RecordsOutcome()

bool a11::flow::graph::RecordsOutcome ( StepKind  kind)
inline

Whether a step records an outcome of its own for a name to read.

The steps that run a nested body: what makes them different from a kCall is that their status is not a call's status to be asked for, it is theirs to have recorded. A name bound to one reads what it recorded, which is why s = try { .. } and done = for x in s { .. } are the same shape.

◆ StepKindName()

std::string_view a11::flow::graph::StepKindName ( StepKind  kind)

Variable Documentation

◆ kNone

constexpr size_t a11::flow::graph::kNone = static_cast<size_t>(-1)
inlineconstexpr

No such thing – the absent id, for the many fields only some kinds use.