pub struct BridgeTable {
pub counter: u32,
pub keys: HashMap<u32, [u8; 16]>,
pub buckets: HashMap<u32, [BridgeLine; 3]>,
pub encbuckets: HashMap<u32, EncryptedBucket>,
pub reachable: HashMap<BridgeLine, Vec<(u32, usize)>>,
pub spares: HashSet<u32>,
pub unallocated_bridges: Vec<BridgeLine>,
pub recycleable_keys: Vec<u32>,
pub blocked_keys: Vec<(u32, u32)>,
pub open_inv_keys: Vec<(u32, u32)>,
pub date_last_enc: u32,
}Expand description
A BridgeTable is the internal structure holding the buckets containing the bridges, the keys used to encrypt the buckets, and the encrypted buckets. The encrypted buckets will be exposed to the users of the system, and each user credential will contain the decryption key for one bucket.
Fields§
§counter: u32All structures in the bridgetable are indexed by counter
keys: HashMap<u32, [u8; 16]>The keys of all buckets, indexed by counter, that are still part of the bridge table.
buckets: HashMap<u32, [BridgeLine; 3]>All buckets, indexed by counter corresponding to the key above, that are part of the bridge table.
encbuckets: HashMap<u32, EncryptedBucket>§reachable: HashMap<BridgeLine, Vec<(u32, usize)>>Individual bridges that are reachable.
spares: HashSet<u32>Bucket ids of “hot spare” buckets. These buckets are not handed to users, nor do they have any Migration credentials pointing to them. When a new Migration credential is needed, a bucket is removed from this set and used for that purpose.
unallocated_bridges: Vec<BridgeLine>In some instances a single bridge may need to be added to a bucket as a replacement or otherwise. In that case, a spare bucket will be removed from the set of spares, one bridge will be used as the replacement and the left over bridges will be appended to unallocated_bridges.
recycleable_keys: Vec<u32>§blocked_keys: Vec<(u32, u32)>§open_inv_keys: Vec<(u32, u32)>§date_last_enc: u32The date the buckets were last encrypted to make the encbucket. The encbucket must be rebuilt at least each day so that the Bucket Reachability credentials in the buckets can be refreshed.
Implementations§
Source§impl BridgeTable
impl BridgeTable
Sourcepub fn decrypt_bucket(
id: u32,
key: &[u8; 16],
encbucket: &EncryptedBucket,
) -> Result<([BridgeLine; 3], Option<BucketReachability>), Error>
pub fn decrypt_bucket( id: u32, key: &[u8; 16], encbucket: &EncryptedBucket, ) -> Result<([BridgeLine; 3], Option<BucketReachability>), Error>
Decrypt an individual encrypted bucket, given its id, key, and the encrypted bucket itself