Function persist_into_index
pub fn persist_into_index(
uploads: &mut HashMap<String, UploadEntry>,
bytes: &[u8],
filename: &str,
upload_root: &str,
) -> Result<FileEntryResult, JsonRpcError>Expand description
Hash, deduplicate, persist, and index one uploaded payload into a session’s upload index.
Shared by file/attach, file/upload/commit, and prompt attachments, so
every path names, stores, and marks uploads identically: the on-disk name
is the content hash, written through the hardened content-addressed
writer, and a repeat of the same bytes in the same session returns the
existing entry once its file is verified to still hold them.
Synchronous by design: callers run it under the session map lock, so the dedup lookup, the write, and the index insert cannot interleave with a change to the session.