Preview.5 froze the V4.0 source contract: 64 functions, 14 public types.
V4.0.0 Stable preserves it unchanged. See Stable record.
Include <layerkeysort.h> only. Freeze specifies ownership,
statuses and persistent compatibility; migration covers the
major source break. V4.0.0 is recommended Stable; V3.1.0 remains available for legacy contracts.
LksStatus uses explicit numbers; unknown integers return "Unknown status". Comparator contains compare/context: ManagedOrder retains descriptor, borrows context until destruction; Group/sort borrow per operation. Comparison semantics must remain consistent. lks_sort stable-sorts pointers in place; OOM preserves input, fewer than two items allocates nothing.
Order owns structure, borrows non-NULL items. Relative/end insertion creates occurrences. Remove frees structure only; own removal/source destruction expires handle. Moves preserve handles; foreign valid handles rejected. No-op preserves cursors/currentness. Traversal is logical order; no rank/physical topology API. Cursor borrows source, direction0/1; actual mutation invalidates before cached handle access. Destroy cursor before source. See complete header error comments.
Comparator-managed contextual core, stable upper-bound insertion. Locate gives predecessor/first equal/successor. Remove uses handle; no arbitrary move/core escape. Remove before changing comparison-relevant data then reinsert, or reconstruct.
Group owns flat copied array, borrows items, no index/Path. Stable build/fresh merge with Base-before-Incoming equality. Batch owns sorted chunks; borrowed views expire with Batch, merge-all favors earlier chunks and returns independently owned Group. Empty build still requires comparator; chunk size must be nonzero.
Capture owns copied namespace/associations; callback span must remain valid through immediate copying after return. Historical rows survive source/items. Currentness requires existing source marker/mutation generation; loaded snapshots never current. LS1 exact lower-hex namespace/ordinal grammar and LKS4SNP1 explicit BE format are frozen. Format/serialize allocate nothing; text length excludes NUL, binary length counts exact bytes; undersized destination remains untouched. Restore resolves non-NULL caller-owned objects into fresh live handles; failures publish NULL and free temporary state. Callback side effects are not rolled back. Strict LK1 import preserves legacy coordinates without public legacy live APIs.
Exact signatures/per-function requirements: public header. Typed compile/link references cover every declaration; C/C++ consumers exercise all families. tools/verify_v4_api.py rejects unreviewed signature/layout/name changes.
lks_group_batch_buildlks_group_batch_destroylks_group_batch_group_atlks_group_batch_group_countlks_group_batch_group_sizelks_group_batch_merge_alllks_group_batch_sizelks_group_buildlks_group_destroylks_group_item_atlks_group_mergelks_group_sizelks_group_snapshot_capturelks_group_snapshot_is_current
lks_managed_order_comparelks_managed_order_createlks_managed_order_cursor_createlks_managed_order_destroylks_managed_order_firstlks_managed_order_insertlks_managed_order_lastlks_managed_order_locatelks_managed_order_removelks_managed_order_sizelks_managed_order_snapshot_capturelks_managed_order_snapshot_is_current
lks_order_comparelks_order_createlks_order_cursor_createlks_order_cursor_destroylks_order_cursor_nextlks_order_destroylks_order_firstlks_order_import_v3_lk1lks_order_insert_afterlks_order_insert_backlks_order_insert_beforelks_order_insert_frontlks_order_itemlks_order_lastlks_order_move_afterlks_order_move_backlks_order_move_beforelks_order_move_frontlks_order_nextlks_order_previouslks_order_removelks_order_sizelks_order_snapshot_capturelks_order_snapshot_is_current
lks_snapshot_associationlks_snapshot_countlks_snapshot_deserializelks_snapshot_destroylks_snapshot_key_comparelks_snapshot_key_formatlks_snapshot_key_lengthlks_snapshot_key_validatelks_snapshot_namespacelks_snapshot_restore_orderlks_snapshot_serializelks_snapshot_serialized_size
lks_sortlks_status_string