Skip to main content

Module tls_map

Module tls_map 

Source
Expand description

A deterministic, sorted key-value map with TLS codec serialization.

TlsMap maintains entries in sorted key order so that serialization is byte-identical across implementations. TlsMapDelta provides an atomic mutation batch (insert / update / delete) that can be serialized independently and applied to a map with automatic rollback on failure.

§Complexity

Backed by a sorted Vec, so lookup is O(log n) via binary search, while insert, update, and remove are O(n) due to element shifting. This is a deliberate trade-off for deterministic serialization and small map sizes typical in MLS group state. Do not use this as a general-purpose map for large datasets — use std::collections::BTreeMap or std::collections::HashMap instead.

In testing, a Vec and a BTreeMap were used to compare performance. The Vec was faster even for large maps at up to 50k entries for all operations except for insert and remove which were only half as fast. The Vec implementation is more memory efficient and significantly faster at deserialization.

Structs§

TlsMap
A sorted key-value map with deterministic TLS codec serialization.
TlsMapDelta
A list of mutations to apply atomically to a TlsMap.
TlsMapEntry
A single key-value entry in a TlsMap.

Enums§

TlsMapError
Error type for TlsMap operations.
TlsMapMutation
A single mutation to apply to a TlsMap.