Skip to main content

BridgeTable

Struct BridgeTable 

Source
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: u32

All 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: u32

The 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

Source

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

Trait Implementations§

Source§

impl Debug for BridgeTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BridgeTable

Source§

fn default() -> BridgeTable

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for BridgeTable

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for BridgeTable

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,