pub struct SecureAggregator { /* private fields */ }Expand description
Server-side aggregator state for a single round.
The aggregator owns no cryptographic key material – every pairwise mask
can be recomputed on demand from round_seed. It keeps track of which
clients have successfully submitted, which clients are known to have
dropped, and cached pairwise masks used during dropout reconstruction.
Implementations§
Source§impl SecureAggregator
impl SecureAggregator
Sourcepub fn new(config: SecureAggregationConfig) -> Result<Self>
pub fn new(config: SecureAggregationConfig) -> Result<Self>
Build a new aggregator for one round.
Validates the configuration up front so that downstream operations can assume well-formed values. The dropout safety check requires that the modulus is at least one order of magnitude larger than the nominal quantised value range, which guarantees that the partial masked sum cannot silently wrap.
Sourcepub fn receive(&mut self, submission: MaskedGradient) -> Result<()>
pub fn receive(&mut self, submission: MaskedGradient) -> Result<()>
Accept a client submission.
Re-submissions from the same client_id overwrite the previous
value (later submissions are considered more authoritative). A
submission whose vector length does not match the configured
dimension is rejected with OptimError::DimensionMismatch.
Sourcepub fn mark_dropped(&mut self, client_id: ClientId) -> Result<()>
pub fn mark_dropped(&mut self, client_id: ClientId) -> Result<()>
Mark a client as having dropped out of this round.
Dropped clients are excluded from the aggregated sum but the masks
they would have used are still cancelled by the
dropout-reconstruction phase of Self::aggregate.
Sourcepub fn aggregate(&self) -> Result<Array1<f64>>
pub fn aggregate(&self) -> Result<Array1<f64>>
Aggregate the received submissions, cancelling any masks belonging to dropped clients.
Returns the dequantised real-valued sum of the received clients’ gradients. Dropped clients contribute nothing to the sum (their gradient is, by definition, never uploaded) but their pairwise masks are still removed so the remaining clients’ uploads telescope correctly.
Sourcepub fn received_count(&self) -> usize
pub fn received_count(&self) -> usize
Number of client submissions currently held.
Sourcepub fn dropped_count(&self) -> usize
pub fn dropped_count(&self) -> usize
Number of clients currently marked as dropped.
Sourcepub fn config(&self) -> &SecureAggregationConfig
pub fn config(&self) -> &SecureAggregationConfig
Read-only access to the aggregator’s configuration.
Trait Implementations§
Source§impl Clone for SecureAggregator
impl Clone for SecureAggregator
Source§fn clone(&self) -> SecureAggregator
fn clone(&self) -> SecureAggregator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SecureAggregator
impl RefUnwindSafe for SecureAggregator
impl Send for SecureAggregator
impl Sync for SecureAggregator
impl Unpin for SecureAggregator
impl UnsafeUnpin for SecureAggregator
impl UnwindSafe for SecureAggregator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.