Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Treatment cut

http/upload::cut


Inputs

⇥ data: Stream<byte>

Outputs

↦ completed: Block<void>
↦ error: Block<string>
↦ failed: Block<void>
↦ finished: Block<void>
↦ parts: Stream<Vec<byte>>


Cut data into parts to upload.

The bytes received through data are given through parts in parts of the sizes |part_size gives, the last one being shorter. There is always at least one part, empty when there is no data.

Once data ends and every part is given, completed is emitted. If the data needs more than 10,000 parts, failed is emitted and error contains the reason. finished is emitted in every case.

Memory holds the part being cut, and those given but not taken yet.

graph LR
     T("cut()")
     B["… 🟦 🟦 🟦 🟦 🟦"] -->|data| T

     T -->|parts| P["… [🟦 🟦] [🟦 🟦 🟦]"]

     style B fill:#ffffff,stroke:#ffffff
     style P fill:#ffffff,stroke:#ffffff