more module cleanup
This commit is contained in:
parent
3aaeb4394a
commit
f5af07f860
7 changed files with 24 additions and 36 deletions
|
@ -11,7 +11,7 @@ use tower_http::limit::RequestBodyLimitLayer;
|
|||
use crate::{
|
||||
Config, JoecalState,
|
||||
discovery::register_device,
|
||||
transfer::upload::{register_prepare_upload, register_upload},
|
||||
transfer::{register_prepare_upload, register_upload},
|
||||
};
|
||||
|
||||
impl JoecalState {
|
|
@ -1,7 +1,7 @@
|
|||
pub mod discovery;
|
||||
pub mod error;
|
||||
pub mod http_server;
|
||||
pub mod models;
|
||||
pub mod server;
|
||||
pub mod transfer;
|
||||
|
||||
use std::{
|
||||
|
@ -10,11 +10,10 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use models::device::DeviceInfo;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::{net::UdpSocket, sync::Mutex, task::JoinHandle};
|
||||
use transfer::session::Session;
|
||||
|
||||
use crate::models::device::DeviceInfo;
|
||||
use transfer::Session;
|
||||
|
||||
pub const DEFAULT_PORT: u16 = 53317;
|
||||
pub const MULTICAST_IP: Ipv4Addr = Ipv4Addr::new(224, 0, 0, 167);
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
pub mod http;
|
|
@ -15,9 +15,28 @@ use crate::{
|
|||
JoecalState,
|
||||
error::{LocalSendError, Result},
|
||||
models::{device::DeviceInfo, file::FileMetadata},
|
||||
transfer::session::{Session, SessionStatus},
|
||||
};
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Session {
|
||||
pub session_id: String,
|
||||
pub files: HashMap<String, FileMetadata>,
|
||||
pub file_tokens: HashMap<String, String>,
|
||||
pub receiver: DeviceInfo,
|
||||
pub sender: DeviceInfo,
|
||||
pub status: SessionStatus,
|
||||
pub addr: SocketAddr,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Deserialize, Serialize)]
|
||||
pub enum SessionStatus {
|
||||
Pending,
|
||||
Active,
|
||||
Completed,
|
||||
Failed,
|
||||
Cancelled,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PrepareUploadResponse {
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
pub mod download;
|
||||
pub mod session;
|
||||
pub mod upload;
|
|
@ -1,25 +0,0 @@
|
|||
use std::{collections::HashMap, net::SocketAddr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::models::{device::DeviceInfo, file::FileMetadata};
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct Session {
|
||||
pub session_id: String,
|
||||
pub files: HashMap<String, FileMetadata>,
|
||||
pub file_tokens: HashMap<String, String>,
|
||||
pub receiver: DeviceInfo,
|
||||
pub sender: DeviceInfo,
|
||||
pub status: SessionStatus,
|
||||
pub addr: SocketAddr,
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Deserialize, Serialize)]
|
||||
pub enum SessionStatus {
|
||||
Pending,
|
||||
Active,
|
||||
Completed,
|
||||
Failed,
|
||||
Cancelled,
|
||||
}
|
Loading…
Reference in a new issue