49 lines
1.6 KiB
Plaintext
49 lines
1.6 KiB
Plaintext
rule bytes(event: dever.io.ReadEvent) (out: Bytes)
|
|
| event | out |
|
|
| Chunk(value) | value |
|
|
| Failed(message) | fail(dever.io.ReadEvent.Failed(message)) |
|
|
|
|
loop first(values: Stream<dever.io.ReadEvent>) (out: Bytes?)
|
|
| each value in values | result |
|
|
| out | first bytes(value) |
|
|
|
|
loop all(values: Stream<dever.io.ReadEvent>) (out: List<Bytes>)
|
|
| each value in values | result |
|
|
| out | list bytes(value) |
|
|
|
|
loop overflow(values: Stream<dever.io.ReadEvent>, base: Int) (out: Int)
|
|
| each value in values | result |
|
|
| out | sum length(bytes(value)) + base |
|
|
|
|
loop summary(values: Stream<dever.io.ReadEvent>) (first: Bytes?, rest: List<Bytes>)
|
|
| each value in values | result |
|
|
| first | first bytes(value) |
|
|
| rest | list bytes(value) |
|
|
|
|
loop zero(values: Stream<dever.io.ReadEvent>) (out: List<dever.io.ReadEvent>)
|
|
| each value in values | take | result |
|
|
| out | 0 | list value |
|
|
|
|
flow closeOnly(values: Stream<dever.io.ReadEvent>) ()
|
|
| step | kind | do |
|
|
| - | calc | close(values) |
|
|
|
|
flow chunks(file: dever.system.File, size: Int) (out: Stream<dever.io.ReadEvent>)
|
|
| step | kind | do |
|
|
| out | flow | dever.io.chunks(file, size) |
|
|
|
|
flow collect(path: Text, size: Int) (out: List<Bytes>)
|
|
| step | kind | do |
|
|
| file | flow | dever.io.open(path) |
|
|
| stream | flow | chunks(file, size) |
|
|
| out | loop | all(stream) |
|
|
|
|
flow offload(path: Text, size: Int) (out: List<Bytes>)
|
|
| step | kind | do |
|
|
| out | calc | blocking(collect(path, size)) |
|
|
|
|
flow spawned(path: Text, size: Int) (out: List<Bytes>)
|
|
| step | kind | do |
|
|
| task | calc | run(collect(path, size)) |
|
|
| out | calc | wait(task) |
|