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WXL6KQGYGDUQRCVJCEVIV6CKJSEIYDX4YF33OX6EDNKJNEGD2AC
4OCC6D42GZYRDLH3NSKXMJTRKXP7UZ6Z3YNGCNUT7NT6WBDBCBIAC
HMMMKONLCRAXVT7SO2ITTFDOJIQKKVSRIZPXYVPDC34RCBHWMHVAC
6DOXSHWGKJIMIPFCNLASGKBAJCJMJULW5HFRZAZ67EYSMXXGJ3KAC
Y6EVFMTA6FOH3OQH6QCSWMI3F6SYZT2FSHO6GF4M3ICENDCWFM4QC
3J6IK4W2BA4RJJQYXZOQFU4AQ3WJIM3TUXUNNBIQ6M6TS2JSHT6QC
I52XSRUH5RVHQBFWVMAQPTUSPAJ4KNVID2RMI3UGCVKFLYUO6WZAC
KQTD46KVVWMJ3W6O55BEJLCVTNTDLUH6QT46AEFT7OU2SELXG4IAC
IIV3EL2XYI2X7HZWKXEXQFAE3R3KC2Q7SGOT3Q332HSENMYVF32QC
UFCZKKLXVYQYQBYENCAFHY3ZPPSDAJJAIREZSYNQM4QNXV6G6RXAC
VO5OQW4W2656DIYYRNZ3PO7TQ4JOKQ3GVWE5ALUTYVMX3WMXJOYQC
5BRU2RRWOQBMS2V3RQM7PRFR5UILYZ73GISHAKJA6KIZGC5M2MFAC
3AMEP2Y5J6GA4AWQONF4JVA3XSR3ASLHHKMYG44R72SOUY3UQCDAC
use rand::Rng;
let s: String = rand::thread_rng()
.sample_iter(&rand::distributions::Alphanumeric)
.take(30)
.map(|c| c as char)
.collect();
let s = {
let mut c = [0u8; 16];
unsafe {
*(c.as_mut_ptr() as *mut Position<ChangeId>) = output_item.pos
}
data_encoding::BASE32_NOPAD.encode(blake3::hash(&c).as_bytes())
};
fn add_file(&mut self, path: &str) -> Result<(), fs::FsError<Self::GraphError>> {
fs::add_inode(self, None, path, false)
fn add_file(&mut self, path: &str, salt: u64) -> Result<(), fs::FsError<Self::GraphError>> {
fs::add_inode(self, None, path, false, salt)
fn add_dir(&mut self, path: &str) -> Result<(), fs::FsError<Self::GraphError>> {
fs::add_inode(self, None, path, true)
fn add_dir(&mut self, path: &str, salt: u64) -> Result<(), fs::FsError<Self::GraphError>> {
fs::add_inode(self, None, path, true, salt)
fn add(&mut self, path: &str, is_dir: bool) -> Result<(), fs::FsError<Self::GraphError>> {
fs::add_inode(self, None, path, is_dir)
fn add(&mut self, path: &str, is_dir: bool, salt: u64) -> Result<(), fs::FsError<Self::GraphError>> {
fs::add_inode(self, None, path, is_dir, salt)
fn move_file(&mut self, a: &str, b: &str) -> Result<(), fs::FsError<Self::GraphError>> {
fs::move_file(self, a, b)
fn move_file(&mut self, a: &str, b: &str, salt: u64) -> Result<(), fs::FsError<Self::GraphError>> {
fs::move_file(self, a, b, salt)
pub(crate) fn create_new_inode<T: TreeMutTxnT>(txn: &mut T) -> Result<Inode, TxnErr<T::TreeError>> {
let mut already_taken = true;
let mut inode: Inode = Inode::ROOT;
while already_taken {
inode = Inode::random();
already_taken = txn.get_revtree(&inode, None)?.is_some();
pub(crate) fn create_new_inode<T: TreeMutTxnT>(txn: &mut T, parent_id: &PathId, salt: u64) -> Result<Inode, TxnErr<T::TreeError>> {
use std::hash::{BuildHasher, Hash, Hasher};
let mut s = crate::Hasher::default().build_hasher();
(parent_id, salt).hash(&mut s);
let mut i: u64 = s.finish();
let mut inode = Inode(L64(i.to_le()));
while txn.get_revtree(&inode, None)?.is_some() {
i += 1;
inode = Inode(L64(i.to_le()));