Module agentforge4j.config.loader
Class InMemoryAgentRepository
java.lang.Object
com.agentforge4j.config.loader.repository.InMemoryAgentRepository
- All Implemented Interfaces:
AgentRepository
Thread-safe in-memory
AgentRepository whose global snapshot can be replaced atomically.-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryAgentRepository(Map<String, AgentDefinition> globalAgents) Creates a repository from an initial global agent snapshot. -
Method Summary
Modifier and TypeMethodDescriptionfindAll()Returns all agents from the current global snapshot.Returns an agent by id from the current global snapshot.voidreplaceGlobalAgents(Map<String, AgentDefinition> globalAgents) Replaces the global agent snapshot used by this repository.
-
Constructor Details
-
InMemoryAgentRepository
Creates a repository from an initial global agent snapshot.- Parameters:
globalAgents- initial agents keyed by id
-
-
Method Details
-
get
Returns an agent by id from the current global snapshot.- Specified by:
getin interfaceAgentRepository- Parameters:
id- agent id- Returns:
- matching agent definition
- Throws:
AgentNotFoundException- when no agent exists for the id
-
findAll
Returns all agents from the current global snapshot.- Specified by:
findAllin interfaceAgentRepository- Returns:
- immutable map of all agents keyed by id
-
replaceGlobalAgents
Replaces the global agent snapshot used by this repository.- Parameters:
globalAgents- replacement agents keyed by id
-