pub struct GraphHandle { /* private fields */ }Expand description
Wait-free read / serialized-write handle to the graph.
Readers load a frozen ReadSnapshot via read
(lock-free via ArcSwap). Writers take a Mutex lock, mutate the
underlying KnowledgeGraph, and publish a fresh snapshot on unlock
via the WriteGuard drop glue.
Implementations§
Source§impl GraphHandle
impl GraphHandle
Sourcepub fn new(path: &Path) -> Result<Self>
pub fn new(path: &Path) -> Result<Self>
Open or create the graph at path, seeding the initial snapshot.
Sourcepub fn read(&self) -> ReadSnapshot
pub fn read(&self) -> ReadSnapshot
Lock-free read snapshot. Holds an Arc reference to the frozen graph data.
Sourcepub fn write(&self) -> WriteGuard<'_>
pub fn write(&self) -> WriteGuard<'_>
Serialised write access. Returns a guard that publishes a fresh snapshot
when dropped (or when WriteGuard::publish is called eagerly).
Auto Trait Implementations§
impl !Freeze for GraphHandle
impl !RefUnwindSafe for GraphHandle
impl !UnwindSafe for GraphHandle
impl Send for GraphHandle
impl Sync for GraphHandle
impl Unpin for GraphHandle
impl UnsafeUnpin for GraphHandle
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