Skip to main content

SessionGraph

Struct SessionGraph 

Source
pub struct SessionGraph { /* private fields */ }
Expand description

A delta-based semantic graph for a single session workspace.

Lookups resolve in order: removed -> modified -> added -> base. This gives each session a consistent, isolated view of the symbol graph without copying the entire base.

Implementations§

Source§

impl SessionGraph

Source

pub fn fork_from(base: Arc<ArcSwap<HashMap<SymbolId, Symbol>>>) -> Self

Fork from a shared base symbol table.

Source

pub fn empty() -> Self

Create an empty session graph (no shared base).

Source

pub fn get_symbol(&self, id: SymbolId) -> Option<Symbol>

Look up a symbol by ID, respecting the session delta.

Resolution order:

  1. If removed in this session, return None.
  2. If modified in this session, return the modified version.
  3. If added in this session, return it.
  4. Fall through to the shared base.
Source

pub fn add_symbol(&self, symbol: Symbol)

Add a new symbol to this session.

Source

pub fn modify_symbol(&self, symbol: Symbol)

Modify an existing symbol (base or previously added).

Source

pub fn remove_symbol(&self, id: SymbolId)

Remove a symbol from the session view.

Source

pub fn add_edge(&self, edge: CallEdge)

Add a call edge.

Source

pub fn remove_edge(&self, edge_id: Uuid)

Remove a call edge.

Source

pub fn get_edge(&self, edge_id: Uuid) -> Option<CallEdge>

Look up an added edge by ID.

Returns None if the edge was not added in this session or has been removed.

Source

pub fn is_edge_removed(&self, edge_id: Uuid) -> bool

Returns true if the given edge ID is marked as removed in this session.

Source

pub fn changed_symbol_names(&self) -> Vec<String>

Return the names of all symbols changed in this session (added, modified, or removed).

Used by the conflict detector to find overlapping changes.

Source

pub fn update_from_parse( &self, _file_path: &str, new_symbols: Vec<Symbol>, base_symbols_for_file: &[Symbol], )

Update the session graph from a parse result for a single file.

Compares the new symbols against the base symbols for that file, and classifies each as added, modified, or removed within the session delta.

base_symbols_for_file should contain all symbols from the base that belong to the given file path.

Source

pub fn changed_symbols_for_file(&self, file_path: &str) -> Vec<String>

Return the names of symbols changed in this session that belong to the given file path. Useful for cross-session file awareness.

Source

pub fn change_count(&self) -> usize

Number of symbols changed (added + modified + removed).

Source

pub fn to_msgpack(&self) -> Result<Vec<u8>>

Serialize the session delta (modified/added/removed symbols and edges) to MessagePack bytes.

The shared base_symbols table is NOT included — it is repo-wide state managed independently of individual sessions.

Source

pub fn from_msgpack(bytes: &[u8]) -> Result<Self>

Deserialize a session delta from MessagePack bytes produced by Self::to_msgpack.

The returned graph has no shared base (base_symbols is None). Callers that need base-symbol lookups must call Self::fork_from and replay the delta on top.

Auto Trait Implementations§

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<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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
Source§

impl<T> Fruit for T
where T: Send + Downcast,