Struct trust_graph::TrustGraph [−][src]
Graph to efficiently calculate weights of certificates and get chains of certificates. TODO serialization/deserialization TODO export a certificate from graph
Implementations
impl<S> TrustGraph<S> where
S: Storage,
[src]
S: Storage,
pub fn new(storage: S) -> Self
[src]
pub fn add_root_weight(
&mut self,
pk: PublicKey,
weight: Weight
) -> Result<(), TrustGraphError>
[src]
&mut self,
pk: PublicKey,
weight: Weight
) -> Result<(), TrustGraphError>
Insert new root weight
pub fn get(&self, pk: PublicKey) -> Result<Option<TrustNode>, TrustGraphError>
[src]
Get trust by public key
pub fn add<C>(
&mut self,
cert: C,
cur_time: Duration
) -> Result<(), TrustGraphError> where
C: Borrow<Certificate>,
[src]
&mut self,
cert: C,
cur_time: Duration
) -> Result<(), TrustGraphError> where
C: Borrow<Certificate>,
Certificate is a chain of trusts, add this chain to graph
pub fn weight<P>(&self, pk: P) -> Result<Option<Weight>, TrustGraphError> where
P: Borrow<PublicKey>,
[src]
P: Borrow<PublicKey>,
Get the maximum weight of trust for one public key.
pub fn certificates_weight<C, I>(
&self,
certs: I
) -> Result<Option<Weight>, TrustGraphError> where
C: Borrow<Certificate>,
I: IntoIterator<Item = C>,
[src]
&self,
certs: I
) -> Result<Option<Weight>, TrustGraphError> where
C: Borrow<Certificate>,
I: IntoIterator<Item = C>,
Calculate weight from given certificates Returns None if there is no such public key or some trust between this key and a root key is revoked. TODO handle non-direct revocations
pub fn get_all_certs<P>(
&self,
issued_for: P,
roots: &[PublicKey]
) -> Result<Vec<Certificate>, TrustGraphError> where
P: Borrow<PublicKey>,
[src]
&self,
issued_for: P,
roots: &[PublicKey]
) -> Result<Vec<Certificate>, TrustGraphError> where
P: Borrow<PublicKey>,
Get all possible certificates where issued_for
will be the last element of the chain
and one of the destinations is the root of this chain.
pub fn revoke(&mut self, revoke: Revoke) -> Result<(), TrustGraphError>
[src]
Mark public key as revoked.
Auto Trait Implementations
impl<S> RefUnwindSafe for TrustGraph<S> where
S: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for TrustGraph<S> where
S: Send,
S: Send,
impl<S> Sync for TrustGraph<S> where
S: Sync,
S: Sync,
impl<S> Unpin for TrustGraph<S> where
S: Unpin,
S: Unpin,
impl<S> UnwindSafe for TrustGraph<S> where
S: UnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,