RetentionPolicy

org.llm4s.agent.graph.RetentionPolicy
See theRetentionPolicy companion object
final case class RetentionPolicy

How much of a thread's history Checkpointer.prune keeps, by age or by size. Every limit is optional, and one that is not set removes nothing, so RetentionPolicy() keeps everything.

  • maxAge: a checkpoint, and an event, that the store committed more than maxAge ago is removed - by the store's clock, against the commit time the store recorded with it, never the checkpoint's createdAt or the event's timestamp: those are the producer's record, and a producer whose clock is skewed would make them too old or too young.
  • maxCheckpoints: only the newest maxCheckpoints checkpoints are kept.
  • maxEvents: only the newest maxEvents events are kept.

Whatever the limits, the thread's latest checkpoint and its pending writes are never removed, so pruning never changes what start, recover or resume does next. Pruning a checkpoint also removes the events recorded before the oldest checkpoint kept; maxAge and maxEvents may remove more events than that, including the latest checkpoint's. Removing events raises the thread's replay floor exactly as Checkpointer.compactEvents does (GraphError.ReplayUnavailable).

apply and the with* setters throw IllegalArgumentException for a non-positive maxAge or maxCheckpoints, or a negative maxEvents; RetentionPolicy.of returns a ValidationError.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def withMaxAge(age: FiniteDuration): RetentionPolicy
def withMaxAge(age: Option[FiniteDuration]): RetentionPolicy
def withMaxCheckpoints(n: Option[Int]): RetentionPolicy
def withMaxEvents(n: Option[Int]): RetentionPolicy

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product