Island: Add IAgentRepository.get_agents()

This commit is contained in:
Mike Salvatore 2022-09-30 08:25:18 -04:00
parent 61bda27d7f
commit 84f21b0c1d
2 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,15 @@ class IAgentRepository(ABC):
:raises StorageError: If an error occurs while attempting to store the `Agent`
"""
@abstractmethod
def get_agents(self) -> Sequence[Agent]:
"""
Get all `Agents` stored in the repository
:return: All agents in the repository
:raises RetrievalError: If an error occurs while attempting to retrieve the `Agents`
"""
@abstractmethod
def get_agent_by_id(self, agent_id: AgentID) -> Agent:
"""

View File

@ -38,6 +38,9 @@ class MongoAgentRepository(IAgentRepository):
f"but no agents were inserted"
)
def get_agents(self) -> Sequence[Agent]:
return []
def get_agent_by_id(self, agent_id: AgentID) -> Agent:
try:
agent_dict = self._agents_collection.find_one(