Struct prevayler_rs::PrevaylerBuilder [−][src]
pub struct PrevaylerBuilder<T, D, S, P> { /* fields omitted */ }
Builder of the Prevayler
struct
Implementations
impl<T, D, S, P> PrevaylerBuilder<T, D, S, P>
[src]
impl<T, D, S, P> PrevaylerBuilder<T, D, S, P>
[src]pub fn new() -> Self
[src]
Creates the builder
pub fn path(self, path: P) -> Self where
P: AsRef<Path>,
[src]
P: AsRef<Path>,
Set the path which will be used to store redologs and snapshots. The folder must exists.
pub fn serializer(self, serializer: S) -> Self where
S: Serializer<D>,
[src]
S: Serializer<D>,
Set which serializer will be used. For more info, see Serializer
pub fn max_log_size(self, max_log_size: u64) -> Self
[src]
Set the max log size that will be stored in a single redolog file
pub fn data(self, data: T) -> Self
[src]
Set the data that will be prevailed
pub async fn build(self) -> PrevaylerResult<Prevayler<D, T, S>> where
D: Transaction<T>,
S: Serializer<D>,
P: AsRef<Path>,
[src]
D: Transaction<T>,
S: Serializer<D>,
P: AsRef<Path>,
Builds the Prevayler without snapshots. Notice that one of the Prevayler generic parameters cannot be infered by the compiler. This parameter is the type that will be serilized in the redolog. Also, if it is called without setting the path, serializer or data, this will panic.
pub async fn build_with_snapshots(self) -> PrevaylerResult<Prevayler<D, T, S>> where
D: Transaction<T>,
S: Serializer<D> + Serializer<T>,
P: AsRef<Path>,
[src]
D: Transaction<T>,
S: Serializer<D> + Serializer<T>,
P: AsRef<Path>,
Similar to the build
, but this will try to process any saved snapshot. Note that this method has an extra trait bound. The Serializer must know who to serialize and deserialize the prevailed data type.
Auto Trait Implementations
impl<T, D, S, P> !RefUnwindSafe for PrevaylerBuilder<T, D, S, P>
impl<T, D, S, P> !RefUnwindSafe for PrevaylerBuilder<T, D, S, P>
impl<T, D, S, P> Unpin for PrevaylerBuilder<T, D, S, P> where
D: Unpin,
P: Unpin,
S: Unpin,
T: Unpin,
impl<T, D, S, P> Unpin for PrevaylerBuilder<T, D, S, P> where
D: Unpin,
P: Unpin,
S: Unpin,
T: Unpin,
impl<T, D, S, P> !UnwindSafe for PrevaylerBuilder<T, D, S, P>
impl<T, D, S, P> !UnwindSafe for PrevaylerBuilder<T, D, S, P>