refactor taskchampion::server into a module with submodules

This commit is contained in:
Dustin J. Mitchell 2020-11-24 18:04:49 -05:00
parent 7cfa27fc7e
commit 549d3b9f6d
5 changed files with 13 additions and 6 deletions

View file

@ -37,6 +37,3 @@ pub use task::{Task, TaskMut};
/// Re-exported type from the `uuid` crate, for ease of compatibility for consumers of this crate.
pub use uuid::Uuid;
#[cfg(test)]
pub(crate) mod testing;

View file

@ -0,0 +1,6 @@
#[cfg(test)]
pub(crate) mod test;
mod types;
pub use types::{Blob, Server, VersionAdd};

View file

@ -1,9 +1,12 @@
/// A Blob is a hunk of encoded data that is sent to the server. The server does not interpret
/// this data at all.
pub type Blob = Vec<u8>;
/// VersionAdd is the response type from [`crate:server::Server::add_version`].
pub enum VersionAdd {
// OK, version added
/// OK, version added
Ok,
// Rejected, must be based on the the given version
/// Rejected, must be based on the the given version
ExpectedVersion(u64),
}
@ -18,3 +21,4 @@ pub trait Server {
fn add_snapshot(&mut self, username: &str, version: u64, blob: Blob);
}

View file

@ -296,8 +296,8 @@ impl TaskDB {
#[cfg(test)]
mod tests {
use super::*;
use crate::server::test::TestServer;
use crate::taskstorage::InMemoryStorage;
use crate::testing::testserver::TestServer;
use chrono::Utc;
use proptest::prelude::*;
use std::collections::HashMap;