ExUtcp.Repository (ex_utcp v0.2.8)
View SourceIn-memory repository for storing providers and tools.
This module provides a simple in-memory storage solution for UTCP providers and tools. In a production environment, you might want to implement a persistent storage backend.
Summary
Functions
Adds a tool to the repository.
Clears all providers and tools from the repository.
Gets a provider by name.
Gets all providers.
Gets a tool by name.
Gets all tools.
Gets tools by provider name.
Checks if a provider exists.
Checks if a tool exists.
Creates a new in-memory tool repository.
Gets the count of providers in the repository.
Removes a provider and its tools.
Removes a specific tool.
Saves a provider with its associated tools.
Searches for tools matching a query.
Gets the count of tools in the repository.
Functions
@spec add_tool(ExUtcp.Types.tool_repository(), ExUtcp.Types.tool()) :: {:ok, ExUtcp.Types.tool_repository()} | {:error, String.t()}
Adds a tool to the repository.
@spec clear(ExUtcp.Types.tool_repository()) :: ExUtcp.Types.tool_repository()
Clears all providers and tools from the repository.
@spec get_provider(ExUtcp.Types.tool_repository(), String.t()) :: ExUtcp.Types.provider() | nil
Gets a provider by name.
@spec get_providers(ExUtcp.Types.tool_repository()) :: [ExUtcp.Types.provider()]
Gets all providers.
@spec get_tool(ExUtcp.Types.tool_repository(), String.t()) :: ExUtcp.Types.tool() | nil
Gets a tool by name.
@spec get_tools(ExUtcp.Types.tool_repository()) :: [ExUtcp.Types.tool()]
Gets all tools.
@spec get_tools_by_provider(ExUtcp.Types.tool_repository(), String.t()) :: [ ExUtcp.Types.tool() ]
Gets tools by provider name.
@spec has_provider?(ExUtcp.Types.tool_repository(), String.t()) :: boolean()
Checks if a provider exists.
@spec has_tool?(ExUtcp.Types.tool_repository(), String.t()) :: boolean()
Checks if a tool exists.
@spec new() :: ExUtcp.Types.tool_repository()
Creates a new in-memory tool repository.
@spec provider_count(ExUtcp.Types.tool_repository()) :: integer()
Gets the count of providers in the repository.
@spec remove_provider(ExUtcp.Types.tool_repository(), String.t()) :: ExUtcp.Types.tool_repository()
Removes a provider and its tools.
@spec remove_tool(ExUtcp.Types.tool_repository(), String.t()) :: ExUtcp.Types.tool_repository()
Removes a specific tool.
@spec save_provider_with_tools( ExUtcp.Types.tool_repository(), ExUtcp.Types.provider(), [ ExUtcp.Types.tool() ] ) :: ExUtcp.Types.tool_repository()
Saves a provider with its associated tools.
@spec search_tools(ExUtcp.Types.tool_repository(), String.t(), integer()) :: [ ExUtcp.Types.tool() ]
Searches for tools matching a query.
@spec tool_count(ExUtcp.Types.tool_repository()) :: integer()
Gets the count of tools in the repository.