Skip to main content

Syncing

Struct Syncing 

Source
pub struct Syncing<'a> { /* private fields */ }
Expand description

The library as a sync reads and changes it.

Implementations§

Source§

impl<'a> Syncing<'a>

Source

pub fn new(library: &'a mut Library, now: &'a dyn Fn() -> u64) -> Self

A sync of library, with the wall clock now.

Source

pub fn proving(self, removals: &'a mut Removals) -> Self

The same, putting to the other replica the challenges that a pass of removals has for it, and noting its answers there.

Source

pub const fn refused(&self) -> usize

How many blobs and ordinary changes were refused, as the disk would have had less than 1 GiB free.

Trait Implementations§

Source§

impl Drop for Syncing<'_>

Source§

fn drop(&mut self)

Saves what the open batch received, as a sync that fails keeps what it received; after a panic, leaves it out, as the log may hold a change half taken.

Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Holder for Syncing<'_>

Source§

type Error = NodeError

Why reading or writing the data failed.
Source§

fn verifying_key(&self) -> VerifyingKey

The replica’s verifying key.
Source§

fn sign(&self, context: &'static str, message: &[u8]) -> Signature

Signs a message with the replica’s signing key.
Source§

fn spaces_with(&self, peer: &VerifyingKey) -> Result<Vec<SpaceId>, NodeError>

The spaces the replica holds in which peer is a replica that it syncs with, sorted by ID: also those in which Holder::introduced took a listing of peer’s. Read more
Source§

fn introductions( &self, peer: &[u8; 32], ) -> Result<Vec<RecoveryListing>, NodeError>

The listings of the replica’s own key by a recovery code, which it sends in its hello as the initiator, so that a peer that does not know its key yet syncs with it: for the replica whose endpoint ID is peer, which it connected to, one for each space or group that lists it so and that it shares with that replica, which holds those IDs already; at most crate::MOST_INTRODUCTIONS. None by default. Read more
Source§

fn introduced( &mut self, peer: &VerifyingKey, listings: &[RecoveryListing], ) -> Result<(), NodeError>

Takes the listings by a recovery code that peer sent in its hello, none if it sent none, before Holder::spaces_with, for this sync alone: a space or group for which the replica holds a code that counts, which signed the listing of peer’s key there, it syncs with peer as with its replicas, which brings the change that lists peer. Takes none by default. Read more
Source§

fn prepare(&mut self, space: SpaceId) -> Result<(), NodeError>

Readies a space for its sync, before Holder::holdings: a replica brings its own account of what it holds up to date here. One that keeps no account has nothing to do. Read more
Source§

fn holdings(&self, space: SpaceId) -> Result<Vec<Holding>, NodeError>

Everything a space holds, for reconciling. Read more
Source§

fn account( &self, space: SpaceId, id: &Hash, ) -> Result<Option<Vec<u8>>, NodeError>

The encoding of a page of an account that the replica keeps, by the hash of its encoding; None if it no longer keeps it. Read more
Source§

fn receive_account( &mut self, space: SpaceId, page: Vec<u8>, ) -> Result<bool, NodeError>

Takes a page of an account from the other replica, and returns whether it kept it: only a page that its author signed, of a replica of the space, and later than the one of that page that it keeps. Read more
Source§

fn sends( &self, space: SpaceId, peer: &VerifyingKey, holding: &Holding, ) -> Result<bool, NodeError>

Whether to send peer an item of a space that it lacks: every item, but to a peer that the space no longer gives what is added, as a member’s replica that was removed, only what it may still get. What is not sent is still reconciled, so that neither side asks for what the other holds already. Read more
Source§

fn wanted_blobs( &mut self, space: SpaceId, peer: &VerifyingKey, asked: &BTreeSet<Hash>, most: usize, ) -> Result<Vec<Hash>, NodeError>

The sealed blobs of a space that the replica asks peer for, at most most of them: those it keeps and lacks, of which peer’s account lists a copy, or all of them if it keeps no account of peer in the space; none of asked, which it asked peer for before in this sync of the space. Asked once what came of the space is saved. Read more
Source§

fn sends_blobs( &self, space: SpaceId, peer: &VerifyingKey, ) -> Result<bool, NodeError>

Whether to send peer the sealed blobs of a space that it asks for: every one, but none to a peer that the space no longer gives what is added. Read more
Source§

fn challenges( &mut self, space: SpaceId, peer: &VerifyingKey, ) -> Result<Vec<Challenge>, NodeError>

The challenges to put to peer of a space’s sealed blobs, which it is to prove that it holds now: of the copies that this replica is about to remove, for which a copy on the peer’s disk is to stand, at most CHALLENGES_AT_ONCE, as a sync puts no more to it in a space. None by default. Asked as the initiator, once the blobs asked for came. Read more
Source§

fn proved( &mut self, space: SpaceId, peer: &VerifyingKey, challenges: &[Challenge], answers: &[Option<[u8; 32]>], ) -> Result<(), NodeError>

Takes peer’s answers to the challenges put to it, in their order: None for a blob that it did not prove. Read more
Source§

fn prove( &mut self, space: SpaceId, peer: &VerifyingKey, challenges: &[Challenge], ) -> Result<Vec<Option<[u8; 32]>>, NodeError>

Answers the challenges that peer puts to this replica, in their order: for each sealed blob of the space that it holds and is not removing, once it has recorded that it holds the blob for a while, the answer that Challenge::answer gives from its bytes; None for the others. Answers none by default. Read more
Source§

fn parcel( &self, space: SpaceId, id: ChangeId, ) -> Result<Option<Parcel>, NodeError>

An accepted change with its sealed payload and wrapped keys, as far as the replica has them. Read more
Source§

fn blob( &self, space: SpaceId, sealed: &Hash, ) -> Result<Option<(u64, BlobBytes<'_>)>, NodeError>

A sealed blob that the replica holds, with its size in bytes. Read more
Source§

fn receive_change( &mut self, space: SpaceId, peer: &VerifyingKey, parcel: Parcel, ) -> Result<bool, NodeError>

Takes a change from the other replica, peer, and returns whether it kept anything of it. One that the log rejects, or has already, or that the replica takes nothing like from that peer, is dropped, and is no error. Read more
Source§

fn receive_record_key( &mut self, space: SpaceId, statement: StatementId, key: WrappedKey, ) -> Result<bool, NodeError>

Takes a wrapped record key from the other replica, and returns whether it kept it. Read more
Source§

fn receive_blob_key( &mut self, space: SpaceId, sealed: Hash, key: WrappedBlobKey, ) -> Result<bool, NodeError>

Takes a wrapped blob key from the other replica, and returns whether it kept it. Read more
Source§

fn receive_blob( &mut self, space: SpaceId, sealed: Hash, size: u64, bytes: &mut dyn Read, ) -> Result<bool, NodeError>

Takes a sealed blob of size bytes from the other replica, and returns whether it kept it: only if its bytes have the sealed hash, and the replica wants it, such as one whose key it holds. It need not read all of bytes, and should read none of a blob it does not want. Read more
Source§

fn finish_space(&mut self, space: SpaceId) -> Result<(), NodeError>

Saves what was received of a space, after its last item. Read more
Source§

fn pause(&mut self) -> Result<(), NodeError>

Saves what it holds unsaved of what it received, as the sync is about to wait for the other replica, or to send it items: a replica that saves received items together does not keep them waiting on the network. One that saves each item as it comes has nothing to do. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for Syncing<'a>

§

impl<'a> !RefUnwindSafe for Syncing<'a>

§

impl<'a> !Send for Syncing<'a>

§

impl<'a> !Sync for Syncing<'a>

§

impl<'a> !UnwindSafe for Syncing<'a>

§

impl<'a> Forget for Syncing<'a>

§

impl<'a> Move for Syncing<'a>

§

impl<'a> Unpin for Syncing<'a>

§

impl<'a> UnsafeUnpin for Syncing<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more