Skip to main content

Module device_store

Module device_store 

Source
Expand description

Conformance cases for DeviceStore backends (spec 3.3 §10 K2, §11 S-I7).

CaseContract
code_round_trip_and_take_onceA code reads back exactly as put, once: a second take finds nothing
take_returns_expired_codesA take returns a code past its expiry; the caller decides
prune_removes_expired_codesprune_codes removes the codes expired at or before the instant, and only those
clear_removes_every_codeclear_codes removes every waiting code
device_round_tripA device reads back exactly as put: every field, every scope
put_device_replacesA second put of one device replaces it, as a revocation does
list_devices_orders_by_pairing_then_idlist_devices orders by pairing time, then id
unknown_idsAn unknown device and an unknown code are None
records_survive_a_restartDevices and codes read back through a new handle (durable backends only)
concurrent_takes_take_onceEight concurrent takes of one code from two handles take it once
concurrent_writersConcurrent puts from two handles over distinct devices and codes lose none
claim_attempts_are_counted_once_and_sharedConcurrent claim counts from two handles each get a distinct count, a reset starts again at one, and the count survives a restart
attachments_round_trip_per_kindAn attachment reads back exactly as put, listed under its holder and kind only, in key order
put_attachment_replacesA second put of one holder, kind and key replaces it
put_attachment_if_absent_writes_onceEight concurrent puts-if-absent of one attachment from two handles write it once
remove_attachment_removes_oneRemoving one attachment says whether it was there and leaves the rest
remove_attachments_removes_the_holdersRemoving a holder’s attachments removes every kind of it and nothing of another holder
attachments_survive_a_restartAttachments read back through a new handle (durable backends only)

Every case writes under fresh ids and hashes, so a harness may point every case at one shared database, except clear_removes_every_code, which removes every code, and claim_attempts_are_counted_once_and_shared, which uses the one count of claims: give each a database of its own, as the harnesses of this crate give every case.

Traits§

DeviceStoreHarness
Opens a DeviceStore backend for the conformance suite.

Functions§

attachments_round_trip_per_kind
An attachment reads back exactly as put, listed under its holder and kind only, in key order.
attachments_survive_a_restart
Attachments read back through a new handle (durable backends only).
claim_attempts_are_counted_once_and_shared
Concurrent claim counts from two handles each get a distinct count, a reset starts the count again at one, and a durable count survives a restart, so replicas share the count of wrong codes.
clear_removes_every_code
clear_codes removes every waiting code.
code_round_trip_and_take_once
A code reads back exactly as put, once.
concurrent_takes_take_once
Eight concurrent takes of one code from two handles take it once.
concurrent_writers
Concurrent puts from two handles over distinct devices and codes lose none.
device_round_trip
A device reads back exactly as put.
list_devices_orders_by_pairing_then_id
list_devices orders by pairing time, then id.
prune_removes_expired_codes
prune_codes removes the codes expired at or before the instant, and only those.
put_attachment_if_absent_writes_once
Eight concurrent puts-if-absent of one attachment from two handles write it once.
put_attachment_replaces
A second put of one holder, kind and key replaces it.
put_device_replaces
A second put of one device replaces it.
records_survive_a_restart
Devices and codes read back through a new handle.
remove_attachment_removes_one
Removing one attachment says whether it was there and leaves the rest.
remove_attachments_removes_the_holders
Removing a holder’s attachments removes every kind of it and nothing of another holder.
take_returns_expired_codes
A take returns a code past its expiry.
unknown_ids
An unknown device and an unknown code are None.