add some docs
This commit is contained in:
parent
c3962d8808
commit
90acca87ea
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "fcpv2"
|
name = "fcpv2"
|
||||||
version = "0.0.1"
|
version = "0.0.2"
|
||||||
authors = ["Horhik <horhik@tuta.io>"]
|
authors = ["Horhik <horhik@tuta.io>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "GPL-2.0"
|
license = "GPL-2.0"
|
||||||
|
|
|
@ -20,6 +20,8 @@ pub enum VisibilityLevel {
|
||||||
Yes,
|
Yes,
|
||||||
}
|
}
|
||||||
pub enum VerbosityPut {
|
pub enum VerbosityPut {
|
||||||
|
|
||||||
|
|
||||||
SimpleProgress,
|
SimpleProgress,
|
||||||
ExpectedHashes,
|
ExpectedHashes,
|
||||||
PutFetchable,
|
PutFetchable,
|
||||||
|
@ -61,11 +63,19 @@ fn is_berbosity_put_converting() {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum VerbosityGet {
|
pub enum VerbosityGet {
|
||||||
|
/// 0: report when complete
|
||||||
|
Report,
|
||||||
|
/// 1: SimpleProgress messages
|
||||||
SimpleProgress,
|
SimpleProgress,
|
||||||
|
/// 2: SendingToNetwork messages
|
||||||
SendingToNetwork,
|
SendingToNetwork,
|
||||||
|
/// 4: CompatibilityMode messages (since 1255)
|
||||||
CompatibilityMode,
|
CompatibilityMode,
|
||||||
|
/// 8: ExpectedHashes messages (since 1255)
|
||||||
ExpectedHashes,
|
ExpectedHashes,
|
||||||
|
/// 32: ExpectedMIME messages (since 1307)
|
||||||
ExpectedMIME,
|
ExpectedMIME,
|
||||||
|
/// 64: ExpectedDataLength messages (since 1307)
|
||||||
ExpectedDataLength,
|
ExpectedDataLength,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
pub mod traits;
|
pub mod traits;
|
||||||
use traits::*;
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
use traits::*;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct SSK {
|
pub struct SSK {
|
||||||
|
@ -26,7 +26,7 @@ impl FcpParser<SSKKeypair> for SSKKeypair {
|
||||||
let reg = Regex::new(
|
let reg = Regex::new(
|
||||||
r"^SSKKeypair\nIdentifier=(.*)\nInsertURI=(.*)\nRequestURI=(.*)\nEndMessage",
|
r"^SSKKeypair\nIdentifier=(.*)\nInsertURI=(.*)\nRequestURI=(.*)\nEndMessage",
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("{:?}", reg);
|
println!("{:?}", reg);
|
||||||
let res = reg.captures(plain).unwrap();
|
let res = reg.captures(plain).unwrap();
|
||||||
let identifier = res[1].to_string();
|
let identifier = res[1].to_string();
|
||||||
|
@ -40,10 +40,12 @@ impl FcpParser<SSKKeypair> for SSKKeypair {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub enum ReturnType {
|
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,
|
Direct,
|
||||||
|
/// write the data to disk. If you download to disk, you have to do a TestDDARequest.
|
||||||
None,
|
None,
|
||||||
|
/// don't return the data at all, just fetch it to the node and tell the client when we have finished.
|
||||||
Disk,
|
Disk,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,4 +54,3 @@ impl FcpRequest for ReturnType {
|
||||||
unimplemented!();
|
unimplemented!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
pub trait FcpRequest {
|
pub trait FcpRequest {
|
||||||
fn convert(&self) -> String;
|
fn convert(&self) -> String;
|
||||||
|
|
||||||
fn fcp_wrap(&self, prefix: &str, postfix: &str) -> String {
|
fn fcp_wrap(&self, prefix: &str, postfix: &str) -> String {
|
||||||
format!("{}{}{}", prefix, self.convert(), postfix)
|
format!("{}{}{}", prefix, self.convert(), postfix)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue