Types and units

The document operations use typed values, and the database operations add time values. The tables use the type names of your selected language. Use it to find the unit, range, default, and absent value of a field.

Text uses UTF-8. This includes string values, object keys, and JSON, DUST, and EDN input and output. The document builders reject invalid UTF-8 strings and keys. TRON is binary, but its strings and keys also use UTF-8. Byte lengths count encoded bytes, rather than characters.

This matches JSON's UTF-8 requirement for interchange (RFC 8259, section 8.1).

Evaluation and database read results recursively omit object fields containing empty objects or arrays. This includes objects emptied by nested omissions. Null, empty strings, false, zero and array positions stay intact. Input documents and expanded programs preserve their contents.

  • Time and units defines the tick, its range and resolution, and the host conversion.
  • Value types defines documents, formats, node IDs, transactions, entities, instants, durations, numbers, and bytes.
  • Other kinds defines the remaining parameter and result kinds, such as text and counts.

Time and units

The ABI uses one time unit: the 100 ns tick, stored as an i64 count.

  • A duration is a signed tick count.
  • An instant is the tick count since the Unix epoch, 1970-01-01T00:00:00Z. It is in UTC, with no leap seconds and no time zone.
  • DUST durations and UTC values use the same unit, so database data and API parameters need no unit conversion.

Range

An i64 tick count holds approximately 29,227 years on each side of the Unix epoch:

QuantityValue
Largest positive count2^63 - 1 = 9,223,372,036,854,775,807 ticks
Ticks per second10,000,000
Largest positive durationApproximately 922,337,203,685 seconds, or 29,227.7 Gregorian years
Instant range from the Unix epochApproximately 27,258 BCE to 31,197 CE

This covers all written history, including cuneiform from approximately 3400 BCE.

Note

It also covers these fictional settings:

Resolution

One tick is 100 ns, or 0.0000001 s.

Note

At its peak speed, the Parker Solar Probe, the fastest human-made object, travels approximately 19 mm in one tick.

CalculationValue
Probe's peak speed191.2 km/s = 191,200 m/s
Time interval1 tick = 0.0000001 s
Distance = speed × time191,200 × 0.0000001 = 0.01912 m ≈ 19 mm

Thread wake-up jitter on common platforms is microseconds, so a smaller unit gives no useful precision. Windows also counts time in 100 ns units.

Order and time zones

  • Integer ticks have no floating-point rounding. ABI numbers are i64 or f64 only.
  • An instant in UTC ticks has no time zone or daylight-saving state. Each instant has one meaning, and integer comparison gives the time order.
  • The host applies time zones for presentation.
  • Each binding uses the duration and instant types of its language and converts at the call boundary.

C conversion

C passes durations and instants as int64_t tick counts. The caller converts them.

Value types

Each value type has one meaning in every language. Types below use the selected language's spelling.

ValueTypeUnitRangeAbsent
documentstardust_document*NoneAvailable memoryA null handle
formatstardust_source_formatNoneJSON, DUST, EDN, TRONNever absent
node_iduint32_tCount0 through 21474836464294967295
transactionint64_tCountSigned 64-bit integerZero selects the latest snapshot
entityint64_tCountSigned 64-bit integerNever absent
instantint64_t100 ns ticksSigned 64-bit ticks (host ranges differ)Zero when no commit was written
durationint64_t100 ns ticksSigned 64-bit ticks (host ranges differ)Each field defines its zero or negative sentinel
numberstardust_number_kind, int64_t, doubleNonei64 or finite f64Never absent
bytesstardust_bytesBytesAvailable memoryAn empty sequence

document

An owned native document preserves ordered members and duplicate keys.

format

The format selects a text codec or binary TRON.

node_id

A node ID selects a node within its owning document.

transaction

A transaction selects a committed database snapshot.

entity

An entity identifies an object in a database.

instant

An instant counts 100 ns ticks since the Unix epoch. An instant outside the host range reports time_out_of_range.

duration

A duration counts 100 ns ticks. Conversions beyond a host duration range saturate.

number

A number is a signed integer or finite floating-point value.

bytes

Bytes contain a borrowed byte sequence with an explicit length.

Other kinds

These kinds have no value type of their own. The signature of each operation gives the exact type. Parameter tables link handle and record kinds to the operation or record that defines them.

KindMeaning
noneThe operation returns no value.
versionAn ABI version number.
textUTF-8 text, or binary bytes for TRON.
integerA signed 64-bit integer.
realA finite 64-bit floating-point number.
countA count that is not negative.
booleanTrue or false.
nameA string: a key, title, path, kind or pattern.
valueA host value. The host mapping gives its document form.
sourceA stored definition path or an inline definition document.

Binding mechanics

Bindings may include these arguments in addition to native operation arguments:

ArgumentPurpose
AllocatorOwns copied output and diagnostics.
Cancellation contextControls cancellation.
Loaded librarySelects the native ABI library.

Optional wrappers such as pointers, Option and Maybe keep the wrapped type's contract.

Record examples

The generator captured each result from the native library.

Activate the license from a token file

c569 B
char token[4097];
FILE *file = fopen("license.token", "rb");
if (file == NULL) return STARDUST_INVALID_ARGUMENT;
size_t length = fread(token, 1, sizeof token, file);
fclose(file);
while (length > 0 && (token[length - 1] == '\n' || token[length - 1] == '\r')) length--;
stardust_bytes bytes = {(const uint8_t *)token, (int64_t)length};
stardust_license_view result = {.size = sizeof(stardust_license_view), .version = 1};
uint32_t status = stardust_activate(bytes);
if (status == STARDUST_OK) status = stardust_license(&result);
if (status != STARDUST_OK) return status;
TRON332 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 6275696C64txt "build"
00A00nil
00B0F 0A 04000000 0A00 0000map leaf, size 10: @4 → @A
0154C 74696572txt "tier"
01A0Ctxt ""
01B0F 0A 15000000 1A00 0000map leaf, size 10: @15 → @1A
02507 0E 20080000 0B00 0000 1B000000map branch, size 14, depth 1, slots 5, 11: @B → @1B
03314 13 726566757365 645F737570706F72 745F656E64txt "refused_support_end"
04800nil
0490F 0A 33000000 4800 0000map leaf, size 10: @33 → @48
053AC 6C6963656E7365 5F6964txt "license_id"
05E4C 74657374txt "test"
0630F 0A 53000000 5E00 0000map leaf, size 10: @53 → @5E
06D07 0E 08020000 4900 0000 63000000map branch, size 14, depth 1, slots 3, 9: @49 → @63
07B7C 6661696C757265txt "failure"
0834C 6E6F6E65txt "none"
0880F 0A 7B000000 8300 0000map leaf, size 10: @7B → @83
0927C 6C6963656E7365txt "license"
09A0Ctxt ""
09B0F 0A 92000000 9A00 0000map leaf, size 10: @92 → @9A
0A57C 7375626A656374txt "subject"
0AD4C 74657374txt "test"
0B20F 0A A5000000 AD00 0000map leaf, size 10: @A5 → @AD
0BCBC 737570706F7274 5F656E64txt "support_end"
0C802 00C0489F6ADB01 01i64 72580320000000000
0D10F 0A BC000000 C800 0000map leaf, size 10: @BC → @C8
0DB6C 616374697665txt "active"
0E209bit true
0E30F 0A DB000000 E200 0000map leaf, size 10: @DB → @E2
0ED4C 6E616D65txt "name"
0F20Ctxt ""
0F30F 0A ED000000 F200 0000map leaf, size 10: @ED → @F2
0FD7C 65787069726573txt "expires"
10500nil
1060F 0A FD000000 0501 0000map leaf, size 10: @FD → @105
11007 0E 06000000 F300 0000 06010000map branch, size 14, depth 1, slots 1, 2: @F3 → @106
11E07 26 219F0000 2500 0000 6D000000 8800 0000 9B000000 B200 0000 D1000000 E300 0000 10010000map branch, size 38, depth 0 (root), slots 0, 5, 8, 9, 10, 11, 12, 15: @25 → @6D → @88 → @9B → @B2 → @D1 → @E3 → @110

