Skip to content

Commit

Permalink
chore!: remove Archiver (#125)
Browse files Browse the repository at this point in the history
Creating archive files is performed by Hornet.
  • Loading branch information
Alexandcoats authored May 5, 2022
1 parent a42d4ea commit 9249cf1
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 110 deletions.
58 changes: 0 additions & 58 deletions bin/inx-chronicle/src/archiver.rs

This file was deleted.

7 changes: 0 additions & 7 deletions bin/inx-chronicle/src/collector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ impl HandleEvent<Report<Solidifier>> for Collector {
}
Report::Error(report) => match &report.error {
ActorError::Result(e) => match e {
solidifier::SolidifierError::MissingArchiver => {
solidifiers.insert(report.actor.id, cx.spawn_child(report.actor).await);
}
solidifier::SolidifierError::MissingInxRequester => {
solidifiers.insert(report.actor.id, cx.spawn_child(report.actor).await);
}
Expand All @@ -101,8 +98,6 @@ impl HandleEvent<Report<Solidifier>> for Collector {

#[cfg(feature = "stardust")]
pub mod stardust {
use std::collections::BTreeMap;

use chronicle::{
db::model::stardust::{
message::{MessageMetadata, MessageRecord},
Expand All @@ -117,15 +112,13 @@ pub mod stardust {
pub struct MilestoneState {
pub milestone_index: u32,
pub process_queue: VecDeque<MessageId>,
pub messages: BTreeMap<MessageId, Vec<u8>>,
}

impl MilestoneState {
pub fn new(milestone_index: u32) -> Self {
Self {
milestone_index,
process_queue: VecDeque::new(),
messages: BTreeMap::new(),
}
}
}
Expand Down
14 changes: 1 addition & 13 deletions bin/inx-chronicle/src/collector/solidifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ use chronicle::{
use mongodb::bson::document::ValueAccessError;
use thiserror::Error;

use crate::archiver::Archiver;

#[derive(Debug, Error)]
pub enum SolidifierError {
#[error(transparent)]
Doc(#[from] DocError),
#[error("the archiver is missing")]
MissingArchiver,
#[cfg(feature = "stardust")]
#[error("the INX requester is missing")]
MissingInxRequester,
Expand Down Expand Up @@ -97,7 +93,6 @@ mod stardust {
.map(|b| MessageId::from_str(b.as_str().unwrap()))
.collect::<Result<Vec<MessageId>, _>>()
.unwrap();
ms_state.messages.insert(*message_id, message_doc.take_bytes("raw")?);
ms_state.process_queue.extend(parents);
}
ms_state.process_queue.pop_front();
Expand Down Expand Up @@ -127,21 +122,14 @@ mod stardust {
}
}
// If we finished all the parents, that means we have a complete milestone
// so we should mark it synced and send it to the archiver
// so we should mark it synced
self.db
.upsert_sync_record(&SyncRecord {
milestone_index: ms_state.milestone_index,
logged: false,
synced: true,
})
.await?;
cx.addr::<Archiver>()
.await
.send((
ms_state.milestone_index,
ms_state.messages.into_values().collect::<Vec<_>>(),
))
.map_err(|_| SolidifierError::MissingArchiver)?;
Ok(())
}
}
Expand Down
32 changes: 0 additions & 32 deletions bin/inx-chronicle/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/// Module containing the API.
#[cfg(feature = "api")]
mod api;
mod archiver;
mod cli;
mod collector;
mod config;
Expand All @@ -15,7 +14,6 @@ mod inx;

use std::error::Error;

use archiver::Archiver;
use async_trait::async_trait;
use chronicle::{
db::MongoDb,
Expand Down Expand Up @@ -81,7 +79,6 @@ impl Actor for Launcher {
log::info!("No node status has been found in the database, it seems like the database is empty.");
};

cx.spawn_child(Archiver::new(db.clone())).await;
cx.spawn_child(Collector::new(db.clone(), 1)).await;

#[cfg(feature = "inx")]
Expand Down Expand Up @@ -130,35 +127,6 @@ impl HandleEvent<Report<Collector>> for Launcher {
}
}

#[async_trait]
impl HandleEvent<Report<Archiver>> for Launcher {
async fn handle_event(
&mut self,
cx: &mut ActorContext<Self>,
event: Report<Archiver>,
_config: &mut Self::State,
) -> Result<(), Self::Error> {
match event {
Report::Success(_) => {
cx.shutdown();
}
Report::Error(report) => match &report.error {
#[allow(clippy::match_single_binding)]
ActorError::Result(e) => match e {
// TODO
_ => {
cx.shutdown();
}
},
ActorError::Panic | ActorError::Aborted => {
cx.shutdown();
}
},
}
Ok(())
}
}

#[cfg(feature = "inx")]
#[async_trait]
impl HandleEvent<Report<InxWorker>> for Launcher {
Expand Down

0 comments on commit 9249cf1

Please sign in to comment.