Expand description
The text script format: a hand-writable, datadriven-style command file.
A script is a sequence of stanzas, each a command and its expected output:
write-single-ts shard=data ts=0 count=5000
----
wrote 5000
count id=1001 ts=5
----
10000A stanza is a command (a directive line plus an optional indentation-structured
body) up to a ---- separator, then the expected output up to a blank line. The
---- block is the assertion; REWRITE=1 regenerates it (see crate::script).
A # at column 0 is a comment; an indented #0 is a column reference in MIR.
Comments and blank lines are preserved across a rewrite.
Command bodies are indentation-structured: define-schema/write-rows/peek
carry rows or columns, and define carries import/build/export
sub-commands, with a buildβs MIR as its own deeper-indented sub-body.
StructsΒ§
- Line π
- A non-blank line of a command block, with its leading-space indentation.
- Stanza
- A command stanza: the input block, the expected output, and the parsed command.
EnumsΒ§
- Item
- One element of a parsed script file, retained so a
REWRITEreproduces the file faithfully.
FunctionsΒ§
- body_
text π - Render body lines as text, dedented to the bodyβs minimum indentation so their relative structure (which MIR depends on) is preserved.
- columns_
from_ πbody - Parse body lines as column declarations:
name type [nullable]. - group π
- Split body lines into
(header, body)groups: each header is a line at the minimum indentation, owning the following more-indented lines as its body. - lex π
- Split a command block into non-blank lines, recording each lineβs indentation.
- opt_
string π - opt_u64 π
- opt_
usize π - parse_
command π - Parse one command block (directive line plus indentation-structured body).
- parse_
create_ πdataflow - Parse a
create-dataflowbody ofimport/build/exportsub-commands. The directiveβs bare flags carry the dataflow-level options (optimize). - parse_
export π - Parse an
exportsub-command into anExportSpec. Thekind=argument selects the variant (defaulting toindex); each kind takes its own arguments. - parse_
file - Parse a script file into items: each command stanza plus the comments and blank lines around it.
- parse_
header π - Parse a header line into its verb,
key=valuearguments, and bare flags. - parse_
usize_ πlist - Parse a
[a,b,c]list ofusizes ([]is empty). - req π
- req_u64 π
- rewrite
- Reproduce a script file with each stanzaβs expected output replaced by its
actual output, for
REWRITE.actualshas one entry perItem::Stanza, in order. - rows_
from_ πbody - Parse body lines as rows of raw space-separated value tokens (quotes intact).
The tokens are typed against the schema server-side; see
cell_from_token. - settings_
from_ πbody - Parse body lines as dyncfg settings:
name type value. - tokenize π
- Split a header line into whitespace-separated tokens, keeping
"..."strings and[...]lists intact.