pub struct SyncServer { /* private fields */ }Available on crate features
sync and sync-http only.Expand description
Server-side sync handler.
Processes incoming sync requests from remote peers. Framework-agnostic — consumers create web handlers that delegate to this struct’s methods.
The server manages its own ChangePoller for serving pull requests and
delegates push handling to RemoteChangeApplier.
Implementations§
Source§impl SyncServer
impl SyncServer
Sourcepub fn new(db: Arc<PulseDB>, config: SyncConfig) -> Self
pub fn new(db: Arc<PulseDB>, config: SyncConfig) -> Self
Creates a new SyncServer for the given database.
Sourcepub fn instance_id(&self) -> InstanceId
pub fn instance_id(&self) -> InstanceId
Returns the server’s instance ID.
Sourcepub fn handle_handshake(
&self,
request: HandshakeRequest,
) -> Result<HandshakeResponse, SyncError>
pub fn handle_handshake( &self, request: HandshakeRequest, ) -> Result<HandshakeResponse, SyncError>
Handles a handshake request.
Sourcepub fn handle_push(
&self,
changes: Vec<SyncChange>,
) -> Result<PushResponse, SyncError>
pub fn handle_push( &self, changes: Vec<SyncChange>, ) -> Result<PushResponse, SyncError>
Handles a push request — applies remote changes locally.
Sourcepub fn handle_pull(
&self,
request: PullRequest,
) -> Result<PullResponse, SyncError>
pub fn handle_pull( &self, request: PullRequest, ) -> Result<PullResponse, SyncError>
Handles a pull request — serves local changes to the remote peer.
Sourcepub fn handle_health(&self) -> Result<(), SyncError>
pub fn handle_health(&self) -> Result<(), SyncError>
Handles a health check.
Sourcepub fn handle_handshake_bytes(&self, body: &[u8]) -> Result<Vec<u8>, SyncError>
pub fn handle_handshake_bytes(&self, body: &[u8]) -> Result<Vec<u8>, SyncError>
Handles a handshake from raw bincode bytes.
Auto Trait Implementations§
impl Freeze for SyncServer
impl !RefUnwindSafe for SyncServer
impl Send for SyncServer
impl Sync for SyncServer
impl Unpin for SyncServer
impl UnsafeUnpin for SyncServer
impl !UnwindSafe for SyncServer
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> 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>
Converts
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>
Converts
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 more