1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use std::io::Read;
use crate::api::bytes_amount::{PaddedBytesAmount, UnpaddedBytesAmount};
use crate::api::errors::SectorManagerErr;
use crate::api::porep_config::PoRepConfig;
use crate::api::post_config::PoStConfig;
pub trait SectorConfig: Sync + Send {
fn max_unsealed_bytes_per_sector(&self) -> UnpaddedBytesAmount;
fn sector_bytes(&self) -> PaddedBytesAmount;
}
pub trait ProofsConfig: Sync + Send {
fn post_config(&self) -> PoStConfig;
fn porep_config(&self) -> PoRepConfig;
}
pub trait SectorManager: Sync + Send {
fn new_sealed_sector_access(&self) -> Result<String, SectorManagerErr>;
fn new_staging_sector_access(&self) -> Result<String, SectorManagerErr>;
fn num_unsealed_bytes(&self, access: &str) -> Result<u64, SectorManagerErr>;
fn truncate_unsealed(&self, access: &str, size: u64) -> Result<(), SectorManagerErr>;
fn write_and_preprocess(
&self,
access: &str,
data: &mut dyn Read,
) -> Result<UnpaddedBytesAmount, SectorManagerErr>;
fn delete_staging_sector_access(&self, access: &str) -> Result<(), SectorManagerErr>;
fn read_raw(
&self,
access: &str,
start_offset: u64,
num_bytes: UnpaddedBytesAmount,
) -> Result<Vec<u8>, SectorManagerErr>;
}
pub trait SectorStore: Sync + Send {
fn sector_config(&self) -> &SectorConfig;
fn proofs_config(&self) -> &ProofsConfig;
fn manager(&self) -> &SectorManager;
}