diff options
| author | eunhhu <[email protected]> | 2026-09-28 04:31:43 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-28 04:31:43 +0100 |
| commit | 92290c5102e7fbb1248a0f215b1099de4d00c143 (patch) | |
| tree | aecb1d89a0468fc095f599cf8374f57642f71546 /serve/message-json.h | |
| parent | eed3b0d022a5145be06d87140a747da1a82f0f9d (diff) | |
| download | pure-92290c5102e7fbb1248a0f215b1099de4d00c143.tar.gz pure-92290c5102e7fbb1248a0f215b1099de4d00c143.zip | |
Take a message's rows over HTTP
A rows field's JSON value is an array of objects naming the record's
fields (numbers, strings; a field left out takes its default). The
connection thread encodes them as the list's stored form, which may be
longer than the JSON, grows the request's input by that much
(pure_runtime_grow: charged to the payload budget as admission charges an
input, 503 payload_budget when it does not fit) and places them after the
body, so the owner still applies a message it need not parse. A message
whose only variable field is rows takes a body that is not JSON as those
rows in their stored form: a bulk insert without JSON. An API's answer
(--reply) gives rows the same way. A delivered batch holds no rows.
server_rows loads 30,000 stock rows in one JSON request (some 250,000
rows a second, against 6,500 with a request a row) and 20,000 more as
bytes, refuses a load with a key already there whole (409 exists), then
checks 400 random orders against a model (294 applied, 106 refused with
none of their rows applied), texts with escapes and Korean, a walk that
removes, and a restart that keeps every state and no rows.
The format's document (008) describes walks, rows fields and lists of
rows, and OUTER_ROW.
Diffstat (limited to 'serve/message-json.h')
| -rw-r--r-- | serve/message-json.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/serve/message-json.h b/serve/message-json.h index 61211d6..c5332b4 100644 --- a/serve/message-json.h +++ b/serve/message-json.h @@ -14,10 +14,16 @@ typedef struct { const bool *given; /* fields given elsewhere (a request's query), or NULL */ bool lenient; /* a member naming no field is skipped, value and all (an API's answer) */ bool seen[PURE_MODULE_FIELDS]; + /* A rows field's array of objects is encoded in the stored form of its + * list into rows (grown with malloc: the caller frees it), which the + * caller places from rows_base on in the payload, as the table says. */ + unsigned char *rows; + size_t rows_size, rows_capacity, rows_base; } PureJsonMessage; /* The object at json[*at] (its opening brace), *at moved past it: NULL, or - * what is wrong ("json", "json_field": unknown or given twice, "json_type"). */ + * what is wrong ("json", "json_field": unknown or given twice, "json_type", + * "limit": rows past what a payload holds, "memory"). */ const char *pure_json_message(PureJsonMessage *, unsigned char *json, size_t size, size_t *at); size_t pure_json_space(const unsigned char *json, size_t at, size_t size); /* A fixed field's value from its text (a query value or a JSON number) into |
