pub struct EditingTable { /* private fields */ }Expand description
Table of active CRDT editing sessions.
Implementations§
Source§impl EditingTable
impl EditingTable
pub fn new() -> Self
Sourcepub fn open(
&self,
client_id: &str,
fid: u32,
repo_id: &str,
worktree: &str,
rel_path: &str,
format: DocFormat,
content: &str,
) -> Result<Arc<Mutex<SharedDoc>>, String>
pub fn open( &self, client_id: &str, fid: u32, repo_id: &str, worktree: &str, rel_path: &str, format: DocFormat, content: &str, ) -> Result<Arc<Mutex<SharedDoc>>, String>
Open (or join) a CRDT editing session for a file.
If no shared doc exists for this file, creates one from content.
If one already exists, increments client_count and returns it.
Returns error if (client_id, fid) already has an active session.
Sourcepub fn get_session(
&self,
client_id: &str,
fid: u32,
) -> Option<Arc<Mutex<SharedDoc>>>
pub fn get_session( &self, client_id: &str, fid: u32, ) -> Option<Arc<Mutex<SharedDoc>>>
Get the shared doc for a client’s active session.
Sourcepub fn has_active_session(
&self,
repo_id: &str,
worktree: &str,
rel_path: &str,
) -> bool
pub fn has_active_session( &self, repo_id: &str, worktree: &str, rel_path: &str, ) -> bool
Check if a file has an active editing session (by any client).
Sourcepub fn close(&self, client_id: &str, fid: u32) -> bool
pub fn close(&self, client_id: &str, fid: u32) -> bool
Close a client’s editing session. Decrements client_count. Removes the shared doc if count reaches 0.
Returns true if the session existed and was closed.
Sourcepub fn on_reap(&self, client_id: &str, fid: u32)
pub fn on_reap(&self, client_id: &str, fid: u32)
Called when a fid is reaped by the idle reaper. Logs a warning if the session was dirty.
Sourcepub fn on_clunk(&self, client_id: &str, fid: u32)
pub fn on_clunk(&self, client_id: &str, fid: u32)
Called when a fid is clunked. Same as close but explicit name.
Sourcepub fn fid_has_session(&self, client_id: &str, fid: u32) -> bool
pub fn fid_has_session(&self, client_id: &str, fid: u32) -> bool
Check if a specific fid has an active editing session for the given file path. Used by handle_write to guard against direct writes to CRDT-edited files.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EditingTable
impl !RefUnwindSafe for EditingTable
impl Send for EditingTable
impl Sync for EditingTable
impl Unpin for EditingTable
impl UnsafeUnpin for EditingTable
impl !UnwindSafe for EditingTable
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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 moreSource§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>
T in a tonic::Request