diff options
| author | eunhhu <[email protected]> | 2026-09-27 13:14:38 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-27 13:14:38 +0100 |
| commit | 37d3a1e152707d2da587440c4cea8601b9ef0fd2 (patch) | |
| tree | 1a4cbea9d8ca636deabd8fc24b0d73cdae2bdaef /prototypes/connections/flow.c | |
| parent | 5372d03b5968796515966e2cfc89628d6448f0c1 (diff) | |
| download | pure-37d3a1e152707d2da587440c4cea8601b9ef0fd2.tar.gz pure-37d3a1e152707d2da587440c4cea8601b9ef0fd2.zip | |
Lay Pure out as a core with the parts selected around it
The app model, the tree store and the HTTP host lived in
prototypes/connections among the earlier document runtime, the store was
known only by its format's name, and Vega compiled six Pure sources by path.
Now, as the README's principle has it:
core/ runtime, flow and the app model (module*.c), with what the core
asks of storage (state.h, store.h)
store/ the tree store (PURETRE3, PUREREC1)
serve/ pure-serve: HTTP host, outbound delivery, JSON in place
cli/ pure-run, pure-edit-module
A top-level make builds libpure.a (app model and store, for hosts to link)
and the hosts; make check runs the store's and the app model's tests. The
earlier runtime still builds from prototypes/connections against core/ and
store/ (check, check-tree and check-core pass). Design 009 records the rule:
parts by role behind libraries; git repositories split by coupling, so the
store stays here while its contract moves with the core, and Vega stays apart.
Diffstat (limited to 'prototypes/connections/flow.c')
| -rw-r--r-- | prototypes/connections/flow.c | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/prototypes/connections/flow.c b/prototypes/connections/flow.c deleted file mode 100644 index 1070c70..0000000 --- a/prototypes/connections/flow.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "flow.h" -#include <assert.h> - -void pure_transfer_abort(PureTransfer *t) { - if (!t->active) return; - PureRelease release = t->release; - void *owner = t->owner; - *t = (PureTransfer){0}; - if (release) release(owner); -} - -static void advance(PureTransfer *t) { - while (t->active && t->part < 2 && t->offset == t->spans[t->part].size) { - t->part++; - t->offset = 0; - } - if (t->active && t->part == 2) pure_transfer_abort(t); -} - -void pure_transfer_init(PureTransfer *t, PureSpan header, PureSpan body, - void *owner, PureRelease release) { - assert(!t->active); - assert((!header.size || header.data) && (!body.size || body.data)); - *t = (PureTransfer){.spans = {header, body}, .owner = owner, - .release = release, .active = true}; - advance(t); -} - -PureSpan pure_transfer_next(const PureTransfer *t, size_t limit) { - if (!t->active) return (PureSpan){0}; - PureSpan span = t->spans[t->part]; - size_t remaining = span.size - t->offset; - return (PureSpan){span.data + t->offset, remaining < limit ? remaining : limit}; -} - -bool pure_transfer_consume(PureTransfer *t, size_t bytes) { - if (!t->active || bytes > t->spans[t->part].size - t->offset) return false; - t->offset += bytes; - advance(t); - return true; -} |
