Commit 811bd652 authored by Amanjeev Sethi's avatar Amanjeev Sethi

service/files: moves files types from libqaul to service/files

parent b607aac9
Pipeline #993 passed with stages
in 6 minutes and 52 seconds
......@@ -1277,6 +1277,7 @@ dependencies = [
"futures 0.3.4",
"libqaul",
"qaul-chat",
"qaul-files",
"qaul-voices",
"ratman",
"ratman-harness",
......@@ -1308,6 +1309,7 @@ dependencies = [
"libqaul",
"netmod-wd",
"ratman",
"ratman-configure",
]
[[package]]
......@@ -1827,6 +1829,7 @@ dependencies = [
"libqaul",
"mime",
"ratman-identity",
"serde",
]
[[package]]
......
......@@ -6,14 +6,16 @@ authors = ["Katharina Fey <kookie@spacekookie.de>", "jess 3jane <me@jess.coffee>
edition = "2018"
[features]
default = ["proto", "json", "chat", "voices"]
default = ["proto", "json", "chat", "files", "voices"]
proto = ["capnp"]
json = ["serde_json"]
chat = ["qaul-chat"]
files = ["qaul-files"]
voices = ["qaul-voices"]
[dependencies]
qaul-chat = { path = "../service/chat", optional = true }
qaul-files = { path = "../service/files", optional = true }
qaul-voices = { path = "../service/voices", optional = true }
libqaul = { version = "*", path = ".." }
......@@ -21,7 +23,7 @@ capnp = { version = "0.12", optional = true }
serde_json = { version = "1.0", optional = true }
serde = { version = "1.0", features = [ "derive" ] }
async-trait = "0.1"
async-std = { version = "1.0", features = ["attributes"]}
async-std = { version = "1.0", features = ["attributes"] }
futures = "0.3"
failure = "0.1"
crossbeam-queue = "0.2"
......
......@@ -2,7 +2,8 @@
use crate::QaulRpc;
use async_trait::async_trait;
use libqaul::{files::FileFilter, users::UserAuth, Identity};
use libqaul::{users::UserAuth, Identity};
use qaul_files::files::FileFilter;
/// Send a file store query
#[derive(PartialEq)]
......
......@@ -9,3 +9,4 @@ license = "AGPL-3.0"
identity = { path = "../../../ratman/identity", package = "ratman-identity" }
libqaul = { path = "../../" }
mime = "0.3"
serde = { version = "1.0" }
#![allow(unused)]
use crate::error::Result;
use crate::users::UserAuth;
use crate::Identity;
use serde::{Deserialize, Serialize};
use libqaul::error::Result;
use libqaul::Identity;
use libqaul::users::UserAuth;
pub type FileId = Identity;
/// Local file abstraction
......@@ -74,37 +73,37 @@ pub struct Files<'chain> {
impl<'qaul> Files<'qaul> {
/// Query the local file store for a specific constraint
pub fn query<I>(&self, user: UserAuth, filter: FileFilter) -> Result<I>
where
I: Iterator<Item = FileMeta>,
where
I: Iterator<Item=FileMeta>,
{
self.q.auth.trusted(user)?;
// self.q.auth.trusted(user)?;
unimplemented!()
}
/// List all available files
pub fn list<I>(&self, user: UserAuth) -> Result<I>
where
I: Iterator<Item = FileMeta>,
where
I: Iterator<Item=FileMeta>,
{
self.q.auth.trusted(user)?;
// self.q.auth.trusted(user)?;
unimplemented!()
}
/// Stream one particular file from storage
pub async fn get(&self, user: UserAuth, file: FileId) -> Result<File> {
self.q.auth.trusted(user)?;
// self.q.auth.trusted(user)?;
unimplemented!()
}
/// Adds a new file to the local user's storage
pub fn add(&self, user: UserAuth, name: &str, file: File) -> Result<FileId> {
self.q.auth.trusted(user)?;
// self.q.auth.trusted(user)?;
unimplemented!()
}
/// Delete a file from the local user store
pub fn delete(&self, user: UserAuth, name: FileId) -> Result<()> {
self.q.auth.trusted(user)?;
// self.q.auth.trusted(user)?;
unimplemented!()
}
}
//! `qaul.net` filesharing service
//!
//! Provides a simple interface to announce and broadcast binary
//! payload recipient messages. Files can either be directly sent, or
//! they can be advertised, then pulled with a unique file ID,
//! contained in the announcement.
// #![allow(unused)]
use std::sync::Arc;
use libqaul::{error::Result, Qaul};
use std::sync::Arc;
const ASC_NAME: &'static str = "net.qaul.filesharing";
pub mod files;
// /// A typed file that can be sent across the network
// pub struct File {
// pub name: String,
// pub mime: Mime,
// pub data: Vec<u8>,
// }
// TODO: Partial files
// TODO: file progress
// TODO: Download links with tokens
// // TODO: Partial files/ file progress
// // TODO: Download links with tokens
const ASC_NAME: &'static str = "net.qaul.filesharing";
/// Filesharing service state
#[derive(Clone)]
......
......@@ -21,9 +21,6 @@
pub use contacts::Contacts;
pub(crate) mod contacts;
pub use files::Files;
pub(crate) mod files;
pub use messages::Messages;
pub(crate) mod messages;
......
//! API fascade module?
pub use crate::api::files::{FileFilter, FileId, FileMeta};
......@@ -50,7 +50,6 @@ mod utils;
pub mod api;
pub mod contacts;
pub mod error;
pub mod files;
pub mod messages;
pub mod services;
pub mod users;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment