MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / encode_session_todo_key

Function encode_session_todo_key

atomic-core/src/change/session.rs:464–471  ·  view source on GitHub ↗
(provenance_id: u64, todo_id: &str)

Source from the content-addressed store, hash-verified

462/// the B-tree) matches numeric order, enabling correct prefix range scans.
463#[inline]
464pub fn encode_session_todo_key(provenance_id: u64, todo_id: &str) -> [u8; 16] {
465 let hash = blake3::hash(todo_id.as_bytes());
466 let hash_bytes = hash.as_bytes();
467 let mut key = [0u8; 16];
468 key[0..8].copy_from_slice(&provenance_id.to_be_bytes());
469 key[8..16].copy_from_slice(&hash_bytes[0..8]);
470 key
471}
472
473/// Decode the `provenance_id` from a `SESSION_TODOS` key.
474///

Calls 2

hashFunction · 0.50
as_bytesMethod · 0.45