diff options
| author | eunhhu <[email protected]> | 2026-09-27 07:30:38 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-27 07:30:38 +0100 |
| commit | 194d243165c2b78d64e0263f39f7a63dbe4a1310 (patch) | |
| tree | f05e5cf09eb43ddd44e5ef721675920f64519fe1 /prototypes/connections/module.h | |
| parent | 2e7ad9f8488d4f02c688ec24d6d0b571b3fa61ec (diff) | |
| download | pure-194d243165c2b78d64e0263f39f7a63dbe4a1310.tar.gz pure-194d243165c2b78d64e0263f39f7a63dbe4a1310.zip | |
Name message fields by paths and take variable fields where they are
A message field's name may now be a path of identifiers joined by dots
(user.name, a field inside the group user); a module that names both a
field and a group (user and user.name) is refused, as are empty,
leading, trailing or digit-first segments. A module may have 64
message fields instead of 32 (PureModule 11.9 to 13.2 KiB).
pure_app_message_fields takes each variable field's start and size in
the payload, so a host that parsed a request in place passes the
fields' bytes where they are instead of laying them out after the
prefix. The runtime checks them as before: a field past the payload
fails with limit, a text that is not UTF-8 with encoding.
Diffstat (limited to 'prototypes/connections/module.h')
| -rw-r--r-- | prototypes/connections/module.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/prototypes/connections/module.h b/prototypes/connections/module.h index 3a75fc1..430ccae 100644 --- a/prototypes/connections/module.h +++ b/prototypes/connections/module.h @@ -17,7 +17,7 @@ enum { PURE_MODULE_STATES = 32, PURE_MODULE_INPUTS = 32, PURE_MODULE_VIEWS = 64, PURE_MODULE_HANDLERS = 64, PURE_MODULE_CODE = 65535, PURE_MODULE_STACK = 64, PURE_MODULE_NAME = 32, PURE_MODULE_STRINGS = 32768, PURE_MODULE_HEADER = 40, - PURE_MODULE_FIELDS = 32, PURE_MODULE_COLLECTIONS = 1, PURE_MODULE_CONSTANTS = 4096, + PURE_MODULE_FIELDS = 64, PURE_MODULE_COLLECTIONS = 1, PURE_MODULE_CONSTANTS = 4096, PURE_MODULE_CONSTANT_BYTES = 1 << 20, PURE_MODULE_RECORDS = 8, PURE_MODULE_RECORD_FIELDS = 64, PURE_RECORD_FIELDS = 16, PURE_MODULE_JOINS = 8, PURE_APP_PENDING = 256 }; @@ -256,6 +256,13 @@ PureResult pure_app_text(PureApp *, uint32_t input, PureSpan text); * pure_app_finish. On return app->revision is the document's revision * (deferred: the revision the next save gives it). */ PureResult pure_app_message(PureApp *, uint32_t input, const char *key, int64_t base, PureSpan payload); +/* The same, with the variable fields where the host found them: field f + * starts at placed[2f] in payload and has placed[2f + 1] bytes (entries of + * fixed fields are not read, nor are the variable fields' lengths in the + * prefix). A host that parsed a request in place passes the fields' bytes + * where they are. */ +PureResult pure_app_message_fields(PureApp *, uint32_t input, const char *key, int64_t base, PureSpan payload, + const uint32_t *placed); /* Visit the reply of the last message in order, without copying, until the * next event (deferred: copy it before a later save too). */ PureResult pure_app_reply(const PureApp *, bool (*visit)(void *, PureSpan), void *context); |
