Skip to main content

PacksetClient

Struct PacksetClient 

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

Implementations§

Source§

impl PacksetClient

Source

pub fn new(base: impl Into<String>) -> Self

Source

pub fn with_workspace(self, workspace: impl Into<String>) -> Self

Pin the workspace this client speaks for, ahead of PACKSET_WORKSPACE and the working directory. A seat that is one memory across every repository it works in sets this once.

Source

pub fn from_env() -> Result<Self, Error>

The writer the seat talks to, with nothing set: PACKSET_URL (INSIDE_MEMORY_URL is an alias), else the loopback port the command line starts a writer on, PACKSET_PORT (LJOS_MEM_PORT) or 8761. PACKSET_URL=off is the one way to have no pack.

Source

pub fn base(&self) -> &str

Source

pub fn workspace(&self) -> String

Source

pub fn workspace_for_cwd(&self, cwd: &Path) -> String

Workspace id from /v1/identity for cwd, or dir:<abs> if that call fails.

Source

pub fn health(&self) -> Result<String, Error>

Source

pub fn get_atom(&self, workspace: &str, id: &str) -> Result<Value, Error>

Source

pub fn list_atoms(&self, workspace: &str) -> Result<Vec<Value>, Error>

Source

pub fn atoms_as_of( &self, workspace: &str, as_of: Option<&str>, ) -> Result<Vec<Value>, Error>

Live-now atoms, or the ones that were live at as_of.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn atoms_without_vectors( &self, workspace: &str, as_of: Option<&str>, ) -> Result<Vec<Value>, Error>

Self::atoms_as_of without the dense vectors, for a reader of texts, review clocks or rules: the vectors are most of the bytes. A writer older than the embedding=omit query sends them anyway.

§Errors

The pack not answering, or an answer that is not atoms.

Source

pub fn search( &self, workspace: &str, q: &str, limit: u32, ) -> Result<Vec<Hit>, Error>

Source

pub fn search_as_of( &self, workspace: &str, q: &str, limit: u32, as_of: Option<&str>, ) -> Result<Vec<Hit>, Error>

Ranked hits, optionally over the atoms that were live at as_of.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn search_opts( &self, workspace: &str, q: &str, limit: u32, as_of: Option<&str>, rerank: bool, ) -> Result<Vec<Hit>, Error>

Ranked hits, optionally dated and optionally through the measured cross-encoder stage.

Off by default. On, the writer spends a forward pass per candidate and the request waits for that rather than the usual five-second budget.

§Errors

The request’s, or a body that is not a hit list.

Source

pub fn search_ranked( &self, workspace: &str, q: &str, limit: u32, as_of: Option<&str>, rerank: bool, rank: Option<&str>, ) -> Result<Vec<Hit>, Error>

Self::search_opts with a rank. Some("relevance") asks for the top k by lexical, BM25 and cosine, with no half-life and no retrievability. None leaves the shipped order. An older writer ignores the parameter; GET /v1/status lists search.ranks when this writer honours it.

§Errors

The request’s, including a rank the writer refuses, or a body that is not a hit list.

Source

pub fn status(&self, workspace: Option<&str>) -> Result<Value, Error>

Seat home, atom counts by kind, pin, index and embedder.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn pin(&self, workspace: &str) -> Result<Value, Error>

The set a workspace is pinned to.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn set_pin(&self, workspace: &str, name: &str) -> Result<Value, Error>

Pin a workspace to a set.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn accessions(&self, workspace: &str) -> Result<Vec<String>, Error>

The deed accessions a workspace’s live atoms cite, sorted.

The accession is the only identifier crossing the tracker, the pack and the deed store, so this is what deedar evidence - reads.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn atoms(&self, workspace: &str) -> Result<Vec<Value>, Error>

Every live atom in a workspace.

The bodies, not the join keys: this is what a handover carries when somebody is given what the seat learned rather than only what it cites.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn atoms_of_kind( &self, workspace: &str, kind: &str, ) -> Result<Vec<Value>, Error>

The live atoms of one kind in a workspace: personas, trust rows, habits, without the rest of the pack.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn citers( &self, workspace: &str, accession: &str, ) -> Result<Vec<Value>, Error>

The live atoms in a workspace that cite one deed accession.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn delete_atom( &self, workspace: &str, id: &str, why: Option<&str>, ) -> Result<Value, Error>

Tombstone one atom. The daemon keeps the record and drops the index entry, so a forgotten atom stops being recalled without the pack losing the fact that it once held it.

why is the deed accession that withdrew the claim, or the plain-text reason when the seat has no accession. An accession is stored as retracted_by. Plain text is stored as why_text, and the answer carries one warning line. The retraction and what it retracted read back together either way.

§Errors

Error::Bad when the workspace does not hold that atom, else the request’s or a body that is not JSON.

Source

pub fn grade( &self, workspace: &str, id: &str, recalled: bool, ) -> Result<Value, Error>

Move one atom along the review clock: recalled, or lapsed.

Source

pub fn hubs(&self, workspace: &str, limit: usize) -> Result<Value, Error>

The link graph’s communities, largest first. The claims the link graph turns on, highest first.

Source

pub fn islands(&self, workspace: &str) -> Result<Value, Error>

Source

pub fn fire(&self, workspace: &str, ids: &[String]) -> Result<Value, Error>

Claims that fired together: their links gain weight.

Source

pub fn fire_as( &self, workspace: &str, ids: &[String], lens: Option<&str>, ) -> Result<Value, Error>

Self::fire through a persona’s lens: the weights move under its name and the seat’s stand.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn consolidate(&self, workspace: &str, apply: bool) -> Result<Value, Error>

Consolidate the workspace: every claim that replaces an earlier one closes it (the write-time rule, run over what is held). apply false reports the pairs and writes nothing.

Source

pub fn sweep(&self, workspace: &str) -> Result<Value, Error>

Sweep a workspace for neglect: reviews left due past twice their interval lapse, and the third miss forgets a never-recalled lesson.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn forget_workspace(&self, workspace: &str) -> Result<Value, Error>

Drop a scratch workspace’s live atoms, no deed; its tombstones stay. Retraction stays Self::delete_atom; this is what a per-run scratch workspace calls on its way out.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn activate( &self, workspace: &str, q: &str, limit: u32, fire: bool, ) -> Result<Value, Error>

The memories a cue activates, strongest first; with fire, the top of them fire together.

Source

pub fn activate_as( &self, workspace: &str, q: &str, limit: u32, fire: bool, lens: Option<&str>, ) -> Result<Value, Error>

Self::activate through a persona’s lens: the spread follows the weights that persona wrote, and a fire writes them.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn atoms_in_set( &self, workspace: &str, set: &str, ) -> Result<Vec<Value>, Error>

The live atoms of one named set in a workspace: a persona’s own conclusions, a pinned slice.

§Errors

The request’s, or a body that is not JSON.

Source

pub fn post_atom(&self, atom: &Value) -> Result<Value, Error>

Trait Implementations§

Source§

impl Clone for PacksetClient

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PacksetClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.