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 #1494 from holochain/hot-swap-admin
Update coordinators admin interface
- Loading branch information
Showing
11 changed files
with
332 additions
and
21 deletions.
There are no files selected for viewing
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
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
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,68 @@ | ||
use holochain_serialized_bytes::prelude::*; | ||
use holochain_zome_types::CoordinatorZomes; | ||
use holochain_zome_types::WasmZome; | ||
use holochain_zome_types::ZomeDef; | ||
use mr_bundle::Manifest; | ||
|
||
use crate::prelude::DnaResult; | ||
use crate::prelude::DnaWasm; | ||
|
||
use super::hash_bytes; | ||
use super::CoordinatorManifest; | ||
|
||
#[derive( | ||
Debug, | ||
PartialEq, | ||
Eq, | ||
serde::Serialize, | ||
serde::Deserialize, | ||
SerializedBytes, | ||
shrinkwraprs::Shrinkwrap, | ||
derive_more::From, | ||
)] | ||
/// A bundle of coordinator zomes. | ||
pub struct CoordinatorBundle(mr_bundle::Bundle<CoordinatorManifest>); | ||
|
||
impl Manifest for CoordinatorManifest { | ||
fn locations(&self) -> Vec<mr_bundle::Location> { | ||
self.zomes | ||
.iter() | ||
.map(|zome| zome.location.clone()) | ||
.collect() | ||
} | ||
|
||
fn path() -> std::path::PathBuf { | ||
"coordinators.yaml".into() | ||
} | ||
|
||
fn bundle_extension() -> &'static str { | ||
"coordinators" | ||
} | ||
} | ||
|
||
impl CoordinatorBundle { | ||
/// Convert into zomes and their wasm files. | ||
pub async fn into_zomes(self) -> DnaResult<(CoordinatorZomes, Vec<DnaWasm>)> { | ||
let mut resources = self.resolve_all_cloned().await?; | ||
let coordinator = hash_bytes(self.manifest().zomes.iter().cloned(), &mut resources).await?; | ||
let coordinator_zomes = coordinator | ||
.iter() | ||
.map(|(zome_name, hash, _, dependencies)| { | ||
( | ||
zome_name.clone(), | ||
ZomeDef::Wasm(WasmZome { | ||
wasm_hash: hash.clone(), | ||
dependencies: dependencies.clone(), | ||
}) | ||
.into(), | ||
) | ||
}) | ||
.collect(); | ||
let wasms = coordinator | ||
.into_iter() | ||
.map(|(_, _, wasm, _)| wasm) | ||
.collect(); | ||
|
||
Ok((coordinator_zomes, wasms)) | ||
} | ||
} |
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
Oops, something went wrong.