pub struct SyncProvider { /* private fields */ }Expand description
SyncProvider manages document synchronization with Volt server
Implementations§
Source§impl SyncProvider
impl SyncProvider
Sourcepub fn new(
doc: Doc,
database_id: impl Into<String>,
document_id: impl Into<String>,
) -> (Self, Receiver<SyncEvent>)
pub fn new( doc: Doc, database_id: impl Into<String>, document_id: impl Into<String>, ) -> (Self, Receiver<SyncEvent>)
Sourcepub async fn start(
&mut self,
client: &VoltClient,
read_only: bool,
read_only_fallback: bool,
) -> Result<()>
pub async fn start( &mut self, client: &VoltClient, read_only: bool, read_only_fallback: bool, ) -> Result<()>
Start synchronization with the Volt server
§Arguments
client- The VoltClient to use for synchronizationread_only- If true, only receive updates (no sending)read_only_fallback- If true, downgrade to read-only if write access denied
Sourcepub async fn send_update(&self, update: &[u8]) -> Result<()>
pub async fn send_update(&self, update: &[u8]) -> Result<()>
Send an update to the server
This should be called when the local document changes
Sourcepub async fn state(&self) -> ProviderState
pub async fn state(&self) -> ProviderState
Get the current provider state
Sourcepub async fn is_read_only(&self) -> bool
pub async fn is_read_only(&self) -> bool
Check if the provider is read-only
Auto Trait Implementations§
impl Freeze for SyncProvider
impl !RefUnwindSafe for SyncProvider
impl !Send for SyncProvider
impl !Sync for SyncProvider
impl Unpin for SyncProvider
impl !UnwindSafe for SyncProvider
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request