Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ef6eb9
commit 0372cd9
Showing
13 changed files
with
251 additions
and
72 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,19 @@ | ||
use hdk3::prelude::*; | ||
|
||
extern crate file_storage; | ||
|
||
// TODO1: link from my_address to new uploaded file should be happened here. "all_my_files" | ||
// post_commit | ||
|
||
/// TODO2: since the link of "all_my_files" created in this zome, get_all_my_files() zome function shoule be implemented here | ||
|
||
///Example: Adding extra functionality to the external module | ||
#[derive(Serialize, Deserialize, SerializedBytes)] | ||
pub struct FilesResult { | ||
pub list: usize, | ||
} | ||
|
||
#[hdk_extern] | ||
fn new_extention_function(_: ()) -> ExternResult<FilesResult> { | ||
Ok(FilesResult { list: 123 }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ derive_more = "0" | |
serde = "1" | ||
|
||
hc_utils = "0" | ||
hdk3 = "0" | ||
hdk3 = "0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
//TODO: finish this function | ||
use hdk3::prelude::*; | ||
#[derive(Serialize, Deserialize, SerializedBytes)] | ||
struct SearchInput{ | ||
tags:Vec<String>, | ||
from_timestamp:i64, // search from this time-stamp | ||
filter_boundry_in_min: i64 // filter by last X minutes. UI show Year,Month,Day,Hour, Min and calculate the minutes before calling zome | ||
struct SearchInput { | ||
tags: Vec<String>, | ||
from_timestamp: i64, // search from this time-stamp | ||
filter_boundry_in_min: i64, // filter by last X minutes. UI show Year,Month,Day,Hour, Min and calculate the minutes before calling zome | ||
} | ||
|
||
#[derive(Serialize, Deserialize, SerializedBytes)] | ||
struct SearchResult{ | ||
result:Vec<FileInfo>, | ||
from_timestamp: i64, | ||
filter_boundry_in_min:i64, | ||
msg:String, | ||
status:bool | ||
struct SearchResult { | ||
result: Vec<FileInfo>, | ||
from_timestamp: i64, | ||
filter_boundry_in_min: i64, | ||
msg: String, | ||
status: bool, | ||
} | ||
|
||
#[derive(Serialize, Deserialize, SerializedBytes)] | ||
struct FileInfo{ | ||
hash:EntryHash, | ||
file_name:String, | ||
file_size:u32, | ||
owner:String | ||
struct FileInfo { | ||
hash: EntryHash, | ||
file_name: String, | ||
file_size: u32, | ||
owner: String, | ||
} | ||
|
||
|
||
#[derive(Serialize, Deserialize, SerializedBytes)] | ||
pub struct MyFilesResult { | ||
pub list: Vec<EntryHash>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,45 @@ | ||
const MAX_RESULT_IN_PAGE: i32 = 50; /// approximate records in each page. We should query DHT in a loop whether we reach the filter_boundry or mx number in each page(scroll) | ||
const MAX_RESULT_IN_PAGE: i32 = 50; | ||
/// approximate records in each page. We should query DHT in a loop whether we reach the filter_boundry or mx number in each page(scroll) | ||
const STEP_IN_MIN: i32 = 1; // each page or step of search is X minute. | ||
|
||
pub fn search_file_by_tags(tags:Vec<String>,current:u64, end_of_filter:u64) -> Result<(Vec<FileInfo>,u64)>{ | ||
pub fn search_file_by_tags( | ||
tags: Vec<String>, | ||
current: u64, | ||
end_of_filter: u64, | ||
) -> Result<(Vec<FileInfo>, u64)> { | ||
let mut start_pointer = current.clone(); | ||
|
||
let mut start_pointer = current.clone(); | ||
/// current time: 14:52 create index: upload file: art.20201212.1452 | ||
/// art.20201212.1350 | ||
///art.20201212.1410 | ||
/// art.20201212.1423 | ||
//art.20201212.1452 | ||
|
||
/// 12.12.2020 art 75 minutes current time: 15:37 | ||
|
||
/// current time: 14:52 create index: upload file: art.20201212.1452 | ||
/// art.20201212.1350 | ||
///art.20201212.1410 | ||
/// art.20201212.1423 | ||
//art.20201212.1452 | ||
|
||
/// art.20201212.1537 load all if result<50 | ||
//// art.20201212.1536 load all if result<50 | ||
//// art.20201212.1535 load all if result>50 | ||
|
||
//current 1535 return reulst; | ||
|
||
/// 12.12.2020 art 75 minutes current time: 15:37 | ||
|
||
/// art.20201212.1537 load all if result<50 | ||
//// art.20201212.1536 load all if result<50 | ||
//// art.20201212.1535 load all if result>50 | ||
|
||
|
||
|
||
//current 1535 return reulst; | ||
|
||
|
||
|
||
|
||
/// 1- get all path art.20201212 ///what does it mean, | ||
/// art.20201212 /// remail . | ||
|
||
/// 1- possibilities: | ||
//// 2 - slicing inside possibilities. | ||
/// 3 - consition, based on result and time distance | ||
/// 1- get all path art.20201212 ///what does it mean, | ||
/// art.20201212 /// remail . | ||
|
||
/// 1- possibilities: | ||
//// 2 - slicing inside possibilities. | ||
/// 3 - consition, based on result and time distance | ||
// Start While: result.lenght<= MAX_RESULT_IN_PAGE || start_pointer<=end_of_filter | ||
|
||
let result:Vec<String>; | ||
let result: Vec<String>; | ||
let path_date = "20201206".into(); // get YearMonthDay in this format YYYYMMDD based on the start_pointer | ||
let path_time = "1312".into(); // get time in this format HHMM based on the start_pointer | ||
|
||
for s in tags{ | ||
// Gnerate TAGS: (format!("{}.{}.{}",s,path_date,path_time)); | ||
// Query each Tag from DHT and push to result | ||
for s in tags { | ||
// Gnerate TAGS: (format!("{}.{}.{}",s,path_date,path_time)); | ||
// Query each Tag from DHT and push to result | ||
} | ||
start_pointer=STEP_IN_MIN; | ||
start_pointer = STEP_IN_MIN; | ||
|
||
// END While | ||
Ok((result,start_pointer)) | ||
|
||
} | ||
Ok((result, start_pointer)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pub mod entry; | ||
pub mod handlers; | ||
pub mod validation; | ||
//pub mod handlers; | ||
//pub mod validation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.