add some docs

This commit is contained in:
Horhik 2021-03-12 08:03:35 +03:00
parent c3962d8808
commit 90acca87ea
4 changed files with 16 additions and 6 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "fcpv2"
version = "0.0.1"
version = "0.0.2"
authors = ["Horhik <horhik@tuta.io>"]
edition = "2018"
license = "GPL-2.0"

View File

@ -20,6 +20,8 @@ pub enum VisibilityLevel {
Yes,
}
pub enum VerbosityPut {
SimpleProgress,
ExpectedHashes,
PutFetchable,
@ -61,11 +63,19 @@ fn is_berbosity_put_converting() {
}
pub enum VerbosityGet {
/// 0: report when complete
Report,
/// 1: SimpleProgress messages
SimpleProgress,
/// 2: SendingToNetwork messages
SendingToNetwork,
/// 4: CompatibilityMode messages (since 1255)
CompatibilityMode,
/// 8: ExpectedHashes messages (since 1255)
ExpectedHashes,
/// 32: ExpectedMIME messages (since 1307)
ExpectedMIME,
/// 64: ExpectedDataLength messages (since 1307)
ExpectedDataLength,
}

View File

@ -1,6 +1,6 @@
pub mod traits;
use traits::*;
use regex::Regex;
use traits::*;
#[derive(Debug, PartialEq)]
pub struct SSK {
@ -26,7 +26,7 @@ impl FcpParser<SSKKeypair> for SSKKeypair {
let reg = Regex::new(
r"^SSKKeypair\nIdentifier=(.*)\nInsertURI=(.*)\nRequestURI=(.*)\nEndMessage",
)
.unwrap();
.unwrap();
println!("{:?}", reg);
let res = reg.captures(plain).unwrap();
let identifier = res[1].to_string();
@ -40,10 +40,12 @@ impl FcpParser<SSKKeypair> for SSKKeypair {
}
}
pub enum ReturnType {
/// return the data directly to the client via an AllData message, once we have all of it. (For persistent requests, the client will get a DataFound message but must send a GetRequestStatus to ask for the AllData).
Direct,
/// write the data to disk. If you download to disk, you have to do a TestDDARequest.
None,
/// don't return the data at all, just fetch it to the node and tell the client when we have finished.
Disk,
}
@ -52,4 +54,3 @@ impl FcpRequest for ReturnType {
unimplemented!();
}
}

View File

@ -1,7 +1,6 @@
pub trait FcpRequest {
fn convert(&self) -> String;
fn fcp_wrap(&self, prefix: &str, postfix: &str) -> String {
format!("{}{}{}", prefix, self.convert(), postfix)
}