Skip to main content

prepare_runtime_paths

Function prepare_runtime_paths 

Source
pub fn prepare_runtime_paths(
    resources: &Path,
    user_data: &Path,
    cache: &Path,
    content_id: &str,
) -> Result<RuntimePaths>
Expand description

校验代次 id(1 到 128 个 [0-9A-Za-z_-])和三个互不重叠的绝对路径根,建好 user_data 和 cache,清掉被丢下的暂存目录,然后要么对已就绪的代次重新回放日志(补上它缺的 n-gram 表),要么在这次尝试独有的 <id>.<随机串>.incoming 里暂存、回放、写 .ready 再改名就位。暂存失败只删自己的目录;同一个代次被别的进程抢先发布时用那一份。