-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #154 from Holo-Host/crates/06-11
split up into crates
- Loading branch information
Showing
34 changed files
with
1,403 additions
and
1,056 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,14 @@ | ||
[package] | ||
name = "configure-holochain" | ||
version = "0.4.0" | ||
authors = ["Oleksii Filonenko <[email protected]>", "zo-el <[email protected]>"] | ||
edition = "2021" | ||
[workspace] | ||
|
||
[dependencies] | ||
again = "0.1" | ||
anyhow = "1.0" | ||
futures = "0.3.24" | ||
isahc = "1.7.2" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_yaml = "0.9.11" | ||
serde_json = "1.0.60" | ||
structopt = "0.3" | ||
tempfile = "3.1" | ||
tokio = { version = "1", features = ["full"] } | ||
tracing = { version = "0.1", features = ["attributes"] } | ||
tracing-futures = "0.2" | ||
tracing-subscriber = "0.2" | ||
rmp-serde = "1.1.0" | ||
url = "2.2" | ||
observability = "0.1.3" | ||
base64 = "0.13.0" | ||
reqwest = { version = "0.11", features = ["json"]} | ||
spinning_top = "0.2.4" | ||
holochain_conductor_api = "0.2.0" | ||
holochain_types = "0.2.0" | ||
holochain_websocket = "0.2.0" | ||
holochain_zome_types = "0.2.0" | ||
mr_bundle = "0.2.0" | ||
lazy_static = "1" | ||
ed25519-dalek = { version = "1.0.1", features = ["serde"] } | ||
thiserror = "1.0" | ||
members = [ | ||
"crates/configure-holochain", | ||
"crates/hpos_connect_hc", | ||
"crates/holo_happ_manager", | ||
"crates/test_utils" | ||
] | ||
|
||
[dependencies.hpos-config-core] | ||
git = "https://github.com/Holo-Host/hpos-config" | ||
rev = "bfaced6044ae570bf20d4528fa9aaafcc43ddeec" | ||
[profile.dev] | ||
opt-level = "z" | ||
|
||
[dependencies.hpos-config-seed-bundle-explorer] | ||
git = "https://github.com/Holo-Host/hpos-config" | ||
rev = "bfaced6044ae570bf20d4528fa9aaafcc43ddeec" | ||
|
||
[dev-dependencies.cargo-husky] | ||
version = "1" | ||
features = ["run-cargo-fmt", "run-cargo-clippy"] | ||
|
||
[target.'cfg(unix)'.dependencies] | ||
nix = "0.26.2" | ||
|
||
[dev-dependencies] | ||
lair_keystore_api = "0.2.3" | ||
snafu = "0.7.1" | ||
chrono = "0.4.22" | ||
test-case = "2.2.2" | ||
serial_test = { version = "0.9.0", features = ["async"] } | ||
[profile.release] | ||
opt-level = "z" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "configure-holochain" | ||
version = "0.5.0" | ||
authors = ["Oleksii Filonenko <[email protected]>", "zo-el <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_yaml = "0.9.11" | ||
tokio = { version = "1", features = ["full"] } | ||
tracing = { version = "0.1", features = ["attributes"] } | ||
tracing-subscriber = "0.2" | ||
url = "2.2" | ||
# observability = "0.1.3" | ||
holochain_types = "0.2.0" | ||
thiserror = "1.0" | ||
hpos_hc_connect = { version = "0.1.0", path = "../hpos_connect_hc" } | ||
|
||
[dependencies.hpos-config-core] | ||
git = "https://github.com/Holo-Host/hpos-config" | ||
rev = "bfaced6044ae570bf20d4528fa9aaafcc43ddeec" | ||
|
||
[target.'cfg(unix)'.dependencies] | ||
nix = "0.26.2" | ||
|
||
[dev-dependencies] | ||
test-case = "2.2.2" | ||
serial_test = { version = "0.9.0", features = ["async"] } | ||
test_utils = { path = "../test_utils" } |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Returns true if app should be kept active in holochain | ||
pub fn keep_app_active(installed_app_id: &str, happs_to_keep: Vec<String>) -> bool { | ||
happs_to_keep.contains(&installed_app_id.to_string()) || installed_app_id.contains("uhCkk") | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn verify_keep_app_active() { | ||
let happs_to_keep = vec!["elemental-chat:2".to_string(), "hha:1".to_string()]; | ||
let app_1 = "elemental-chat:1"; | ||
let app_2 = "elemental-chat:2"; | ||
let app_3 = "uhCkkcF0X1dpwHFeIPI6-7rzM6ma9IgyiqD-othxgENSkL1So1Slt::servicelogger"; | ||
let app_4 = "other-app"; | ||
|
||
assert_eq!(keep_app_active(app_1, happs_to_keep.clone()), false); | ||
assert_eq!(keep_app_active(app_2, happs_to_keep.clone()), true); // because it is in config | ||
assert_eq!(keep_app_active(app_3, happs_to_keep.clone()), true); // because it is hosted | ||
assert_eq!(keep_app_active(app_4, happs_to_keep.clone()), false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[package] | ||
name = "holo_happ_manager" | ||
version = "0.1.0" | ||
authors = ["zo-el <[email protected]>"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
hpos_hc_connect = { version = "0.1.0", path = "../hpos_connect_hc" } | ||
holochain_conductor_api = "0.2.0" | ||
holochain_types = "0.2.0" | ||
holochain_keystore = "0.2.0" | ||
getrandom = "0.2.10" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0.96" | ||
sodoken = "0.0.9" | ||
rmp-serde = "1.1.1" | ||
tracing = "0.1.37" | ||
tracing-subscriber = "0.3.17" | ||
tokio = "1.28.2" | ||
url2 = "0.0.6" | ||
|
||
[dev-dependencies] | ||
configure-holochain = { version = "0.5.0", path = "../configure-holochain"} | ||
serial_test = { version = "0.9.0", features = ["async"] } | ||
test_utils = { version = "0.1.0", path = "../test_utils" } | ||
|
||
[dev-dependencies.hpos-config-core] | ||
git = "https://github.com/Holo-Host/hpos-config" | ||
rev = "bfaced6044ae570bf20d4528fa9aaafcc43ddeec" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use super::hha::HHAAgent; | ||
use anyhow::{anyhow, Result}; | ||
use holochain_conductor_api::AppResponse; | ||
use holochain_types::prelude::ActionHashB64; | ||
use holochain_types::prelude::{zome_io::ExternIO, FunctionName, ZomeName}; | ||
use hpos_hc_connect::holo_config::{Config, Happ}; | ||
use serde::Deserialize; | ||
use tracing::debug; | ||
|
||
#[derive(Deserialize, Debug, Clone)] | ||
pub struct PresentedHappBundle { | ||
pub id: ActionHashB64, | ||
pub bundle_url: String, | ||
} | ||
|
||
pub async fn published(core_happ: &Happ, config: &Config) -> Result<Vec<PresentedHappBundle>> { | ||
let mut agent = HHAAgent::spawn(core_happ, config).await?; | ||
let response = agent | ||
.zome_call( | ||
ZomeName::from("hha"), | ||
FunctionName::from("get_my_happs"), | ||
ExternIO::encode(())?, | ||
) | ||
.await?; | ||
|
||
match response { | ||
// This is the happs list that is returned from the hha DNA | ||
// https://github.com/Holo-Host/holo-hosting-app-rsm/blob/develop/zomes/hha/src/lib.rs#L54 | ||
// return Vec of happ_list.happ_id | ||
AppResponse::ZomeCalled(r) => { | ||
let happ_bundles: Vec<PresentedHappBundle> = rmp_serde::from_slice(r.as_bytes())?; | ||
debug!("got happ bundles {:?}", happ_bundles); | ||
Ok(happ_bundles) | ||
} | ||
_ => Err(anyhow!("unexpected response: {:?}", response)), | ||
} | ||
} |
Oops, something went wrong.