Skip to main content

write_split_tokens

Function write_split_tokens 

Source
fn write_split_tokens(
    ns: &str,
    tokens: &MuxBusTokens,
) -> Result<Vec<(String, PriorKeychainState)>, StoreError>
Expand description

Write all three token fields, each independently chunked (write_chunked_field). On a later field’s failure, rolls back every entry every earlier field in this call already wrote — otherwise a partial failure would leave the three fields holding a mix of old and new tokens, which is worse than either the old or the new set alone.

On success, returns every entry’s PRE-call state (across all three fields) so muxbus_save’s SQL-write failure branch can roll all of it back together too.