pub fn persist_pairing(
storage: &dyn Storage,
record: StoredPsk,
live: Option<&str>,
) -> Result<()>Expand description
Stores record under the record rules: newest at the end, at most MAX_PAIRINGS, never the
record backing the live connection.
This is the operation the client uses after a completed pairing, and it works for any
Storage: the rule is the crate’s, not a backend’s. record.server_id is the server being
paired with, which may or may not be live; the live server is the one the connection is
currently talking to, and its record is never chosen as a victim.
The store is read first, so room is made before the new record is written: a pairing never fails
for lack of space. The victim is dropped through Storage::remove_pairing, because eviction
writes only through the trait. If a backend call fails, the error is returned; records it
already removed stay removed and record is not stored.