mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
move types in crate::types to crate::server
This commit is contained in:
parent
e84871931f
commit
2457d8bc43
5 changed files with 20 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
||||||
use crate::api::{
|
use crate::api::{
|
||||||
ServerState, HISTORY_SEGMENT_CONTENT_TYPE, PARENT_VERSION_ID_HEADER, VERSION_ID_HEADER,
|
ServerState, HISTORY_SEGMENT_CONTENT_TYPE, PARENT_VERSION_ID_HEADER, VERSION_ID_HEADER,
|
||||||
};
|
};
|
||||||
use crate::types::{AddVersionResult, ClientId, VersionId};
|
use crate::server::{AddVersionResult, ClientId, VersionId};
|
||||||
use actix_web::{
|
use actix_web::{
|
||||||
error, http::StatusCode, post, web, HttpMessage, HttpRequest, HttpResponse, Result,
|
error, http::StatusCode, post, web, HttpMessage, HttpRequest, HttpResponse, Result,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::api::{
|
use crate::api::{
|
||||||
ServerState, HISTORY_SEGMENT_CONTENT_TYPE, PARENT_VERSION_ID_HEADER, VERSION_ID_HEADER,
|
ServerState, HISTORY_SEGMENT_CONTENT_TYPE, PARENT_VERSION_ID_HEADER, VERSION_ID_HEADER,
|
||||||
};
|
};
|
||||||
use crate::types::{ClientId, VersionId};
|
use crate::server::{ClientId, VersionId};
|
||||||
use actix_web::{error, get, http::StatusCode, web, HttpResponse, Result};
|
use actix_web::{error, get, http::StatusCode, web, HttpResponse, Result};
|
||||||
|
|
||||||
/// Get a child version.
|
/// Get a child version.
|
||||||
|
|
|
@ -4,7 +4,6 @@ use server::{NullSyncServer, SyncServer};
|
||||||
|
|
||||||
mod api;
|
mod api;
|
||||||
mod server;
|
mod server;
|
||||||
mod types;
|
|
||||||
|
|
||||||
// TODO: use hawk to sign requests
|
// TODO: use hawk to sign requests
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
use crate::types::{AddVersionResult, ClientId, GetVersionResult, HistorySegment, VersionId};
|
|
||||||
use failure::Fallible;
|
use failure::Fallible;
|
||||||
use taskchampion::Uuid;
|
use taskchampion::Uuid;
|
||||||
|
|
||||||
|
pub(crate) type HistorySegment = Vec<u8>;
|
||||||
|
pub(crate) type ClientId = Uuid;
|
||||||
|
pub(crate) type VersionId = Uuid;
|
||||||
|
|
||||||
|
/// Response to get_child_version
|
||||||
|
pub(crate) struct GetVersionResult {
|
||||||
|
pub(crate) version_id: Uuid,
|
||||||
|
pub(crate) parent_version_id: Uuid,
|
||||||
|
pub(crate) history_segment: HistorySegment,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Response to add_version
|
||||||
|
pub(crate) enum AddVersionResult {
|
||||||
|
/// OK, version added with the given ID
|
||||||
|
Ok(VersionId),
|
||||||
|
/// Rejected; expected a version with the given parent version
|
||||||
|
ExpectedParentVersion(VersionId),
|
||||||
|
}
|
||||||
pub(crate) trait SyncServer: Sync + Send {
|
pub(crate) trait SyncServer: Sync + Send {
|
||||||
fn get_child_version(
|
fn get_child_version(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
use taskchampion::Uuid;
|
|
||||||
|
|
||||||
pub(crate) type HistorySegment = Vec<u8>;
|
|
||||||
pub(crate) type ClientId = Uuid;
|
|
||||||
pub(crate) type VersionId = Uuid;
|
|
||||||
|
|
||||||
/// Response to get_child_version
|
|
||||||
pub(crate) struct GetVersionResult {
|
|
||||||
pub(crate) version_id: Uuid,
|
|
||||||
pub(crate) parent_version_id: Uuid,
|
|
||||||
pub(crate) history_segment: HistorySegment,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Response to add_version
|
|
||||||
pub(crate) enum AddVersionResult {
|
|
||||||
/// OK, version added with the given ID
|
|
||||||
Ok(VersionId),
|
|
||||||
/// Rejected; expected a version with the given parent version
|
|
||||||
ExpectedParentVersion(VersionId),
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue