java.lang.Object
com.agentforge4j.runtime.InMemoryGeneratedArtifactStore
- All Implemented Interfaces:
GeneratedArtifactStore
Default
GeneratedArtifactStore retaining emitted bytes in memory, keyed by run. Enforces run isolation,
last-write-wins upsert, and configured per-run bounds; clear(String) releases a run's entries at terminal
state.
Bounds fail closed: a write that would exceed maxArtifactsPerRun or whose content
exceeds maxContentLength is rejected rather than retained, so a misbehaving run cannot grow the store without
limit.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault maximum number of artifacts retained per run.static final intDefault maximum content length (characters) retained per artifact. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a store with the default bounds.InMemoryGeneratedArtifactStore(int maxArtifactsPerRun, int maxContentLength) Creates a store with explicit bounds. -
Method Summary
Modifier and TypeMethodDescriptionReturns the artifacts registered forrunId, in registration order.voidReleases all artifacts held forrunId.Returns the emitted content forpathwithinrunId, if present.voidRegisters the emitted bytes of a file produced by a step for the given run.voidRemoves the artifact atpathforrunId, if present.
-
Field Details
-
DEFAULT_MAX_ARTIFACTS_PER_RUN
public static final int DEFAULT_MAX_ARTIFACTS_PER_RUNDefault maximum number of artifacts retained per run.- See Also:
-
DEFAULT_MAX_CONTENT_LENGTH
public static final int DEFAULT_MAX_CONTENT_LENGTHDefault maximum content length (characters) retained per artifact.- See Also:
-
-
Constructor Details
-
InMemoryGeneratedArtifactStore
public InMemoryGeneratedArtifactStore()Creates a store with the default bounds. -
InMemoryGeneratedArtifactStore
public InMemoryGeneratedArtifactStore(int maxArtifactsPerRun, int maxContentLength) Creates a store with explicit bounds.- Parameters:
maxArtifactsPerRun- maximum artifacts retained per run; must be greater than zeromaxContentLength- maximum content length (characters) per artifact; must be greater than zero
-
-
Method Details
-
register
Registers the emitted bytes of a file produced by a step for the given run.- Specified by:
registerin interfaceGeneratedArtifactStore- Parameters:
runId- non-blank owning run idstepId- non-blank producing step idpath- non-blank requested artifact pathcontent- emitted content; must not benull
-
find
Returns the emitted content forpathwithinrunId, if present.- Specified by:
findin interfaceGeneratedArtifactStore- Parameters:
runId- non-blank run idpath- non-blank artifact path- Returns:
- the content, or empty when no artifact was registered at that path for the run
-
artifacts
Returns the artifacts registered forrunId, in registration order.- Specified by:
artifactsin interfaceGeneratedArtifactStore- Parameters:
runId- non-blank run id- Returns:
- an immutable snapshot (empty when the run has no registered artifacts)
-
remove
Removes the artifact atpathforrunId, if present. Idempotent (a no-op when the run or path is absent).- Specified by:
removein interfaceGeneratedArtifactStore- Parameters:
runId- non-blank run idpath- non-blank artifact path to evict
-
clear
Releases all artifacts held forrunId. Idempotent.- Specified by:
clearin interfaceGeneratedArtifactStore- Parameters:
runId- non-blank run id
-