Add a typed integer node

c452 B
stardust_node_input input = {.parent=STARDUST_DOCUMENT_NO_NODE, .kind=STARDUST_NUMBER, .number=STARDUST_NUMBER_INTEGER, .integer=41};
stardust_document_builder *builder = NULL;
uint32_t status = stardust_document_builder_create(&builder);
if (status == STARDUST_OK) status = stardust_document_builder_add_many(builder, &input, 1);
stardust_document_builder_release(builder);
if (status != STARDUST_OK) return status;
stardust_node_input result = input;
TRON158 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 6B6579txt "key"
080Ctxt ""
090F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
134C 6B696E64txt "kind"
186C 6E756D626572txt "number"
1F0F 0A 13000000 1800 0000map leaf, size 10: @13 → @18
296C 6E756D626572txt "number"
3002 29000000000000 00i64 41
390F 0A 29000000 3000 0000map leaf, size 10: @29 → @30
436C 706172656E74txt "parent"
4A00nil
4B0F 0A 43000000 4A00 0000map leaf, size 10: @43 → @4A
554C 74657874txt "text"
5A0Ctxt ""
5B0F 0A 55000000 5A00 0000map leaf, size 10: @55 → @5A
657C 626F6F6C65616Etxt "boolean"
6D01bit false
6E0F 0A 65000000 6D00 0000map leaf, size 10: @65 → @6D
7807 1E A1190000 0900 0000 1F000000 3900 0000 4B000000 5B00 0000 6E000000map branch, size 30, depth 0 (root), slots 0, 5, 7, 8, 11, 12: @9 → @1F → @39 → @4B → @5B → @6E

database/merge_patch

seed_text holds this document:

TRON449 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0043C 616765txt "age"
00802 24000000000000 00i64 36
0110F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
01B4C 726F6C65txt "role"
0208C 656E67696E6565 72txt "engineer"
0290F 0A 1B000000 2000 0000map leaf, size 10: @1B → @20
0334C 6E616D65txt "name"
0383C 416461txt "Ada"
03C0F 0A 33000000 3800 0000map leaf, size 10: @33 → @38
04607 12 00910000 1100 0000 29000000 3C00 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @11 → @29 → @3C
0585C 236C696E6Btxt "#link"
05E5C 235F616461txt "#_ada"
0640F 0A 58000000 5E00 0000map leaf, size 10: @58 → @5E
06E3C 616765txt "age"
07202 29000000000000 00i64 41
07B0F 0A 6E000000 7200 0000map leaf, size 10: @6E → @72
0856C 6D656E746F72txt "mentor"
08C0F 0A 85000000 6400 0000map leaf, size 10: @85 → @64
0964C 726F6C65txt "role"
09B8C 656E67696E6565 72txt "engineer"
0A40F 0A 96000000 9B00 0000map leaf, size 10: @96 → @9B
0AE4C 6E616D65txt "name"
0B33C 426F62txt "Bob"
0B70F 0A AE000000 B300 0000map leaf, size 10: @AE → @B3
0C107 16 00990000 7B00 0000 8C000000 A400 0000 B7000000map branch, size 22, depth 0 (root), slots 8, 11, 12, 15: @7B → @8C → @A4 → @B7
0D73C 616765txt "age"
0DB02 1D000000000000 00i64 29
0E40F 0A D7000000 DB00 0000map leaf, size 10: @D7 → @DB
0EE4C 726F6C65txt "role"
0F38C 64657369676E65 72txt "designer"
0FC0F 0A EE000000 F300 0000map leaf, size 10: @EE → @F3
1064C 6E616D65txt "name"
10B2C 4379txt "Cy"
10E0F 0A 06010000 0B01 0000map leaf, size 10: @106 → @10B
11807 12 00910000 E400 0000 FC000000 0E01 0000map branch, size 18, depth 0 (root), slots 8, 12, 15: @E4 → @FC → @10E
12A6C 617574686F72txt "author"
1315C 736D6F6B65txt "smoke"
1370F 0A 2A010000 3101 0000map leaf, size 10: @12A → @131
1416C 726561736F6Etxt "reason"
1484C 73656564txt "seed"
14D0F 0A 41010000 4801 0000map leaf, size 10: @141 → @148
15707 0E 40080000 3701 0000 4D010000map branch, size 14, depth 0 (root), slots 6, 11: @137 → @14D
1654C 235F7478txt "#_tx"
16A0F 0A 65010000 5701 0000map leaf, size 10: @165 → @157
1744C 235F6379txt "#_cy"
1790F 0A 74010000 1801 0000map leaf, size 10: @174 → @118
1835C 235F626F62txt "#_bob"
1890F 0A 83010000 C100 0000map leaf, size 10: @183 → @C1
1935C 235F616461txt "#_ada"
1990F 0A 93010000 4600 0000map leaf, size 10: @193 → @46
1A307 16 88210000 6A01 0000 79010000 8901 0000 99010000map branch, size 22, depth 0 (root), slots 3, 7, 8, 13: @16A → @179 → @189 → @199
c336 B
stardust_document *patch = NULL;
stardust_result *result = NULL;
uint32_t status = stardust_parse(seed_text, STARDUST_TRON, &patch);
if (status == STARDUST_OK) status = stardust_db_merge_patch(db, patch, NULL, NULL, &result);
stardust_document_release(patch);
if (status != STARDUST_OK) {stardust_result_release(result); return status;}
TRON269 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0044C 235F6379txt "#_cy"
00902 01000000000000 00i64 1
0120F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
01C5C 235F626F62txt "#_bob"
02202 02000000000000 00i64 2
02B0F 0A 1C000000 2200 0000map leaf, size 10: @1C → @22
0355C 235F616461txt "#_ada"
03B02 03000000000000 00i64 3
0440F 0A 35000000 3B00 0000map leaf, size 10: @35 → @3B
04E07 12 80210000 1200 0000 2B000000 4400 0000map branch, size 18, depth 0 (root), slots 7, 8, 13: @12 → @2B → @44
0603C 696473txt "ids"
0640F 0A 60000000 4E00 0000map leaf, size 10: @60 → @4E
06E6C 737461747573txt "status"
0759C 636F6D6D697474 6564txt "committed"
07F0F 0A 6E000000 7500 0000map leaf, size 10: @6E → @75
08907 0E 02040000 6400 0000 7F000000map branch, size 14, depth 1, slots 1, 10: @64 → @7F
097BC 7472616E736163 74696F6Etxt "transaction"
0A302 04000000000000 00i64 4
0AC0F 0A 97000000 A300 0000map leaf, size 10: @97 → @A3
0B6CC 636F6D6D697474 65645F6174txt "committed_at"
0C302 84AC8E4A35AD3F 00i64 17923367928507524
0CC0F 0A B6000000 C300 0000map leaf, size 10: @B6 → @C3
0D65C 6661637473txt "facts"
0DC02 0C000000000000 00i64 12
0E50F 0A D6000000 DC00 0000map leaf, size 10: @D6 → @DC
0EF07 16 01460000 8900 0000 AC000000 CC00 0000 E5000000map branch, size 22, depth 0 (root), slots 0, 9, 10, 14: @89 → @AC → @CC → @E5

