probably code the convert function for ClientGet. No tests

This commit is contained in:
Horhik 2021-02-15 21:11:46 +03:00
parent 827cf93e91
commit aac3e3a76b
6 changed files with 141 additions and 2 deletions

8
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

11
.idea/FCPv2.iml Normal file
View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="CPP_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/FCPv2.iml" filepath="$PROJECT_DIR$/.idea/FCPv2.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -452,6 +452,7 @@ fn is_client_put_converting() {
);
assert_eq!(fin, input.convert());
}
pub struct ClientGet {
message_name: String,
ignore_ds: Option<bool>,
@ -460,6 +461,7 @@ pub struct ClientGet {
identifier: String,
verbosity: Option<VerbosityGet>,
max_size: Option<u32>,
max_temp_size: Option<u32>,
max_retries: Option<NumOrNone>,
priority_class: Option<Priority>,
persistence: Option<Persistence>,
@ -472,7 +474,79 @@ pub struct ClientGet {
filename: Option<Box<Path>>,
temp_filename: Option<Box<Path>>,
real_time_flag: Option<bool>,
initial_metadata_data_length: u64,
initial_metadata_data_length: Option<u64>,
}
/*
ClientGet
IgnoreDS=false
DSOnly=false
URI=KSK@sample.txt
Identifier=Request Number One
Verbosity=0
ReturnType=direct
MaxSize=100
MaxTempSize=1000
MaxRetries=100
PriorityClass=1
Persistence=reboot
ClientToken=hello
Global=false
BinaryBlob=false
FilterData=true
EndMessage
*/
impl FcpRequest for ClientGet {
fn convert(&self) -> String {
unimplemented!();
format!(
"ClientGet\n\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
{}\
EndMessage\n\n",
to_fcp_unwrap("IgnoreDS=", &self.ignore_ds, "\n"),
to_fcp_unwrap("DSonly=", &self.ds_only, "\n"),
format!("URI={}\n", &self.uri),
format!("Identifier={}\n", &self.identifier),
to_fcp_unwrap("Verbosity=", &self.verbosity, "\n"),
to_fcp_unwrap("ReturnType=", &self.return_type, "\n"),
to_fcp_unwrap("MaxSize=", &self.max_size, "\n"),
to_fcp_unwrap("MaxTempSize=", &self.max_temp_size, "\n"),
to_fcp_unwrap("MaxRetries=", &self.max_retries, "\n"),
to_fcp_unwrap("PriorityClass=", &self.priority_class, "\n"),
to_fcp_unwrap("Persistence=", &self.persistence, "\n"),
to_fcp_unwrap("ClientToken=", &self.client_token, "\n"),
to_fcp_unwrap("Global=", &self.global, "\n"),
to_fcp_unwrap("BinaryBlob=", &self.binary_blob, "\n"),
to_fcp_unwrap("FilterData=", &self.filter_data, "\n"),
to_fcp_unwrap("AllowedMIMETypes =", &self.allowed_mime_types, "\n"),
to_fcp_unwrap("Filename=", &self.filename, "\n"),
to_fcp_unwrap("RealTimeFlag=", &self.real_time_flag, "\n"),
to_fcp_unwrap(
"InitialMetadata.DataLength=",
&self.initial_metadata_data_length,
"\n"
),
)
}
}
pub struct Disconnect {

View file

@ -68,6 +68,12 @@ pub enum VerbosityGet {
ExpectedDataLength,
}
impl FcpRequest for VerbosityGet {
fn convert(&self) -> String {
unimplemented!();
}
}
pub enum Retry {
None,
Forever,
@ -154,10 +160,32 @@ pub enum ReturnType {
Disk,
}
impl FcpRequest for ReturnType {
fn convert(&self) -> String {
unimplemented!();
}
}
pub enum NumOrNone {
None,
Num(u32),
}
impl FcpRequest for NumOrNone {
fn convert(&self) -> String {
unimplemented!();
}
}
impl FcpRequest for Vec<String> {
fn convert(&self) -> String {
unimplemented!();
}
}
impl FcpRequest for Box<Path> {
fn convert(&self) -> String {
unimplemented!();
}
}
pub enum Priority {
A, // 0
@ -204,7 +232,11 @@ impl FcpRequest for i64 {
self.to_string()
}
}
impl FcpRequest for u64 {
fn convert(&self) -> String {
self.to_string()
}
}
impl FcpRequest for String {
fn convert(&self) -> String {
self.to_string()