pub struct PacksetClient { /* private fields */ }Implementations§
Source§impl PacksetClient
impl PacksetClient
pub fn new(base: impl Into<String>) -> Self
Sourcepub fn with_workspace(self, workspace: impl Into<String>) -> Self
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.
Sourcepub fn from_env() -> Result<Self, Error>
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.
pub fn base(&self) -> &str
pub fn workspace(&self) -> String
Sourcepub fn workspace_for_cwd(&self, cwd: &Path) -> String
pub fn workspace_for_cwd(&self, cwd: &Path) -> String
Workspace id from /v1/identity for cwd, or dir:<abs> if that call fails.
pub fn health(&self) -> Result<String, Error>
Sourcepub fn stats(&self) -> Result<Value, Error>
pub fn stats(&self) -> Result<Value, Error>
Queue depth, shed counts and the current limits. line is ok, or
busy, retrying when work is waiting.
§Errors
The request’s, or a body that is not JSON.
pub fn get_atom(&self, workspace: &str, id: &str) -> Result<Value, Error>
pub fn list_atoms(&self, workspace: &str) -> Result<Vec<Value>, Error>
Sourcepub fn atoms_as_of(
&self,
workspace: &str,
as_of: Option<&str>,
) -> Result<Vec<Value>, Error>
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.
Sourcepub fn atoms_without_vectors(
&self,
workspace: &str,
as_of: Option<&str>,
) -> Result<Vec<Value>, Error>
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.
pub fn search( &self, workspace: &str, q: &str, limit: u32, ) -> Result<Vec<Hit>, Error>
Sourcepub fn search_as_of(
&self,
workspace: &str,
q: &str,
limit: u32,
as_of: Option<&str>,
) -> Result<Vec<Hit>, Error>
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.
Sourcepub fn search_opts(
&self,
workspace: &str,
q: &str,
limit: u32,
as_of: Option<&str>,
rerank: bool,
) -> Result<Vec<Hit>, Error>
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.
Sourcepub fn search_ranked(
&self,
workspace: &str,
q: &str,
limit: u32,
as_of: Option<&str>,
rerank: bool,
rank: Option<&str>,
) -> Result<Vec<Hit>, Error>
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.
Sourcepub fn status(&self, workspace: Option<&str>) -> Result<Value, Error>
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.
Sourcepub fn accessions(&self, workspace: &str) -> Result<Vec<String>, Error>
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.
Sourcepub fn atoms(&self, workspace: &str) -> Result<Vec<Value>, Error>
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.
Sourcepub fn atoms_of_kind(
&self,
workspace: &str,
kind: &str,
) -> Result<Vec<Value>, Error>
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.
Sourcepub fn citers(
&self,
workspace: &str,
accession: &str,
) -> Result<Vec<Value>, Error>
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.
Sourcepub fn delete_atom(
&self,
workspace: &str,
id: &str,
why: Option<&str>,
) -> Result<Value, Error>
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.
Sourcepub fn grade(
&self,
workspace: &str,
id: &str,
recalled: bool,
) -> Result<Value, Error>
pub fn grade( &self, workspace: &str, id: &str, recalled: bool, ) -> Result<Value, Error>
Move one atom along the review clock: recalled, or lapsed.
Sourcepub fn hubs(&self, workspace: &str, limit: usize) -> Result<Value, Error>
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.
pub fn islands(&self, workspace: &str) -> Result<Value, Error>
Sourcepub fn fire(&self, workspace: &str, ids: &[String]) -> Result<Value, Error>
pub fn fire(&self, workspace: &str, ids: &[String]) -> Result<Value, Error>
Claims that fired together: their links gain weight.
Sourcepub fn fire_as(
&self,
workspace: &str,
ids: &[String],
lens: Option<&str>,
) -> Result<Value, Error>
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.
Sourcepub fn consolidate(&self, workspace: &str, apply: bool) -> Result<Value, Error>
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.
Sourcepub fn sweep(&self, workspace: &str) -> Result<Value, Error>
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.
Sourcepub fn forget_workspace(&self, workspace: &str) -> Result<Value, Error>
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.
Sourcepub fn activate(
&self,
workspace: &str,
q: &str,
limit: u32,
fire: bool,
) -> Result<Value, Error>
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.
Sourcepub fn activate_as(
&self,
workspace: &str,
q: &str,
limit: u32,
fire: bool,
lens: Option<&str>,
) -> Result<Value, Error>
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.
Sourcepub fn atoms_in_set(
&self,
workspace: &str,
set: &str,
) -> Result<Vec<Value>, Error>
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.