Extract simlib

This commit is contained in:
Arthur Petukhovsky
2023-05-24 13:06:42 +03:00
parent f6b540ebfe
commit 06f493f525
14 changed files with 13 additions and 16 deletions

View File

@@ -19,7 +19,9 @@ pub mod receive_wal;
pub mod remove_wal;
pub mod safekeeper;
pub mod send_wal;
pub mod sim;
pub mod simlib;
#[cfg(test)]
pub mod simtest;
pub mod timeline;
pub mod wal_backup;
pub mod wal_service;

View File

@@ -1,11 +1,6 @@
pub mod chan;
pub mod client;
pub mod disk;
pub mod disklog;
pub mod node_os;
pub mod proto;
#[cfg(test)]
pub mod start_test;
pub mod sync;
pub mod tcp;
pub mod time;

View File

@@ -1,8 +1,4 @@
use super::{
node_os::NodeOs,
proto::{AnyMessage, ReplCell},
world::NodeId,
};
use crate::simlib::{node_os::NodeOs, proto::{ReplCell, AnyMessage}, world::NodeId};
/// Copy all data from array to the remote node.
pub fn run_client(os: NodeOs, data: &[ReplCell], dst: NodeId) {

View File

@@ -2,7 +2,7 @@ use std::sync::Arc;
use anyhow::Result;
use super::sync::{Mutex, Park};
use crate::simlib::sync::{Mutex, Park};
pub trait Storage<T> {
fn flush_pos(&self) -> u32;

View File

@@ -1,8 +1,10 @@
mod client;
mod disk;
mod server;
use std::{sync::Arc};
use super::{
client::run_client, disk::SharedStorage, disklog::run_server, proto::ReplCell, world::World,
};
use crate::{simlib::{world::World, proto::ReplCell}, simtest::{client::run_client, disk::SharedStorage, server::run_server}};
#[test]
fn start_simulation() {

View File

@@ -1,6 +1,8 @@
use std::collections::HashMap;
use super::{disk::Storage, node_os::NodeOs, proto::AnyMessage, world::NodeEvent};
use crate::simlib::{node_os::NodeOs, world::NodeEvent, proto::AnyMessage};
use super::disk::Storage;
pub struct DiskLog {
pub map: HashMap<String, u32>,