extern crate base64;
extern crate chrono;
#[macro_use]
extern crate iron;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate mime_guess;
#[macro_use]
extern crate quick_error;
extern crate rand;
extern crate serde;
#[macro_use]
extern crate serde_json;
extern crate tera;
extern crate tree_magic;
pub mod web;
mod error;
mod id;
mod mime;
mod pastebin;
mod read;
mod request;
#[cfg(test)]
mod test;
#[cfg(test)]
extern crate reqwest;
use chrono::{DateTime, Utc};
pub use error::Error;
use iron::error::HttpResult;
#[derive(Debug, Clone)]
pub struct PasteEntry {
pub data: Vec<u8>,
pub file_name: Option<String>,
pub mime_type: String,
pub best_before: Option<DateTime<Utc>>,
}
pub trait DbInterface: Send + Sync {
type Error: Send + Sync + std::error::Error + 'static;
fn store_data(&self,
data: Vec<u8>,
file_name: Option<String>,
mime_type: String,
best_before: Option<DateTime<Utc>>)
-> Result<u64, Self::Error>;
fn load_data(&self, id: u64) -> Result<Option<PasteEntry>, Self::Error>;
fn get_file_name(&self, id: u64) -> Result<Option<String>, Self::Error>;
fn remove_data(&self, id: u64) -> Result<(), Self::Error>;
fn max_data_size(&self) -> usize;
}