WSHUT37CPBBR5JHWAHR27BKOADUWPUHYBWBJPNI6TEQ47TDWTL7QC W2ZEVC64ORZWKRPSQ3JFLIV54FYOTHIK2VW7H7HASO3Z6RC66LSQC FS2NWBVN2SZB2FFPB3JSYT5URTVZEAZWMQ7QW4JUYPNJVDVAJTTQC DSWQKJRHGLKXUDXKMRXCIQZKEGXYV3H5LPUMGSV4HQ4HYPTI47GQC W3M3C7CCWHJWRWHULDWO45D3OFD4NL3V4OTJVIJCYRQG57Z2JTWQC 5UNA2DEALCSRBINR27KSA6OMD6GQAXHYZ35ICQ7NB62G2XP4FT5QC K4JNAJOFEJLHHWP6YSCC2U3CNK3ZPPX6EMBAVQG4VRPZWZRXMPCQC let patch_path = p.repository(&repoman.storage_root).unwrap().changestore().change_file(apply).unwrap();
let repo = p.repository(&repoman.storage_root).unwrap();let hash =if let Some(h) = crate::models::pijul::changestores::Changestore::hash_from_string(apply) {h} else {return rocket::http::Status::InternalServerError;};let patch_path = repo.changestore().change_file(hash);repo.changestore().ensure_parent_dirs(hash);
#[derive(FromForm)]struct IdentitiesReq {identities: Vec<String>,}use rocket::serde::{json::Json, Serialize};#[derive(Serialize)]struct Identities {id: Vec<String>,rev: u64,}// TODO figure out what I'm supposed to send here?#[get("/<org_path>/<proj_path>/.pijul?<id_req>", rank = 3)]fn identities(org_path: String, proj_path: String, id_req: IdentitiesReq) -> Json<Identities> {println!("{:?}", id_req.identities);Json(Identities { id: vec![], rev: 0 })}
}// Checks if the change is on disk, and if we can deserializepub fn valid_change(&self, hash: Hash) -> bool {libpijul::change::Change::deserialize(&self.changestore().change_file(hash).to_string_lossy(),Some(&hash),).is_ok()}// TODO maybe make a proper channel struct etc laterpub fn apply_change_to_channel(&self, chan: &str, change: Hash) -> Result<(), anyhow::Error> {let mut txn = self.pristine()?.mut_txn_begin()?;let chan = if let Some(chan) = txn.load_channel(chan)? {chan} else {bail!("channel not found")};{let mut write_channel = chan.write();txn.apply_change(&libpijul::changestore::filesystem::FileSystem::from_changes(self.changestore().dir(),),&mut write_channel,&change,)?;}txn.commit()?;Ok(())
// change_file will ensure parent directories are created thus has side-effects on diskpub fn change_file(&self, hash: String) -> Result<PathBuf, anyhow::Error> {let h = if let Some(h) = Hash::from_base32(hash.as_bytes()) {h} else {bail!("invalid hash to store a change")};