InMemoryLongTermStore

org.llm4s.agent.harness.InMemoryLongTermStore
See theInMemoryLongTermStore companion object
@Experimental
final class InMemoryLongTermStore extends LongTermStore

The in-memory LongTermStore, for tests and single-process applications: one lock for the store. search is a case-insensitive substring match over keys and string values.

Attributes

Companion
object
Source
LongTermStore.scala
Graph
Supertypes
trait AppliedKeys
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

How many applied keys the store holds: C4's guard forgets each once its outcome is recorded.

How many applied keys the store holds: C4's guard forgets each once its outcome is recorded.

Attributes

Source
LongTermStore.scala
override def deleteNamespace(ns: Namespace): Result[Int]

Deletes every item of ns (#3269), answering how many: an operator's call - a user's memories forgotten, a namespace retired - not a run's, so it is neither fenced nor guarded, and a run writing to ns meanwhile may leave items behind. Applied keys stay, as their threads' replay needs them. The default answers that this store cannot; every llm4s store can.

Deletes every item of ns (#3269), answering how many: an operator's call - a user's memories forgotten, a namespace retired - not a run's, so it is neither fenced nor guarded, and a run writing to ns meanwhile may leave items behind. Applied keys stay, as their threads' replay needs them. The default answers that this store cannot; every llm4s store can.

Attributes

Definition Classes
Source
LongTermStore.scala
override def deleteTenant(tenant: Option[TenantId]): Result[Int]

Deletes every item of every namespace of tenant (#3269) - None, the namespaces of no tenant - answering how many: a tenant's offboarding, by an index, without knowing its namespaces or keys. Unfenced, as deleteNamespace is. The default answers that this store cannot; every llm4s store can.

Deletes every item of every namespace of tenant (#3269) - None, the namespaces of no tenant - answering how many: a tenant's offboarding, by an index, without knowing its namespaces or keys. Unfenced, as deleteNamespace is. The default answers that this store cannot; every llm4s store can.

Attributes

Definition Classes
Source
LongTermStore.scala
def forget(key: EffectKey, token: FencingToken): Result[Unit]

Removes key from the applied-keys table, fenced by token as described above: Left if token is older than the newest token seen for key.scope; Right(()) if the key is not there.

Removes key from the applied-keys table, fenced by token as described above: Left if token is older than the newest token seen for key.scope; Right(()) if the key is not there.

Attributes

Source
LongTermStore.scala
def forgetScope(scope: String): Unit

Forgets the newest fencing token seen for scope - a thread's (EffectKey.scopeOf) - once that thread is deleted (#3269): this store is not tied to a checkpointer, so nothing else removes it, and a store serving many short threads would otherwise keep one per thread for good. A later write of the scope is fenced afresh.

Forgets the newest fencing token seen for scope - a thread's (EffectKey.scopeOf) - once that thread is deleted (#3269): this store is not tied to a checkpointer, so nothing else removes it, and a store serving many short threads would otherwise keep one per thread for good. A later write of the scope is fenced afresh.

Attributes

Source
LongTermStore.scala

Attributes

Source
LongTermStore.scala
def list(ns: Namespace, prefix: String, limit: Int): Result[Listing[StoreEntry]]

The entries of ns whose key starts with prefix, in key order - LongTermStore.KeyOrder, by code point, which every store keeps (#3101) - at most limit.

The entries of ns whose key starts with prefix, in key order - LongTermStore.KeyOrder, by code point, which every store keeps (#3101) - at most limit.

Attributes

Source
LongTermStore.scala
def modify[A : ReadWriter](ns: Namespace, key: String, effect: EffectKey, token: FencingToken)(change: StoreView => Result[StoreChange[A]]): Result[A]

In one transaction, serialisable within ns, fenced by token (C4's AppliedKeys): a token older than the newest seen for effect.scope is refused with a Left and changes nothing; otherwise it becomes the newest, and then: if effect was applied, its recorded outcome and no write; otherwise change, decided against the namespace as it is now, which may refuse (Left: nothing written or recorded), then the namespace's and item's bounds, then the write and (effect, outcome) recorded together. An over-limit change is a BackendRefused. The newest token per scope is kept as long as the store keeps that thread's data: durably, in a real store.

In one transaction, serialisable within ns, fenced by token (C4's AppliedKeys): a token older than the newest seen for effect.scope is refused with a Left and changes nothing; otherwise it becomes the newest, and then: if effect was applied, its recorded outcome and no write; otherwise change, decided against the namespace as it is now, which may refuse (Left: nothing written or recorded), then the namespace's and item's bounds, then the write and (effect, outcome) recorded together. An over-limit change is a BackendRefused. The newest token per scope is kept as long as the store keeps that thread's data: durably, in a real store.

A change that throws is a Left, and changes nothing - its token is not made the newest either (#3101).

The outcome returned is the recorded one, decoded, so a first run and its replay return the same value. A's codec must be a pure function of its value: C4's guard encodes the outcome again for its journal, and a codec that answered differently would record two things.

Attributes

Source
LongTermStore.scala
def search(ns: Namespace, query: String, limit: Int): Result[Listing[StoreEntry]]

The entries of ns matching query, at most limit; each store documents how it matches.

The entries of ns matching query, at most limit; each store documents how it matches.

Attributes

Source
LongTermStore.scala

Inherited methods

final def delete(ns: Namespace, key: String, ctx: FileContext): Result[Boolean]

Deletes key, guarded under store.delete: true when it existed.

Deletes key, guarded under store.delete: true when it existed.

Attributes

Inherited from:
LongTermStore
Source
LongTermStore.scala
final def put(ns: Namespace, key: String, value: Value, ctx: FileContext): Result[Boolean]

Writes value at key, guarded under store.put: true when the key was new.

Writes value at key, guarded under store.put: true when the key was new.

Attributes

Inherited from:
LongTermStore
Source
LongTermStore.scala

Concrete fields

Attributes

Source
LongTermStore.scala

Inherited fields

C4's class for this target.

C4's class for this target.

Attributes

Inherited from:
LongTermStore
Source
LongTermStore.scala