PhoenixmlDb.XQuery
TreeOrdinalAllocator
Allocates process-global, monotonic tree ordinals stamped onto XdmNode.TreeOrdinal so that XDM document order — the pair (TreeOrdinal, Id) — is total and consistent across nodes drawn from independently-constructed node stores (issue #188).
#TreeOrdinalAllocator
Namespace: PhoenixmlDb.XQuery
Allocates process-global, monotonic tree ordinals stamped onto XdmNode.TreeOrdinal so that XDM document order — the pair (TreeOrdinal, Id) — is total and consistent across nodes drawn from independently-constructed node stores (issue #188).
A single static counter feeds every store in the process, so two independently-parsed instances receive disjoint ordinals and their nodes never interleave by the (per-store, non-unique) NodeId. Parse-time ordinals occupy the low range (high bit clear); construction-time ordinals set the high bit (). Because any construction ordinal therefore exceeds any parse ordinal, constructed trees always sort after parsed documents regardless of the order in which they are allocated within a query — preserving the legacy single-store rule that constructed nodes sort last. Within a single store this is order-preserving: documents are stamped with ascending ordinals in load order (matching their ascending NodeId blocks), and all of a store's constructed nodes share one construction epoch (tie-broken by NodeId), so (TreeOrdinal, Id) reduces to the pre-existing NodeId order. See DocumentOrderTests / DocumentOrderBug188Tests.
#Methods
#NextConstructionOrdinal
Allocates the next construction-time ordinal (high range, high bit set).
#NextParseOrdinal
Allocates the next parse-time ordinal (low range, high bit clear).
#Fields
| Name | Description |
|---|---|
ConstructedFlag
|
High bit marking a construction-time ordinal; guarantees it outranks any parse ordinal. |