use super::commands::Command;
use crate::server::reply::ReplyCode;
use crate::storage::Error;
use futures::sync::mpsc;
#[derive(PartialEq)]
pub enum DataCommand {
ExternalCommand(Command),
Abort,
}
type InternalMsgChannel = (mpsc::Sender<InternalMsg>, mpsc::Receiver<InternalMsg>);
pub fn create_internal_msg_channel() -> InternalMsgChannel {
let (tx, rx): (mpsc::Sender<InternalMsg>, mpsc::Receiver<InternalMsg>) = mpsc::channel(1);
(tx, rx)
}
#[derive(Debug)]
pub enum InternalMsg {
PermissionDenied,
NotFound,
SendData {
bytes: i64,
},
WrittenData {
bytes: i64,
},
ConnectionReset,
DataConnectionClosedAfterStor,
WriteFailed,
SendingData,
UnknownRetrieveError,
DirectorySuccessfullyListed,
DelSuccess,
DelFail,
Quit,
MkdirSuccess(std::path::PathBuf),
MkdirFail,
AuthSuccess,
AuthFailed,
SecureControlChannel,
PlaintextControlChannel,
StorageError(Error),
CommandChannelReply(ReplyCode, String),
}