-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
7 changed files
with
103 additions
and
79 deletions.
There are no files selected for viewing
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
20 changes: 6 additions & 14 deletions
20
src/contracts_caller/memory_page_fact_registry/sample_register_memory.rs
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,42 +1,34 @@ | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
|
||
use crate::config::AppConfig; | ||
use crate::contracts_caller::memory_page_fact_registry::register_continuous_memorypage::register_continuous_memorypage; | ||
use crate::contracts_caller::memory_page_fact_registry::register_continuous_page_batch::register_continuous_page_batch; | ||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_memorypage::ContinuousMemorypage; | ||
use crate::contracts_caller::memory_page_fact_registry::types::register_continuous_page_batch::MemoryPageEntries; | ||
|
||
pub async fn sample_register_continuous_page_batch(config: &AppConfig) -> anyhow::Result<bool> { | ||
pub fn sample_register_continuous_page_batch() -> anyhow::Result<MemoryPageEntries> { | ||
let file_path = | ||
"src/data_samples/memory_page_fact_registry/register_continuous_page_batch.json" | ||
.to_string(); | ||
let input_file = File::open(file_path)?; | ||
let reader = BufReader::new(input_file); | ||
let memory_page_entries: MemoryPageEntries = serde_json::from_reader(reader)?; | ||
|
||
register_continuous_page_batch(config, memory_page_entries).await | ||
Ok(memory_page_entries) | ||
} | ||
|
||
pub async fn sample_register_continuous_page(config: &AppConfig) -> anyhow::Result<bool> { | ||
pub fn sample_register_continuous_page() -> anyhow::Result<ContinuousMemorypage> { | ||
let file_path = | ||
"src/data_samples/memory_page_fact_registry/register_memory_page.json".to_string(); | ||
let input_file = File::open(file_path)?; | ||
let reader = BufReader::new(input_file); | ||
let continuous_memmory_page: ContinuousMemorypage = serde_json::from_reader(reader)?; | ||
|
||
register_continuous_memorypage(config, continuous_memmory_page).await | ||
Ok(continuous_memmory_page) | ||
} | ||
|
||
pub async fn sample_large_data_register_continuous_page_batch( | ||
config: &AppConfig, | ||
) -> anyhow::Result<bool> { | ||
pub fn sample_large_data_register_continuous_page_batch() -> anyhow::Result<MemoryPageEntries> { | ||
let file_path = | ||
"src/data_samples/memory_page_fact_registry/large_data_register_continuous_page_batch.json" | ||
.to_string(); | ||
let input_file = File::open(file_path)?; | ||
let reader = BufReader::new(input_file); | ||
let memory_page_entries: MemoryPageEntries = serde_json::from_reader(reader)?; | ||
|
||
register_continuous_page_batch(config, memory_page_entries).await | ||
Ok(memory_page_entries) | ||
} |
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
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