Skip to content

docs: add docs describing how CoreCryptoCancellationToken works - #2356

Merged
SimonThormeyer merged 2 commits into
mainfrom
simon/docs/cancellation-token
Jul 28, 2026
Merged

docs: add docs describing how CoreCryptoCancellationToken works#2356
SimonThormeyer merged 2 commits into
mainfrom
simon/docs/cancellation-token

Conversation

@SimonThormeyer

Copy link
Copy Markdown
Member

see above

@SimonThormeyer
SimonThormeyer requested a review from a team July 21, 2026 12:29
@SimonThormeyer
SimonThormeyer force-pushed the simon/docs/cancellation-token branch 2 times, most recently from 506851a to 91f376a Compare July 21, 2026 12:30
@SimonThormeyer SimonThormeyer changed the title docs: add docs describing how CoreCryptoCancellationToken works. docs: add docs describing how CoreCryptoCancellationToken works Jul 21, 2026
@SimonThormeyer
SimonThormeyer force-pushed the simon/docs/cancellation-token branch from 91f376a to 899ceb5 Compare July 21, 2026 12:31
Comment thread crypto-ffi/src/cancellation/mod.rs Outdated
//! [crate::CoreCryptoFfi::transaction_ffi_cancellable] ensures that this constraint isn't violated by only filling the
//! slot after the transaction semaphore was acquired. *This constraint makes the [CancellationSlot] currently only
//! usable in transactions*.
//! The slot is cloned to this crate's structs implementing foreign traits, currently [crate::MlsTransport] and

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean to "clone the slot to this crate's structs"? Did you mean "add" instead of "clone"?

//! To make a future cancellable, we race the future against [CoreCryptoCancellationToken::cancelled] using
//! [futures_util::select_biased], with a bias for [CoreCryptoCancellationToken::cancelled] - in case both futures
//! complete at the same time, cancellation is preferred. If cancellation wins, we return an appropriate error.
//!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This already helps quite a bit, but I think we can go one step further and really make things clear by outlining the sequence of steps that occur, both on the Rust side and the foreign language side.
IOW, something like a sequence diagram would be helpful to show when tokens are created, when the slots are filled, when the guards are dropped etc.

@SimonThormeyer
SimonThormeyer force-pushed the simon/docs/cancellation-token branch 4 times, most recently from c406744 to 168a651 Compare July 27, 2026 08:18

@coriolinus coriolinus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work with the diagram!

Comment thread crypto-ffi/src/core_crypto/command/mod.rs Outdated
@SimonThormeyer
SimonThormeyer force-pushed the simon/docs/cancellation-token branch from 168a651 to 0aff81f Compare July 28, 2026 13:10
@SimonThormeyer
SimonThormeyer force-pushed the simon/docs/cancellation-token branch from 0aff81f to 9da73f2 Compare July 28, 2026 13:10
@SimonThormeyer
SimonThormeyer merged commit 9da73f2 into main Jul 28, 2026
8 of 9 checks passed
@SimonThormeyer
SimonThormeyer deleted the simon/docs/cancellation-token branch July 28, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants