Skip to main content

GraphHandle

Struct GraphHandle 

Source
pub struct GraphHandle { /* private fields */ }

Implementations§

Source§

impl GraphHandle

Source

pub fn new( path: &Path, durability: Durability, tuning: SqliteTuning, _lru_cache_size: NonZeroUsize, read_pool_size: usize, ) -> Result<Self>

Source

pub fn get_entity(&self, name: &str) -> Result<Option<Entity>>

Source

pub fn create_entities(&self, entities: &[EntityInput]) -> Result<Vec<Entity>>

Source

pub fn upsert_entities(&self, entities: &[EntityInput]) -> Result<Vec<Entity>>

Source

pub fn delete_entities(&self, names: &[String]) -> Result<()>

Source

pub fn create_relations( &self, relations: &[RelationInput], ) -> Result<Vec<Relation>>

Source

pub fn delete_relations(&self, relations: &[Relation]) -> Result<()>

Source

pub fn add_relation_observations( &self, from: &str, to: &str, relation_type: &str, contents: &[ObservationInput], ) -> Result<Vec<Observation>>

Source

pub fn delete_relation_observations( &self, from: &str, to: &str, relation_type: &str, observations: &[ObservationInput], ) -> Result<()>

Source

pub fn set_attributes(&self, targets: &[AttributeSet]) -> Result<()>

Source

pub fn delete_attributes(&self, targets: &[AttributeDelete]) -> Result<()>

Source

pub fn add_observations( &self, entity_name: &str, contents: &[ObservationInput], ) -> Result<Vec<Observation>>

Source

pub fn delete_observations( &self, entity_name: &str, observations: &[ObservationInput], ) -> Result<()>

Source

pub fn merge_entities(&self, source: &str, target: &str) -> Result<Entity>

Source

pub fn rename_entity(&self, old_name: &str, new_name: &str) -> Result<Entity>

Source

pub fn code_purge_file(&self, rel_path: &str) -> Result<usize>

Delete a code file and all its defined symbols in the same transaction.

Source

pub fn search_nodes_filtered( &self, query: &str, filter_type: Option<&str>, offset: usize, limit: usize, ) -> Vec<Entity>

Source

pub fn search_nodes_lite_json( &self, query: &str, filter_type: Option<&str>, offset: usize, limit: usize, ) -> (String, usize, bool)

The viewer’s search payload: a JSON array of {name, entityType, obsCount} (no observation bodies — see [batch_entity_lite_by_ids]), in the same order and with the same post-filter offset semantics as Self::search_nodes_filtered. Returns (entities_json, returned, has_more); has_more is detected by fetching one extra match past the page. Builds the JSON directly to avoid a Vec<Entity> round-trip.

Source

pub fn read_graph_filtered( &self, filter_type: Option<&str>, offset: usize, limit: usize, ) -> Result<String>

Source

pub fn read_graph_filtered_lite( &self, filter_type: Option<&str>, offset: usize, limit: usize, ) -> Result<(String, usize)>

Observation-free page for the browser viewer: entities carry obsCount (the denormalised count) instead of the observation bodies, which the canvas never renders in bulk — the inspector lazy-loads them for the one selected node via GET /ui/node. Returns (json, returned) so the caller can build the pagination cursor without re-parsing the payload.

Source

pub fn open_nodes(&self, names: &[String]) -> String

Source

pub fn entities_exist(&self, names: &[String]) -> Result<Vec<bool>>

Source

pub fn degree(&self, name: &str, direction: Direction) -> Result<usize>

Source

pub fn get_entity_count(&self) -> Result<usize>

Source

pub fn get_relation_count(&self) -> Result<usize>

Source

pub fn search_relations( &self, from: Option<&str>, to: Option<&str>, rtype: Option<&str>, query: Option<&str>, limit: Option<usize>, ) -> Result<Vec<RelationDetail>>

Source

pub fn find_path(&self, from: &str, to: &str) -> Result<Option<Vec<String>>>

Source

pub fn compact(&self) -> Result<()>

Source

pub fn neighbors( &self, name: &str, direction: Direction, rtype: Option<&str>, depth: u32, ) -> Result<String>

Source

pub fn extract_subgraph(&self, names: &[String], depth: u32) -> Result<String>

Source

pub fn describe_entity(&self, name: &str) -> Result<EntityDescription>

Source

pub fn entity_type_counts(&self) -> Vec<(String, usize)>

Source

pub fn entity_type_catalog(&self) -> Vec<(String, usize, Option<String>)>

(name, count, desc) for every registered entity type: one with members, or one whose description registers it before first use.

Source

pub fn ui_meta(&self) -> (Vec<(String, usize)>, usize, usize)

The viewer’s shared page metadata — entity-type legend and the graph-wide entity/relation totals — gathered on a single reader connection. The /ui/graph and /ui/search handlers used to take three or four separate reader-pool acquisitions per request (entity_type_counts + get_entity_count + get_relation_count); folding them into one lock acquisition cuts pool churn and shortens the reader hold, which is what bounds concurrent read throughput.

Source

pub fn relation_type_counts(&self) -> Vec<(String, usize)>

Source

pub fn relation_type_catalog(&self) -> Vec<(String, usize, Option<String>)>

(name, count, desc) for every registered relation type: one with members, or one whose description registers it before first use.

Source

pub fn set_type_description( &self, kind: i64, name: &str, description: Option<&str>, ) -> Result<()>

Set or clear the description of one entity type (kind 0) or relation type (kind 1) by exact name. The type row is created when it does not exist yet — a description can thus register a type before its first member (count stays 0). None clears the stored description. This is registry metadata, not a graph mutation: no change event is emitted and the taxonomy index revision is untouched.

Source

pub fn entity_type_exists(&self, name: &str) -> bool

Whether an entity type with the given name exists. Read-only: a missing type stays absent and no row is inserted.

Source

pub fn relation_type_exists(&self, name: &str) -> bool

Whether a relation type with the given name exists. Read-only: a missing type stays absent and no row is inserted.

Source

pub fn batch_get_entities(&self, names: &[String]) -> Vec<Option<Entity>>

Source

pub fn find_all_paths( &self, from: &str, to: &str, max_depth: usize, max_paths: usize, ) -> Result<Vec<Vec<String>>>

Source

pub fn export(&self, _format: &str, max_rows: i64) -> Result<String>

Export the whole graph as a JSON string. max_rows caps both the entity and relation arrays so a pathologically large graph cannot be coerced into an unbounded in-memory string (DoS guard); callers pass a generous constant. A negative value means “no limit”.

Source

pub fn wipe(&self) -> Result<()>

Source

pub fn run_maintenance(&self) -> Result<()>

Periodic database maintenance: WAL checkpoint, query planner analysis, and FTS index optimization. Call from a background timer.

Source

pub fn checkpoint_passive(&self) -> Result<()>

Run a non-blocking wal_checkpoint(PASSIVE) to fsync committed WAL frames without stalling readers or writers. Call from a short-interval timer to bound the durability window in async mode.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

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

fn try_from(value: U) -> Result<T, !>

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.