arcium-primitives 0.6.0

Arcium primitives
Documentation
pub mod buffered;
pub mod direct;
pub mod errors;
pub mod futures;

use std::fmt::Debug;

pub use buffered::{Buffer, BufferConfig, BufferedStream};
pub use direct::DirectStream;
pub use errors::CorrelatedStreamError;
pub use futures::{Next, NextVec, NextVecIterator};

use crate::correlated_randomness::Correlation;

/// Main abstraction interface to obtain preprocessing items.
///
/// To keep consistency, requests must be issued in the same order across all parties.
pub trait CorrelatedStream<P: Correlation>: Send {
    /// The error type returned by the generator.
    type Error: Debug + Clone + From<CorrelatedStreamError> + Send + 'static;

    /// Returns a single future that resolves to all `n_elements` items at once.
    /// Can fail if request is too large/small or if the request cannot
    /// be fulfilled by the stream for some reason.
    fn next_n(&self, n_elements: usize) -> Result<NextVec<P, Self::Error>, CorrelatedStreamError>;
}