Skip to content

Commit 62d221c

Browse files
committed
up
1 parent 2b4edc4 commit 62d221c

File tree

4 files changed

+27
-36
lines changed

4 files changed

+27
-36
lines changed

cli/fledger/src/realm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use clap::Subcommand;
2-
use flcrypto::access::Condition;
2+
use flcrypto::{access::Condition, signer::SignerTrait};
33
use flmodules::{
44
dht_storage::{core::RealmConfig, realm_view::RealmViewBuilder},
55
flo::realm::Realm,

cli/fledger/src/simulation.rs

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,19 @@ impl SimulationHandler {
188188
log::info!("SIMULATION END");
189189
absolute_counter!("fledger_simulation_end", 1);
190190

191-
ds.get_flos(&rv.realm.realm_id())
192-
.await
193-
.unwrap()
194-
.iter()
195-
.for_each(|flo| {
196-
let flo_type = type_name::<BlobTag>();
197-
if flo.flo_type() == flo_type {
198-
let tag = BlobTag::from_rmp_bytes(flo_type, &flo.data()).unwrap();
199-
log::info!(
200-
"tag found {}/{}/{} | {}",
201-
flo.flo_id(),
202-
flo.realm_id(),
203-
flo.version(),
204-
tag.0.values().iter().next().unwrap().1,
205-
)
206-
}
207-
});
191+
ds.get_flos().await.unwrap().iter().for_each(|flo| {
192+
let flo_type = type_name::<BlobTag>();
193+
if flo.flo_type() == flo_type {
194+
let tag = BlobTag::from_rmp_bytes(flo_type, &flo.data()).unwrap();
195+
log::info!(
196+
"tag found {}/{}/{} | {}",
197+
flo.flo_id(),
198+
flo.realm_id(),
199+
flo.version(),
200+
tag.0.values().iter().next().unwrap().1,
201+
)
202+
}
203+
});
208204

209205
let tags = rv.tags;
210206

@@ -246,7 +242,7 @@ impl SimulationHandler {
246242

247243
rv.update_tags().await?;
248244

249-
let flos = ds.get_flos(&rv.realm.realm_id()).await.unwrap().clone();
245+
let flos = ds.get_flos().await.unwrap().clone();
250246
// flos.iter().for_each(|flo| {
251247
// log::info!(
252248
// "flo found {}/{}/{} [{}]",
@@ -430,6 +426,7 @@ impl SimulationHandler {
430426
log::warn!("SIMULATION TIMEOUT REACHED ({}ms)", timeout_ms);
431427
log::info!("SIMULATION END");
432428
absolute_counter!("fledger_simulation_timeout", 1);
429+
absolute_counter!("fledger_simulation_success", 0);
433430
f.loop_node(crate::FledgerState::Forever).await?;
434431

435432
return Ok(());
@@ -441,20 +438,27 @@ impl SimulationHandler {
441438

442439
let rv = RealmView::new_first(ds.clone()).await?;
443440

444-
let pages = ds.get_flos(&rv.realm.realm_id()).await.unwrap().clone();
441+
let pages = ds.get_flos().await.unwrap().clone();
445442
let pages = pages
446443
.iter()
447444
.filter(|flo| flo.flo_type() == type_name::<BlobPage>())
448445
.map(|flo| BlobPage::from_rmp_bytes(&flo.flo_type(), &flo.data()).unwrap());
449446

450-
let mut had_simulation_page_before_fetch = false;
447+
let mut simulation_page_stored_this_iteration = false;
451448
pages.clone().for_each(|page| {
452449
let page_name = page.0.values().iter().next().unwrap().1;
453450
log::info!("page found {}", page_name);
454451
if page_name == "simulation-page" {
455-
had_simulation_page_before_fetch = true;
452+
simulation_page_stored_this_iteration = true;
456453
}
457454
});
455+
456+
if simulation_page_stored_this_iteration {
457+
absolute_counter!("fledger_simulation_page_stored", 1);
458+
} else {
459+
absolute_counter!("fledger_simulation_page_stored", 0);
460+
}
461+
458462
absolute_counter!("fledger_pages_total", pages.count() as u64);
459463

460464
let ds_size = ds.stats.borrow().realm_stats.iter().next().unwrap().1.size;
@@ -488,7 +492,7 @@ impl SimulationHandler {
488492
page_content.chars().take(50).collect::<String>()
489493
);
490494

491-
if had_simulation_page_before_fetch {
495+
if simulation_page_stored_this_iteration {
492496
log::warn!("had simulation page before fetch");
493497
absolute_counter!("fledger_simulation_stored_before_fetch", 1);
494498
} else {

flmodules/src/dht_storage/broker.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ pub(super) const MODULE_NAME: &str = "DHTStorage";
3636

3737
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
3838
pub enum DHTStorageIn {
39-
ReadFlos(RealmID),
4039
StoreFlo(Flo),
4140
ReadFlo(GlobalID),
4241
ReadCuckooIDs(GlobalID),
@@ -217,15 +216,6 @@ impl DHTStorage {
217216
.await?)
218217
}
219218

220-
pub async fn get_flos(&mut self, realm_id: &RealmID) -> anyhow::Result<Vec<Flo>> {
221-
Ok(self
222-
.send_wait(DHTStorageIn::ReadFlos(realm_id.clone()), &|msg| match msg {
223-
DHTStorageOut::Flos(flos) => Some(flos.clone()),
224-
_ => None,
225-
})
226-
.await?)
227-
}
228-
229219
pub fn sync(&mut self) -> anyhow::Result<()> {
230220
Ok(self.broker.emit_msg_in(DHTStorageIn::SyncFromNeighbors)?)
231221
}

flmodules/src/dht_storage/messages.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,6 @@ impl Messages {
196196
)
197197
.into()]
198198
}
199-
DHTStorageIn::ReadFlos(realm_id) => {
200-
vec![DHTStorageOut::Flos(self.realms.get(&realm_id).unwrap().get_flos()).into()]
201-
}
202199
}
203200
}
204201

0 commit comments

Comments
 (0)