Skip to content

Commit

Permalink
Add initial persistance to Maker & Taker data stores
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu-maeda committed Jan 2, 2024
1 parent bcd694a commit cd462f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/maker/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ impl MakerActorData {
let store = Arc::new(RwLock::new(store));
let (persist_tx, task_handle) =
Self::setup_persistance(store.clone(), trade_uuid, &dir_path);

Self {
let data = Self {
persist_tx,
trade_uuid,
store,
task_handle,
}
};
data.queue_persistance();
data
}

pub(crate) async fn restore(data_path: impl AsRef<Path>) -> Result<(Uuid, Self), N3xbError> {
Expand Down
7 changes: 4 additions & 3 deletions src/taker/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,14 @@ impl TakerActorData {
let store = Arc::new(RwLock::new(store));
let (persist_tx, task_handle) =
Self::setup_persistance(store.clone(), trade_uuid, &dir_path);

Self {
let data = Self {
persist_tx,
trade_uuid,
store,
task_handle,
}
};
data.queue_persistance();
data
}

pub(crate) async fn restore(data_path: impl AsRef<Path>) -> Result<(Uuid, Self), N3xbError> {
Expand Down

0 comments on commit cd462f4

Please sign in to comment.