Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
zippy committed Jul 11, 2024
1 parent c03d603 commit 4a7a77e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
6 changes: 5 additions & 1 deletion crates/hpos_connect_hc/src/app_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ impl AppConnection {
}

/// Returns a cell for a given RoleName and CloneName in a connected app
pub async fn cloned_cell_id(&mut self, role_name: RoleName, clone_name: String) -> Result<CellId> {
pub async fn cloned_cell_id(
&mut self,
role_name: RoleName,
clone_name: String,
) -> Result<CellId> {
let cloned_cells = self.cloned_cells(role_name.clone()).await?;
let cell = cloned_cells
.into_iter()
Expand Down
23 changes: 16 additions & 7 deletions crates/hpos_connect_hc/src/sl_utils.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use anyhow::{anyhow, Result};
use chrono::DateTime;
use chrono::Datelike;
use chrono::Duration;
Expand All @@ -7,14 +8,13 @@ use chrono::Timelike;
use chrono::Utc;
use const_env::from_env;
use holochain_types::prelude::ClonedCell;
use anyhow::{anyhow, Result};

// General Notes:
// These constants are defined here for use by all the other repos
// that depend on service-logger function. They should only be overridden
// globally in holo-nixpkgs if the system wide determination is made to
// change the default values.
// The primary place that uses these values is hpos-api-rust, but other
// The primary place that uses these values is hpos-api-rust, but other
// repos may also consume them.

// Time-bucket Notes:
Expand Down Expand Up @@ -104,14 +104,23 @@ pub fn sl_clone_name(spec: SlCloneSpec) -> String {
}

pub struct SlCloneSpec {
pub days_in_bucket: u32,
pub days_in_bucket: u32,
pub time_bucket: u32,
}

/// returns the bucket size and bucket from a clone name
pub fn sl_clone_name_spec(name: &str) -> Result<SlCloneSpec> {
let mut parts = name.split(".");
let days_in_bucket = parts.next().ok_or(anyhow!("no days in clone name"))?.parse::<u32>()?;
let time_bucket = parts.next().ok_or(anyhow!("no bucket in clone name"))?.parse::<u32>()?;
Ok(SlCloneSpec{days_in_bucket, time_bucket})
}
let days_in_bucket = parts
.next()
.ok_or(anyhow!("no days in clone name"))?
.parse::<u32>()?;
let time_bucket = parts
.next()
.ok_or(anyhow!("no bucket in clone name"))?
.parse::<u32>()?;
Ok(SlCloneSpec {
days_in_bucket,
time_bucket,
})
}

0 comments on commit 4a7a77e

Please sign in to comment.