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
pub mod post;
mod registered_proof;
mod seal;
pub use self::post::*;
pub use self::registered_proof::*;
pub use self::seal::*;
use crate::ActorID;
use encoding::{repr::*, tuple::*};
use num_bigint::BigInt;
use num_derive::FromPrimitive;
use std::fmt;
pub type SectorNumber = u64;
pub const MAX_SECTOR_NUMBER: SectorNumber = i64::MAX as u64;
pub type StoragePower = BigInt;
pub type Spacetime = BigInt;
pub type SectorQuality = BigInt;
#[derive(Clone, Debug, PartialEq, Copy, FromPrimitive, Serialize_repr, Deserialize_repr)]
#[repr(u64)]
pub enum SectorSize {
_2KiB = 2 << 10,
_8MiB = 8 << 20,
_512MiB = 512 << 20,
_32GiB = 32 << 30,
_64GiB = 2 * (32 << 30),
}
impl fmt::Display for SectorSize {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self)
}
}
#[derive(Clone, Debug, Default, PartialEq, Serialize_tuple, Deserialize_tuple)]
pub struct SectorID {
pub miner: ActorID,
pub number: SectorNumber,
}