Skip to main content

Service

Struct Service 

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

Implementations§

Source§

impl Service

Source

pub fn open(home: Home) -> Result<Self>

Open the pack at home.

§Errors

Fails when the store cannot be opened or the lock is held.

Source

pub fn with_live_cap(self, cap: usize) -> Self

The same service with another live cap; zero is none.

Source

pub fn live_cap(&self) -> usize

Most live claims a workspace holds before the least retrievable are forgotten; zero is no cap.

Source

pub fn home(&self) -> &Home

The pack home.

Source

pub fn store(&self) -> &Store

The atom store.

Source

pub fn add(&self, atom: Record) -> Result<Record>

Store one atom, or return the live one with the same text, kind and set.

§Errors

AtomError when the text is a tool dump or the record does not validate, else the store’s.

Source

pub fn update( &self, workspace: &str, id: &str, fields: &Map<String, Value>, ) -> Result<Record>

Merge fields into one current atom.

§Errors

AtomError when the id is not current or the result does not validate, else the store’s.

Source

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

Move one atom along the review clock.

§Errors

As Service::update.

Source

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

Tombstone one atom and drop it from the projection.

why names the deed that withdrew the claim. A retraction cites a deed or nothing, so unlike an entity it is refused when it is free text: the point of writing it is that deedar evidence can be asked about it, and a name no deed store answers for is a citation that only looks like one.

§Errors

AtomError when why is not a deed accession, else the store’s.

Source

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

The workspace pack, or the same shape scoped to one set.

Always user / memory / atoms, so a client splices one shape whether or not a set is pinned.

§Errors

AtomError for a bad set name, else the store’s.

Source

pub fn pin(&self, workspace: &str) -> String

The active set for a workspace, or empty when nothing is pinned.

Source

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

Pin a set, or clear the pin when the name is empty.

§Errors

AtomError for a bad name, else the write’s.

Source

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

The pin plus that set’s standing instructions.

§Errors

Never, in practice: an unreadable set reads as empty.

Source

pub fn write_set( &self, workspace: &str, name: &str, body: &Map<String, Value>, ) -> Result<String, WriteError>

Write whichever of a set’s three cards the body carried.

Absent and empty are different: a key that is not there leaves that card alone, and a key set to an empty string clears it.

§Errors

AtomError for a bad set name, else the write’s.

Source

pub fn set_user(&self, text: &str) -> Result<(), WriteError>

Write the seat card, archiving and refusing on overflow.

§Errors

The write’s, with overflow distinguishable so the caller can answer 413.

Source

pub fn set_memory(&self, workspace: &str, text: &str) -> Result<(), WriteError>

Write a workspace card, archiving and refusing on overflow.

§Errors

As Service::set_user.

Source

pub fn archive(&self, workspace: &str, text: &str) -> Result<(), WriteError>

Append to today’s archive for a workspace.

§Errors

The write’s.

Source

pub fn put_attach(&self, workspace: &str, text: &str, label: &str) -> Value

Hold one body for a workspace, capped.

Source

pub fn take_attach(&self, workspace: &str) -> Option<Attachment>

Take the held body, leaving the slot empty: an attachment is one turn’s.

Source

pub fn peek_attach(&self, workspace: &str) -> Option<Attachment>

Read the held body without taking it.

Source

pub fn as_of(&self, workspace: &str, at: &str) -> Result<Value>

The atoms that were live at at, over the valid_from / valid_to window.

§Errors

The store’s, or a stamp parse_millis will not accept.

Source

pub fn search( &self, workspace: &str, query: &str, limit: usize, set: Option<&str>, panel: &Panel, as_of: Option<&str>, rerank: bool, ) -> Result<Value>

Ranked hits, and which engine produced them: the projection when present, else the linear scan; any projection failure falls back whole. as_of retrieves the atoms live then; rerank runs the cross-encoder second stage.

§Errors

AtomError for a bad set name, a stamp parse_millis will not accept, else the store’s.

Source

pub fn compact( &self, workspace: &str, day: Option<&str>, transcript: Option<&str>, ) -> Result<Value>

Mine one archived day into proposals.

§Errors

The miner’s, or the store’s.

Source

pub fn propose(&self, body: &Map<String, Value>) -> Result<Value>

Propose one claim from one piece of text.

§Errors

The miner’s, or AtomError when there is nothing to propose.

Source

pub fn accept(&self, workspace: &str, proposal_id: &str) -> Result<Record>

Turn an accepted proposal into a stored atom.

§Errors

The miner’s, or the store’s.

Source

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

The islands of a workspace: the link graph’s communities, largest first, each as the atoms it holds.

§Errors

The store’s.

Source

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

The claims the link graph turns on, highest first: a weighted PageRank over the links. What matters in the pack by its own connections, before any query.

§Errors

The store’s.

Source

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

Claims that fired together: every pair’s link gains weight, their other links lose a little, and a missing link is made. Returns how many records changed.

§Errors

The store’s.

Source

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

Consolidate the live set: in the order they were written, every claim that replaces an earlier one (record::replaces: an explicit supersedes, a correction sharing an entity, a rewrite, or a new object under the same head) closes the earlier one’s window and names it. What a write does on arrival, run over what is already held, for a pack written before the rule or filled by import. With apply false nothing is written; the pairs are reported.

§Errors

The store’s.

Source

pub fn activate( &self, workspace: &str, query: &str, limit: usize, panel: &Panel, fire: bool, ) -> Result<Value>

The memories a cue activates: the top search hits as seeds, spread two hops along the links, strongest first. With fire, the top [FIRE_TOP] of them fire together.

§Errors

As Service::search, else the store’s.

Source

pub fn proposals(&self, workspace: &str) -> Vec<Value>

The open proposals for a workspace.

Source

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

Every deed accession cited by a live atom in a workspace, sorted.

The accession is the only identifier that crosses the tracker, the pack and the deed store, so a pack has to be able to list its own citations the way a tracker does. A product cited by one atom and by nothing else is exactly the citation that goes stale unnoticed.

§Errors

The store’s.

Source

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

The live atoms that cite one deed accession.

The other direction of Service::accessions, and the pack’s half of the backwards walk: a tracker answers which issues cite a product, and this answers which remembered claims do. Neither store opens the other, so what composes them is a caller holding one accession.

§Errors

The store’s.

Source

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

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

§Errors

The scan’s.

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, 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.