Skip to content

Commit

Permalink
Merge pull request #19 from THCLab/feat/list_ref
Browse files Browse the repository at this point in the history
Feat: list references
  • Loading branch information
olichwiruk authored Nov 14, 2023
2 parents 5678162 + 21e3525 commit fde469b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions oca/src/facade/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use oca_bundle::state::oca::{
capture_base::CaptureBase, DynOverlay, OCABundle,
};

use std::collections::HashMap;
use std::rc::Rc;
use serde::Serialize;

Expand Down Expand Up @@ -105,6 +106,19 @@ impl Facade {
},
}
}
#[cfg(feature = "local-references")]
pub fn fetch_all_refs(
&self,
) -> Result<HashMap<String, String>, String> {

let mut refs: HashMap<String, String> = HashMap::new();
self.db.get_all(Namespace::OCAReferences).unwrap()
.iter()
.for_each(|(k, v)| {
refs.insert(k.clone(), String::from_utf8(v.to_vec()).unwrap());
});
return Ok(refs);
}

pub fn fetch_all_oca_bundle(
&self,
Expand Down

0 comments on commit fde469b

Please sign in to comment.