Skip to content

Commit

Permalink
Catch first scenario up with runner helpers and add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ThetaSinner committed Mar 7, 2024
1 parent 869fdad commit dd81618
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
12 changes: 12 additions & 0 deletions scenarios/zome_call_single_value/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## zome_call_single_value

### Description

Calls a zome function that returns a fixed value. This tests the maximum performance of zome calls when the zome
function is not calling into Holochain other otherwise doing any work.

### Suggested run

```bash
RUST_LOG=info cargo run --package zome_call_single_value -- --connection-string ws://localhost:8888 --duration 900
```
16 changes: 1 addition & 15 deletions scenarios/zome_call_single_value/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,7 @@ fn agent_setup(
fn agent_behaviour(
ctx: &mut AgentContext<HolochainRunnerContext, HolochainAgentContext>,
) -> HookResult {
let cell_id = ctx.get().cell_id();
let mut app_agent_client = ctx.get().app_agent_client();
ctx.runner_context().executor().execute_in_place(async {
app_agent_client
.call_zome(
cell_id.into(),
"return_single_value".into(),
"get_value".into(),
ExternIO::encode(()).context("Encoding failure")?,
)
.await
.map_err(|e| anyhow::anyhow!("Conductor API error: {:?}", e))?;

Ok(())
})?;
let _: usize = call_zome(ctx, "return_single_value", "get_value", ())?;

Ok(())
}
Expand Down

0 comments on commit dd81618

Please sign in to comment.