database/mutation

birthday_text holds this document:

TRON221 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3F65txt "?e"
070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
142C 3F65txt "?e"
174C 6E616D65txt "name"
1C3C 416461txt "Ada"
200E 15 00 0700 030000 00 14000000 170000 00 1C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @17 → @1C
350E 0D 00 0100 010000 00 20000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @20
425C 7768657265txt "where"
480F 0A 42000000 3500 0000map leaf, size 10: @42 → @35
524C 66696E64txt "find"
570F 0A 52000000 0700 0000map leaf, size 10: @52 → @7
6107 0E 0A000000 4800 0000 57000000map branch, size 14, depth 0 (root), slots 1, 3: @48 → @57
6F3C 616765txt "age"
7302 25000000000000 00i64 37
7C0F 0A 6F000000 7300 0000map leaf, size 10: @6F → @73
862C 3F65txt "?e"
890F 0A 86000000 7C00 0000map leaf, size 10: @86 → @7C
935C 7175657279txt "query"
990F 0A 93000000 6100 0000map leaf, size 10: @93 → @61
A35C 7061746368txt "patch"
A90F 0A A3000000 8900 0000map leaf, size 10: @A3 → @89
B307 0E 40020000 9900 0000 A9000000map branch, size 14, depth 2, slots 6, 9: @99 → @A9
C107 0A 01000000 B300 0000map branch, size 10, depth 1, slots 0: @B3
CB07 0A 80000000 C100 0000map branch, size 10, depth 0 (root), slots 7: @C1
c615 B
stardust_document *definition = NULL;
stardust_db_mutation *mutation = NULL;
stardust_result *result = NULL;
uint32_t status = stardust_parse(birthday_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
if (status == STARDUST_OK) status = stardust_db_mutation_open(db, &source, &mutation);
if (status == STARDUST_OK) status = stardust_db_mutation_run(mutation, NULL, NULL, NULL, &result);
stardust_db_mutation_release(mutation);
stardust_document_release(definition);
if (status != STARDUST_OK) {stardust_result_release(result); return status;}
TRON179 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
040F 02map leaf, size 2
063C 696473txt "ids"
0A0F 0A 06000000 0400 0000map leaf, size 10: @6 → @4
146C 737461747573txt "status"
1B9C 636F6D6D697474 6564txt "committed"
250F 0A 14000000 1B00 0000map leaf, size 10: @14 → @1B
2F07 0E 02040000 0A00 0000 25000000map branch, size 14, depth 1, slots 1, 10: @A → @25
3DBC 7472616E736163 74696F6Etxt "transaction"
4902 05000000000000 00i64 5
520F 0A 3D000000 4900 0000map leaf, size 10: @3D → @49
5CCC 636F6D6D697474 65645F6174txt "committed_at"
6902 3F9FB74A35AD3F 00i64 17923367931191103
720F 0A 5C000000 6900 0000map leaf, size 10: @5C → @69
7C5C 6661637473txt "facts"
8202 01000000000000 00i64 1
8B0F 0A 7C000000 8200 0000map leaf, size 10: @7C → @82
9507 16 01460000 2F00 0000 52000000 7200 0000 8B000000map branch, size 22, depth 0 (root), slots 0, 9, 10, 14: @2F → @52 → @72 → @8B

database/patch_definition

definition_text holds this document:

TRON264 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 3F726F6C65txt "?role"
00A8C 656E67696E6565 72txt "engineer"
0130F 0A 04000000 0A00 0000map leaf, size 10: @4 → @A
01D5C 3F6E616D65txt "?name"
0230E 0D 00 0100 010000 00 1D000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @1D
0302C 3F65txt "?e"
0334C 726F6C65txt "role"
0385C 3F726F6C65txt "?role"
03E0E 15 00 0700 030000 00 30000000 330000 00 38000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @30 → @33 → @38
0532C 3F65txt "?e"
0564C 6E616D65txt "name"
05B5C 3F6E616D65txt "?name"
0610E 15 00 0700 030000 00 53000000 560000 00 5B000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @53 → @56 → @5B
0760E 11 00 0300 020000 00 3E000000 610000 00array leaf, size 17, shift 0, bitmap 0003, count 2 (root): @3E → @61
0875C 3F6E616D65txt "?name"
08D0E 0D 00 0100 010000 00 87000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @87
09A5C 7768657265txt "where"
0A00F 0A 9A000000 7600 0000map leaf, size 10: @9A → @76
0AA4C 66696E64txt "find"
0AF0F 0A AA000000 2300 0000map leaf, size 10: @AA → @23
0B9AC 706172616D6574 657273txt "parameters"
0C40F 0A B9000000 1300 0000map leaf, size 10: @B9 → @13
0CE7C 6F726465724279txt "orderBy"
0D60F 0A CE000000 8D00 0000map leaf, size 10: @CE → @8D
0E007 0E 20080000 C400 0000 D6000000map branch, size 14, depth 1, slots 5, 11: @C4 → @D6
0EE07 12 2A000000 A000 0000 AF000000 E000 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @A0 → @AF → @E0
c485 B
stardust_document *definition = NULL;
stardust_result *result = NULL;
stardust_bytes kind = {(const uint8_t *)"queries", 7};
stardust_bytes path = {(const uint8_t *)"people/by_role", 14};
uint32_t status = stardust_parse(definition_text, STARDUST_TRON, &definition);
if (status == STARDUST_OK) status = stardust_db_definition_patch(db, kind, path, definition, &result);
stardust_document_release(definition);
if (status != STARDUST_OK) {stardust_result_release(result); return status;}
TRON179 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
040F 02map leaf, size 2
063C 696473txt "ids"
0A0F 0A 06000000 0400 0000map leaf, size 10: @6 → @4
146C 737461747573txt "status"
1B9C 636F6D6D697474 6564txt "committed"
250F 0A 14000000 1B00 0000map leaf, size 10: @14 → @1B
2F07 0E 02040000 0A00 0000 25000000map branch, size 14, depth 1, slots 1, 10: @A → @25
3DBC 7472616E736163 74696F6Etxt "transaction"
4902 03000000000000 00i64 3
520F 0A 3D000000 4900 0000map leaf, size 10: @3D → @49
5CCC 636F6D6D697474 65645F6174txt "committed_at"
6902 81E7C34A35AD3F 00i64 17923367931996033
720F 0A 5C000000 6900 0000map leaf, size 10: @5C → @69
7C5C 6661637473txt "facts"
8202 00000000000000 00i64 0
8B0F 0A 7C000000 8200 0000map leaf, size 10: @7C → @82
9507 16 01460000 2F00 0000 52000000 7200 0000 8B000000map branch, size 22, depth 0 (root), slots 0, 9, 10, 14: @2F → @52 → @72 → @8B

document/read_many

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
c527 B
stardust_document *source = NULL;
uint32_t root = 0;
stardust_node_view view = {0};
int64_t written = 0;
uint32_t status = stardust_parse(input_text, STARDUST_TRON, &source);
if (status == STARDUST_OK) status = stardust_document_root(source, &root);
if (status == STARDUST_OK) status = stardust_document_read_many(source, root, 1, &view, &written);
stardust_document_release(source);
if (status != STARDUST_OK) return status;
// The root object has no key or text, so the view borrows nothing.
stardust_node_view result = view;
TRON233 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 6B6579txt "key"
080Ctxt ""
090F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
134C 6B696E64txt "kind"
186C 6F626A656374txt "object"
1F0F 0A 13000000 1800 0000map leaf, size 10: @13 → @18
29BC 66697273745F63 68696C64txt "first_child"
3502 01000000000000 00i64 1
3E0F 0A 29000000 3500 0000map leaf, size 10: @29 → @35
488C 706F736974696F 6Etxt "position"
5102 00000000000000 00i64 0
5A0F 0A 48000000 5100 0000map leaf, size 10: @48 → @51
6407 0E 00810000 3E00 0000 5A000000map branch, size 14, depth 1, slots 8, 15: @3E → @5A
726C 706172656E74txt "parent"
7900nil
7A0F 0A 72000000 7900 0000map leaf, size 10: @72 → @79
844C 74657874txt "text"
890Ctxt ""
8A0F 0A 84000000 8900 0000map leaf, size 10: @84 → @89
947C 626F6F6C65616Etxt "boolean"
9C01bit false
9D0F 0A 94000000 9C00 0000map leaf, size 10: @94 → @9C
A7CC 6E6578745F7369 626C696E67txt "next_sibling"
B400nil
B50F 0A A7000000 B400 0000map leaf, size 10: @A7 → @B4
BF07 22 A1990000 0900 0000 1F000000 6400 0000 7A000000 8A00 0000 9D000000 B500 0000map branch, size 34, depth 0 (root), slots 0, 5, 7, 8, 11, 12, 15: @9 → @1F → @64 → @7A → @8A → @9D → @B5

document/read_many

input_text holds this document:

TRON33 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
041C 78txt "x"
0602 29000000000000 00i64 41
0F0F 0A 04000000 0600 0000map leaf, size 10: @4 → @6
c527 B
stardust_document *source = NULL;
uint32_t root = 0;
stardust_node_view view = {0};
int64_t written = 0;
uint32_t status = stardust_parse(input_text, STARDUST_TRON, &source);
if (status == STARDUST_OK) status = stardust_document_root(source, &root);
if (status == STARDUST_OK) status = stardust_document_read_many(source, root, 1, &view, &written);
stardust_document_release(source);
if (status != STARDUST_OK) return status;
// The root object has no key or text, so the view borrows nothing.
stardust_node_view result = view;
TRON233 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
043C 6B6579txt "key"
080Ctxt ""
090F 0A 04000000 0800 0000map leaf, size 10: @4 → @8
134C 6B696E64txt "kind"
186C 6F626A656374txt "object"
1F0F 0A 13000000 1800 0000map leaf, size 10: @13 → @18
29BC 66697273745F63 68696C64txt "first_child"
3502 01000000000000 00i64 1
3E0F 0A 29000000 3500 0000map leaf, size 10: @29 → @35
488C 706F736974696F 6Etxt "position"
5102 00000000000000 00i64 0
5A0F 0A 48000000 5100 0000map leaf, size 10: @48 → @51
6407 0E 00810000 3E00 0000 5A000000map branch, size 14, depth 1, slots 8, 15: @3E → @5A
726C 706172656E74txt "parent"
7900nil
7A0F 0A 72000000 7900 0000map leaf, size 10: @72 → @79
844C 74657874txt "text"
890Ctxt ""
8A0F 0A 84000000 8900 0000map leaf, size 10: @84 → @89
947C 626F6F6C65616Etxt "boolean"
9C01bit false
9D0F 0A 94000000 9C00 0000map leaf, size 10: @94 → @9C
A7CC 6E6578745F7369 626C696E67txt "next_sibling"
B400nil
B50F 0A A7000000 B400 0000map leaf, size 10: @A7 → @B4
BF07 22 A1990000 0900 0000 1F000000 6400 0000 7A000000 8A00 0000 9D000000 B500 0000map branch, size 34, depth 0 (root), slots 0, 5, 7, 8, 11, 12, 15: @9 → @1F → @64 → @7A → @8A → @9D → @B5

Read the process license

c172 B
stardust_license_view result = {.size = sizeof(stardust_license_view), .version = 1};
uint32_t status = stardust_license(&result);
if (status != STARDUST_OK) return status;
TRON332 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0045C 6275696C64txt "build"
00A00nil
00B0F 0A 04000000 0A00 0000map leaf, size 10: @4 → @A
0154C 74696572txt "tier"
01A0Ctxt ""
01B0F 0A 15000000 1A00 0000map leaf, size 10: @15 → @1A
02507 0E 20080000 0B00 0000 1B000000map branch, size 14, depth 1, slots 5, 11: @B → @1B
03314 13 726566757365 645F737570706F72 745F656E64txt "refused_support_end"
04800nil
0490F 0A 33000000 4800 0000map leaf, size 10: @33 → @48
053AC 6C6963656E7365 5F6964txt "license_id"
05E4C 74657374txt "test"
0630F 0A 53000000 5E00 0000map leaf, size 10: @53 → @5E
06D07 0E 08020000 4900 0000 63000000map branch, size 14, depth 1, slots 3, 9: @49 → @63
07B7C 6661696C757265txt "failure"
0834C 6E6F6E65txt "none"
0880F 0A 7B000000 8300 0000map leaf, size 10: @7B → @83
0927C 6C6963656E7365txt "license"
09A0Ctxt ""
09B0F 0A 92000000 9A00 0000map leaf, size 10: @92 → @9A
0A57C 7375626A656374txt "subject"
0AD4C 74657374txt "test"
0B20F 0A A5000000 AD00 0000map leaf, size 10: @A5 → @AD
0BCBC 737570706F7274 5F656E64txt "support_end"
0C802 00C0489F6ADB01 01i64 72580320000000000
0D10F 0A BC000000 C800 0000map leaf, size 10: @BC → @C8
0DB6C 616374697665txt "active"
0E209bit true
0E30F 0A DB000000 E200 0000map leaf, size 10: @DB → @E2
0ED4C 6E616D65txt "name"
0F20Ctxt ""
0F30F 0A ED000000 F200 0000map leaf, size 10: @ED → @F2
0FD7C 65787069726573txt "expires"
10500nil
1060F 0A FD000000 0501 0000map leaf, size 10: @FD → @105
11007 0E 06000000 F300 0000 06010000map branch, size 14, depth 1, slots 1, 2: @F3 → @106
11E07 26 219F0000 2500 0000 6D000000 8800 0000 9B000000 B200 0000 D1000000 E300 0000 10010000map branch, size 38, depth 0 (root), slots 0, 5, 8, 9, 10, 11, 12, 15: @25 → @6D → @88 → @9B → @B2 → @D1 → @E3 → @110

mutation/close

birthday_text holds this document:

TRON221 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3F65txt "?e"
070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
142C 3F65txt "?e"
174C 6E616D65txt "name"
1C3C 416461txt "Ada"
200E 15 00 0700 030000 00 14000000 170000 00 1C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @17 → @1C
350E 0D 00 0100 010000 00 20000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @20
425C 7768657265txt "where"
480F 0A 42000000 3500 0000map leaf, size 10: @42 → @35
524C 66696E64txt "find"
570F 0A 52000000 0700 0000map leaf, size 10: @52 → @7
6107 0E 0A000000 4800 0000 57000000map branch, size 14, depth 0 (root), slots 1, 3: @48 → @57
6F3C 616765txt "age"
7302 25000000000000 00i64 37
7C0F 0A 6F000000 7300 0000map leaf, size 10: @6F → @73
862C 3F65txt "?e"
890F 0A 86000000 7C00 0000map leaf, size 10: @86 → @7C
935C 7175657279txt "query"
990F 0A 93000000 6100 0000map leaf, size 10: @93 → @61
A35C 7061746368txt "patch"
A90F 0A A3000000 8900 0000map leaf, size 10: @A3 → @89
B307 0E 40020000 9900 0000 A9000000map branch, size 14, depth 2, slots 6, 9: @99 → @A9
C107 0A 01000000 B300 0000map branch, size 10, depth 1, slots 0: @B3
CB07 0A 80000000 C100 0000map branch, size 10, depth 0 (root), slots 7: @C1
c615 B
stardust_document *definition = NULL;
stardust_db_mutation *mutation = NULL;
stardust_result *result = NULL;
uint32_t status = stardust_parse(birthday_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
if (status == STARDUST_OK) status = stardust_db_mutation_open(db, &source, &mutation);
if (status == STARDUST_OK) status = stardust_db_mutation_run(mutation, NULL, NULL, NULL, &result);
stardust_db_mutation_release(mutation);
stardust_document_release(definition);
if (status != STARDUST_OK) {stardust_result_release(result); return status;}
TRON179 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
040F 02map leaf, size 2
063C 696473txt "ids"
0A0F 0A 06000000 0400 0000map leaf, size 10: @6 → @4
146C 737461747573txt "status"
1B9C 636F6D6D697474 6564txt "committed"
250F 0A 14000000 1B00 0000map leaf, size 10: @14 → @1B
2F07 0E 02040000 0A00 0000 25000000map branch, size 14, depth 1, slots 1, 10: @A → @25
3DBC 7472616E736163 74696F6Etxt "transaction"
4902 05000000000000 00i64 5
520F 0A 3D000000 4900 0000map leaf, size 10: @3D → @49
5CCC 636F6D6D697474 65645F6174txt "committed_at"
6902 6E83F34A35AD3F 00i64 17923367935116142
720F 0A 5C000000 6900 0000map leaf, size 10: @5C → @69
7C5C 6661637473txt "facts"
8202 01000000000000 00i64 1
8B0F 0A 7C000000 8200 0000map leaf, size 10: @7C → @82
9507 16 01460000 2F00 0000 52000000 7200 0000 8B000000map branch, size 22, depth 0 (root), slots 0, 9, 10, 14: @2F → @52 → @72 → @8B

mutation/run

birthday_text holds this document:

TRON221 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
042C 3F65txt "?e"
070E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
142C 3F65txt "?e"
174C 6E616D65txt "name"
1C3C 416461txt "Ada"
200E 15 00 0700 030000 00 14000000 170000 00 1C000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @14 → @17 → @1C
350E 0D 00 0100 010000 00 20000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @20
425C 7768657265txt "where"
480F 0A 42000000 3500 0000map leaf, size 10: @42 → @35
524C 66696E64txt "find"
570F 0A 52000000 0700 0000map leaf, size 10: @52 → @7
6107 0E 0A000000 4800 0000 57000000map branch, size 14, depth 0 (root), slots 1, 3: @48 → @57
6F3C 616765txt "age"
7302 25000000000000 00i64 37
7C0F 0A 6F000000 7300 0000map leaf, size 10: @6F → @73
862C 3F65txt "?e"
890F 0A 86000000 7C00 0000map leaf, size 10: @86 → @7C
935C 7175657279txt "query"
990F 0A 93000000 6100 0000map leaf, size 10: @93 → @61
A35C 7061746368txt "patch"
A90F 0A A3000000 8900 0000map leaf, size 10: @A3 → @89
B307 0E 40020000 9900 0000 A9000000map branch, size 14, depth 2, slots 6, 9: @99 → @A9
C107 0A 01000000 B300 0000map branch, size 10, depth 1, slots 0: @B3
CB07 0A 80000000 C100 0000map branch, size 10, depth 0 (root), slots 7: @C1
c615 B
stardust_document *definition = NULL;
stardust_db_mutation *mutation = NULL;
stardust_result *result = NULL;
uint32_t status = stardust_parse(birthday_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
if (status == STARDUST_OK) status = stardust_db_mutation_open(db, &source, &mutation);
if (status == STARDUST_OK) status = stardust_db_mutation_run(mutation, NULL, NULL, NULL, &result);
stardust_db_mutation_release(mutation);
stardust_document_release(definition);
if (status != STARDUST_OK) {stardust_result_release(result); return status;}
TRON179 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
040F 02map leaf, size 2
063C 696473txt "ids"
0A0F 0A 06000000 0400 0000map leaf, size 10: @6 → @4
146C 737461747573txt "status"
1B9C 636F6D6D697474 6564txt "committed"
250F 0A 14000000 1B00 0000map leaf, size 10: @14 → @1B
2F07 0E 02040000 0A00 0000 25000000map branch, size 14, depth 1, slots 1, 10: @A → @25
3DBC 7472616E736163 74696F6Etxt "transaction"
4902 05000000000000 00i64 5
520F 0A 3D000000 4900 0000map leaf, size 10: @3D → @49
5CCC 636F6D6D697474 65645F6174txt "committed_at"
6902 3D9BFF4A35AD3F 00i64 17923367935908669
720F 0A 5C000000 6900 0000map leaf, size 10: @5C → @69
7C5C 6661637473txt "facts"
8202 01000000000000 00i64 1
8B0F 0A 7C000000 8200 0000map leaf, size 10: @7C → @82
9507 16 01460000 2F00 0000 52000000 7200 0000 8B000000map branch, size 22, depth 0 (root), slots 0, 9, 10, 14: @2F → @52 → @72 → @8B

Open with explicit native options

c405 B
stardust_db_options result = {.size=sizeof(result), .version=1, .create=1, .page_size=0};
stardust_db *database = NULL;
stardust_result *opening = NULL;
uint32_t status = stardust_db_open((stardust_bytes){(const uint8_t *)database_path, (int64_t)strlen(database_path)}, &result, &database, &opening);
stardust_result_release(opening);
stardust_db_close(database);
if (status != STARDUST_OK) return status;
TRON311 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0046C 637265617465txt "create"
00B09bit true
00C0F 0A 04000000 0B00 0000map leaf, size 10: @4 → @B
01614 11 696E69746961 6C5F6D61705F6279 746573txt "initial_map_bytes"
02902 00000000000000 00i64 0
0320F 0A 16000000 2900 0000map leaf, size 10: @16 → @29
03C7C 706C7567696E73txt "plugins"
04400nil
0450F 0A 3C000000 4400 0000map leaf, size 10: @3C → @44
04F14 13 6D656D6F7279 5F6275646765745F 6279746573txt "memory_budget_bytes"
06402 00000000000000 00i64 0
06D0F 0A 4F000000 6400 0000map leaf, size 10: @4F → @64
077CC 6C6F636B5F7469 6D656F7574txt "lock_timeout"
08402 00000000000000 00i64 0
08D0F 0A 77000000 8400 0000map leaf, size 10: @77 → @84
0975C 636C656172txt "clear"
09D01bit false
09E0F 0A 97000000 9D00 0000map leaf, size 10: @97 → @9D
0A8AC 70696E5F6D656D 6F7279txt "pin_memory"
0B301bit false
0B40F 0A A8000000 B300 0000map leaf, size 10: @A8 → @B3
0BE9C 706167655F7369 7A65txt "page_size"
0C802 00000000000000 00i64 0
0D10F 0A BE000000 C800 0000map leaf, size 10: @BE → @C8
0DBCC 636F6D6D69745F 6261746368txt "commit_batch"
0E802 00000000000000 00i64 0
0F10F 0A DB000000 E800 0000map leaf, size 10: @DB → @E8
0FB07 12 00430000 B400 0000 D1000000 F100 0000map branch, size 18, depth 1, slots 8, 9, 14: @B4 → @D1 → @F1
10D07 22 193A0000 0C00 0000 32000000 4500 0000 6D000000 8D00 0000 9E000000 FB00 0000map branch, size 34, depth 0 (root), slots 0, 3, 4, 9, 11, 12, 13: @C → @32 → @45 → @6D → @8D → @9E → @FB

Wait for the database lock without a limit

c429 B
stardust_db_options result = {.size=sizeof(result), .version=1, .create=1, .page_size=0, .lock_timeout_ticks=-1};
stardust_db *database = NULL;
stardust_result *opening = NULL;
uint32_t status = stardust_db_open((stardust_bytes){(const uint8_t *)database_path, (int64_t)strlen(database_path)}, &result, &database, &opening);
stardust_result_release(opening);
stardust_db_close(database);
if (status != STARDUST_OK) return status;
TRON303 B
Offset (hex)Bytes (hex)Meaning
00054 52 4F 4Emagic TRON
0046C 637265617465txt "create"
00B09bit true
00C0F 0A 04000000 0B00 0000map leaf, size 10: @4 → @B
01614 11 696E69746961 6C5F6D61705F6279 746573txt "initial_map_bytes"
02902 00000000000000 00i64 0
0320F 0A 16000000 2900 0000map leaf, size 10: @16 → @29
03C7C 706C7567696E73txt "plugins"
04400nil
0450F 0A 3C000000 4400 0000map leaf, size 10: @3C → @44
04F14 13 6D656D6F7279 5F6275646765745F 6279746573txt "memory_budget_bytes"
06402 00000000000000 00i64 0
06D0F 0A 4F000000 6400 0000map leaf, size 10: @4F → @64
077CC 6C6F636B5F7469 6D656F7574txt "lock_timeout"
08400nil
0850F 0A 77000000 8400 0000map leaf, size 10: @77 → @84
08F5C 636C656172txt "clear"
09501bit false
0960F 0A 8F000000 9500 0000map leaf, size 10: @8F → @95
0A0AC 70696E5F6D656D 6F7279txt "pin_memory"
0AB01bit false
0AC0F 0A A0000000 AB00 0000map leaf, size 10: @A0 → @AB
0B69C 706167655F7369 7A65txt "page_size"
0C002 00000000000000 00i64 0
0C90F 0A B6000000 C000 0000map leaf, size 10: @B6 → @C0
0D3CC 636F6D6D69745F 6261746368txt "commit_batch"
0E002 00000000000000 00i64 0
0E90F 0A D3000000 E000 0000map leaf, size 10: @D3 → @E0
0F307 12 00430000 AC00 0000 C9000000 E900 0000map branch, size 18, depth 1, slots 8, 9, 14: @AC → @C9 → @E9
10507 22 193A0000 0C00 0000 32000000 4500 0000 6D000000 8500 0000 96000000 F300 0000map branch, size 34, depth 0 (root), slots 0, 3, 4, 9, 11, 12, 13: @C → @32 → @45 → @6D → @85 → @96 → @F3

Capture the host duration boundary

query_text holds this document:

TRON165 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 3F6E616D65txt "?name"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
172C 3F65txt "?e"
1A4C 6E616D65txt "name"
1F5C 3F6E616D65txt "?name"
250E 15 00 0700 030000 00 17000000 1A0000 00 1F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1A → @1F
3A0E 0D 00 0100 010000 00 25000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @25
475C 3F6E616D65txt "?name"
4D0E 0D 00 0100 010000 00 47000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @47
5A5C 7768657265txt "where"
600F 0A 5A000000 3A00 0000map leaf, size 10: @5A → @3A
6A4C 66696E64txt "find"
6F0F 0A 6A000000 0A00 0000map leaf, size 10: @6A → @A
797C 6F726465724279txt "orderBy"
810F 0A 79000000 4D00 0000map leaf, size 10: @79 → @4D
8B07 12 2A000000 6000 0000 6F000000 8100 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @60 → @6F → @81

boundary_text holds this document:

TRON21 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
0402 FFFFFFFFFFFFFF 7Fi64 9223372036854775807
c1.1 kB
stardust_document *definition = NULL;
stardust_db_query *query = NULL;
stardust_db_rows *rows = NULL;
stardust_document *boundary = NULL;
uint32_t boundary_root = 0;
int64_t ticks = 0;
uint32_t status = stardust_parse(boundary_text, STARDUST_TRON, &boundary);
if (status == STARDUST_OK) status = stardust_document_root(boundary, &boundary_root);
if (status == STARDUST_OK) status = stardust_document_i64(boundary, boundary_root, &ticks);
stardust_document_release(boundary);
if (status == STARDUST_OK) status = stardust_parse(query_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
stardust_db_query_options result = {.size=sizeof(result), .version=1, .page_size=2, .max_cost_ticks=ticks};
if (status == STARDUST_OK) status = stardust_db_query_open(db, &source, &query);
if (status == STARDUST_OK) status = stardust_db_query_run(query, NULL, &result, NULL, &rows);
stardust_db_rows_release(rows);
stardust_db_query_release(query);
stardust_document_release(definition);
if (status != STARDUST_OK) return status;
TRON112 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
048C 6D61785F636F73 74txt "max_cost"
0D02 FFFFFFFFFFFFFF 7Fi64 9223372036854775807
160F 0A 04000000 0D00 0000map leaf, size 10: @4 → @D
205C 61735F6F66txt "as_of"
2602 00000000000000 00i64 0
2F0F 0A 20000000 2600 0000map leaf, size 10: @20 → @26
399C 706167655F7369 7A65txt "page_size"
4302 02000000000000 00i64 2
4C0F 0A 39000000 4300 0000map leaf, size 10: @39 → @43
5607 12 28200000 1600 0000 2F000000 4C00 0000map branch, size 18, depth 0 (root), slots 3, 5, 13: @16 → @2F → @4C

The C ABI takes complete 100-ns ticks

query_text holds this document:

TRON165 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 3F6E616D65txt "?name"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
172C 3F65txt "?e"
1A4C 6E616D65txt "name"
1F5C 3F6E616D65txt "?name"
250E 15 00 0700 030000 00 17000000 1A0000 00 1F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1A → @1F
3A0E 0D 00 0100 010000 00 25000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @25
475C 3F6E616D65txt "?name"
4D0E 0D 00 0100 010000 00 47000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @47
5A5C 7768657265txt "where"
600F 0A 5A000000 3A00 0000map leaf, size 10: @5A → @3A
6A4C 66696E64txt "find"
6F0F 0A 6A000000 0A00 0000map leaf, size 10: @6A → @A
797C 6F726465724279txt "orderBy"
810F 0A 79000000 4D00 0000map leaf, size 10: @79 → @4D
8B07 12 2A000000 6000 0000 6F000000 8100 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @60 → @6F → @81
c532 B
stardust_document *definition = NULL;
stardust_db_query *query = NULL;
uint32_t status = stardust_parse(query_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
stardust_db_query_options result = {.size=sizeof(result), .version=1, .page_size=2, .max_cost_ticks=1};
if (status == STARDUST_OK) status = stardust_db_query_open(db, &source, &query);
stardust_db_query_release(query);
stardust_document_release(definition);
if (status != STARDUST_OK) return status;
TRON112 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
048C 6D61785F636F73 74txt "max_cost"
0D02 01000000000000 00i64 1
160F 0A 04000000 0D00 0000map leaf, size 10: @4 → @D
205C 61735F6F66txt "as_of"
2602 00000000000000 00i64 0
2F0F 0A 20000000 2600 0000map leaf, size 10: @20 → @26
399C 706167655F7369 7A65txt "page_size"
4302 02000000000000 00i64 2
4C0F 0A 39000000 4300 0000map leaf, size 10: @39 → @43
5607 12 28200000 1600 0000 2F000000 4C00 0000map branch, size 18, depth 0 (root), slots 3, 5, 13: @16 → @2F → @4C

A negative configured duration is not an absent field

c90 B
stardust_db_query_options result = {.size=sizeof(result), .version=1, .max_cost_ticks=-1};
TRON112 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
048C 6D61785F636F73 74txt "max_cost"
0D02 FFFFFFFFFFFFFF FFi64 -1
160F 0A 04000000 0D00 0000map leaf, size 10: @4 → @D
205C 61735F6F66txt "as_of"
2602 00000000000000 00i64 0
2F0F 0A 20000000 2600 0000map leaf, size 10: @20 → @26
399C 706167655F7369 7A65txt "page_size"
4302 00000000000000 00i64 0
4C0F 0A 39000000 4300 0000map leaf, size 10: @39 → @43
5607 12 28200000 1600 0000 2F000000 4C00 0000map branch, size 18, depth 0 (root), slots 3, 5, 13: @16 → @2F → @4C

Run with typed query options

query_text holds this document:

TRON165 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 3F6E616D65txt "?name"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
172C 3F65txt "?e"
1A4C 6E616D65txt "name"
1F5C 3F6E616D65txt "?name"
250E 15 00 0700 030000 00 17000000 1A0000 00 1F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1A → @1F
3A0E 0D 00 0100 010000 00 25000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @25
475C 3F6E616D65txt "?name"
4D0E 0D 00 0100 010000 00 47000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @47
5A5C 7768657265txt "where"
600F 0A 5A000000 3A00 0000map leaf, size 10: @5A → @3A
6A4C 66696E64txt "find"
6F0F 0A 6A000000 0A00 0000map leaf, size 10: @6A → @A
797C 6F726465724279txt "orderBy"
810F 0A 79000000 4D00 0000map leaf, size 10: @79 → @4D
8B07 12 2A000000 6000 0000 6F000000 8100 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @60 → @6F → @81
c713 B
stardust_document *definition = NULL;
stardust_db_query *query = NULL;
stardust_db_rows *rows = NULL;
uint32_t status = stardust_parse(query_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
stardust_db_query_options result = {.size=sizeof(result), .version=1, .page_size=2, .max_cost_ticks=STARDUST_TICKS_PER_SECOND};
if (status == STARDUST_OK) status = stardust_db_query_open(db, &source, &query);
if (status == STARDUST_OK) status = stardust_db_query_run(query, NULL, &result, NULL, &rows);
stardust_db_rows_release(rows);
stardust_db_query_release(query);
stardust_document_release(definition);
if (status != STARDUST_OK) return status;
TRON112 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
048C 6D61785F636F73 74txt "max_cost"
0D02 80969800000000 00i64 10000000
160F 0A 04000000 0D00 0000map leaf, size 10: @4 → @D
205C 61735F6F66txt "as_of"
2602 00000000000000 00i64 0
2F0F 0A 20000000 2600 0000map leaf, size 10: @20 → @26
399C 706167655F7369 7A65txt "page_size"
4302 02000000000000 00i64 2
4C0F 0A 39000000 4300 0000map leaf, size 10: @39 → @43
5607 12 28200000 1600 0000 2F000000 4C00 0000map branch, size 18, depth 0 (root), slots 3, 5, 13: @16 → @2F → @4C

Read the complete initial subscription event

query_text holds this document:

TRON165 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
045C 3F6E616D65txt "?name"
0A0E 0D 00 0100 010000 00 04000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @4
172C 3F65txt "?e"
1A4C 6E616D65txt "name"
1F5C 3F6E616D65txt "?name"
250E 15 00 0700 030000 00 17000000 1A0000 00 1F000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @17 → @1A → @1F
3A0E 0D 00 0100 010000 00 25000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @25
475C 3F6E616D65txt "?name"
4D0E 0D 00 0100 010000 00 47000000array leaf, size 13, shift 0, bitmap 0001, count 1 (root): @47
5A5C 7768657265txt "where"
600F 0A 5A000000 3A00 0000map leaf, size 10: @5A → @3A
6A4C 66696E64txt "find"
6F0F 0A 6A000000 0A00 0000map leaf, size 10: @6A → @A
797C 6F726465724279txt "orderBy"
810F 0A 79000000 4D00 0000map leaf, size 10: @79 → @4D
8B07 12 2A000000 6000 0000 6F000000 8100 0000map branch, size 18, depth 0 (root), slots 1, 3, 5: @60 → @6F → @81
c832 B
stardust_document *definition = NULL;
stardust_db_query *query = NULL;
stardust_db_subscription *subscription = NULL;
stardust_db_live_event event = {0};
uint32_t status = stardust_parse(query_text, STARDUST_TRON, &definition);
stardust_db_source source = {.kind = STARDUST_SOURCE_DOCUMENT, .document = definition};
if (status == STARDUST_OK) status = stardust_db_query_open(db, &source, &query);
if (status == STARDUST_OK) status = stardust_db_query_subscribe(query, NULL, NULL, &subscription);
if (status == STARDUST_OK) status = stardust_db_subscription_next(subscription, 0, &event);
stardust_db_subscription_release(subscription);
stardust_db_query_release(query);
stardust_document_release(definition);
if (status != STARDUST_OK) {stardust_document_release(event.result); return status;}
stardust_db_live_event result = event;
TRON217 B
Offset (hex)Bytes (hex)Meaning
0054 52 4F 4Emagic TRON
044C 6E616D65txt "name"
093C 416461txt "Ada"
0D0F 0A 04000000 0900 0000map leaf, size 10: @4 → @9
174C 6E616D65txt "name"
1C3C 426F62txt "Bob"
200F 0A 17000000 1C00 0000map leaf, size 10: @17 → @1C
2A4C 6E616D65txt "name"
2F2C 4379txt "Cy"
320F 0A 2A000000 2F00 0000map leaf, size 10: @2A → @2F
3C0E 15 00 0700 030000 00 0D000000 200000 00 32000000array leaf, size 21, shift 0, bitmap 0007, count 3 (root): @D → @20 → @32
51AC 73757065727365 646564txt "superseded"
5C02 00000000000000 00i64 0
650F 0A 51000000 5C00 0000map leaf, size 10: @51 → @5C
6FBC 7472616E736163 74696F6Etxt "transaction"
7B02 04000000000000 00i64 4
840F 0A 6F000000 7B00 0000map leaf, size 10: @6F → @7B
8E6C 726573756C74txt "result"
950F 0A 8E000000 3C00 0000map leaf, size 10: @8E → @3C
9F8C 73657175656E63 65txt "sequence"
A802 01000000000000 00i64 1
B10F 0A 9F000000 A800 0000map leaf, size 10: @9F → @A8
BB07 16 00330000 6500 0000 84000000 9500 0000 B1000000map branch, size 22, depth 0 (root), slots 8, 9, 12, 13: @65 → @84 → @95 → @B1