@elaraai/east-c-cli 1.0.77 → 1.0.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +82 -10
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -37,21 +37,93 @@ The CLI loads the standard platform from `east-c-std` by default. Custom platfor
37
37
 
38
38
  A function whose trailing parameter is an emit capability writes its output
39
39
  incrementally instead of returning it; a large collection input can be fed
40
- lazily, one decoded segment at a time:
40
+ lazily, one decoded segment at a time (`--stream` is repeatable):
41
41
 
42
42
  ```bash
43
43
  # Emit a Dict (or array / set) through the trailing parameter, feeding
44
- # input 0 lazily from an indexed beast2 blob
45
- east-c run task.beast2 -i rows.beast2 --stream 0 --emit dict -o out.beast2 -v
44
+ # inputs 0 and 1 lazily from indexed beast2 blobs
45
+ east-c run task.beast2 -i rows.beast2 -i more.beast2 --stream 0 --stream 1 \
46
+ --emit dict -o out.beast2 -v
46
47
  ```
47
48
 
48
- Dict and Set emissions may arrive in any order. While they ascend, segments
49
- stream straight to the output; on the first out-of-order key the sink
50
- encodes each further emission as it arrives, keeps only the key, and spills
51
- sorted runs of `EAST_EMIT_RUN_ELEMENTS` entries (default 100000) beside the
52
- output as raw byte records, merging them at the end by decoding keys only.
53
- With `-v` the epilogue reports the spills, the peak entries and bytes
54
- buffered, and the time spent spilling and merging.
49
+ Dict and Set emissions must ascend in East order. The sink writes one pass,
50
+ segment by segment, with one open batch in memory whatever the size of the
51
+ output, and a key below the previous one is an error naming both:
52
+
53
+ ```text
54
+ beast2 v5: Dict key emitted out of order: 1 after 2 — Set/Dict emissions must ascend in East order
55
+ ```
56
+
57
+ Equal keys are an error too unless the sink folds them:
58
+
59
+ ```bash
60
+ # Dict: fold the values of adjacent equal keys with an East function (K, V, V) -> V
61
+ east-c run task.beast2 --emit dict --merge merge.beast2 -o out.beast2
62
+
63
+ # Set: keep the first of adjacent equal elements
64
+ east-c run task.beast2 --emit set --union -o out.beast2
65
+ ```
66
+
67
+ `--merge` takes an IR file in any format the program itself may use, compiled
68
+ with the run's `-p` platforms; its signature must match the emit parameter's
69
+ key and value types. Adjacent equal keys fold left in emission order,
70
+ `acc = merge(key, acc, value)`, and the output is byte-identical to what the
71
+ sink writes without the flag for the already-folded sequence.
72
+
73
+ ### Merging blobs
74
+
75
+ `merge` combines sorted Set or Dict blobs of one type — the files `run --emit`
76
+ writes — into one, in a single pass over the inputs: every input is read
77
+ segment by segment, equal keys across inputs fold in input order (`--merge`
78
+ on Dict inputs, `--union` on Set inputs; without a fold an equal key is an
79
+ error), and the output is byte-identical to what `run --emit` writes for the
80
+ same entries emitted ascending. This is how e3 assembles a partitioned task's
81
+ keyed partials; all three runners write the same bytes.
82
+
83
+ ```bash
84
+ # Dict partials: fold the values of equal keys, in input order
85
+ east-c merge --merge merge.beast2 -i part-0.beast2 -i part-1.beast2 -i part-2.beast2 -o out.beast2 -v
86
+
87
+ # Set partials: the first of equal elements stands
88
+ east-c merge --union -i part-0.beast2 -i part-1.beast2 -o out.beast2
89
+
90
+ # Only the keys in [from, to): range.beast2 holds a Struct{from: Option<K>,
91
+ # to: Option<K>} over the inputs' key type, an absent bound open
92
+ east-c merge --merge merge.beast2 --range range.beast2 -i part-0.beast2 -i part-1.beast2 -o out.beast2
93
+ ```
94
+
95
+ With `--range` every input is sought to the segment owning `from` through its
96
+ fences and read up to the first key at or past `to`, so a merge over one key
97
+ range of large partials reads that range's share of each, plus at most one
98
+ segment — how e3 merges a large output in parallel, one range per unit.
99
+
100
+ An input of another type than the first, an Array input, an input whose keys
101
+ do not ascend, a fold whose signature does not match the inputs, and bounds of
102
+ another type than the inputs' key are refused, naming the input. With `-v` the
103
+ merge prints its account:
104
+
105
+ ```text
106
+ merge: 3 input(s), 31 entries, 13 fold(s)
107
+ ```
108
+
109
+ ### Exiting with the parent
110
+
111
+ With `--exit-with-parent` on its command line (any command, anywhere among
112
+ the arguments) the runner watches its stdin on a thread of its own and exits
113
+ with status 1 as soon as a read returns end of file or fails. A parent that
114
+ spawns the runner with a stdin pipe it never writes to — as e3 does — takes
115
+ the runner down with it when it dies, even while the body is computing.
116
+ Without the flag, stdin is left alone.
117
+
118
+ ```bash
119
+ east-c run task.beast2 --exit-with-parent --emit dict -o out.beast2
120
+ ```
121
+
122
+ On Windows the watcher reads a synchronous pipe or an overlapped one. Hand it
123
+ an overlapped pipe — `FILE_FLAG_OVERLAPPED`, or Node's stdio `'overlapped'`,
124
+ as e3 does: a read pending on a synchronous pipe holds the pipe's file-object
125
+ lock, so any other use of stdin in the runner would wait until the parent is
126
+ gone.
55
127
 
56
128
  ### Profiling
57
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/east-c-cli",
3
- "version": "1.0.77",
3
+ "version": "1.0.79",
4
4
  "description": "Provides the `east-c` bin. A tiny launcher resolves the native binary for your platform from the matching per-platform package (@elaraai/east-c-cli-<target>), pulled in via optional dependencies.",
5
5
  "bin": {
6
6
  "east-c": "bin/east-c.mjs"
@@ -32,14 +32,14 @@
32
32
  "node": ">=18.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@elaraai/east": "1.0.77"
35
+ "@elaraai/east": "1.0.79"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@elaraai/east-c-cli-linux-x64": "1.0.77",
39
- "@elaraai/east-c-cli-linux-arm64": "1.0.77",
40
- "@elaraai/east-c-cli-darwin-arm64": "1.0.77",
41
- "@elaraai/east-c-cli-darwin-x64": "1.0.77",
42
- "@elaraai/east-c-cli-win32-x64": "1.0.77"
38
+ "@elaraai/east-c-cli-linux-x64": "1.0.79",
39
+ "@elaraai/east-c-cli-linux-arm64": "1.0.79",
40
+ "@elaraai/east-c-cli-darwin-arm64": "1.0.79",
41
+ "@elaraai/east-c-cli-darwin-x64": "1.0.79",
42
+ "@elaraai/east-c-cli-win32-x64": "1.0.79"
43
43
  },
44
44
  "scripts": {}
45
45
  }