Package ai.wanaku.core.service.discovery
Class ValkeyRegistry
java.lang.Object
ai.wanaku.core.service.discovery.ValkeyRegistry
- All Implemented Interfaces:
ServiceRegistry
Host information is stored as keys in a hashmap in Valkey. Suppose, for instance, a service
named "ftp". It would contain keys such as:
wanaku-target-address -> ip:port
wanaku-target-type -> tool-invoker
And also the configurations for the service as a hashmap
config1 -> description1, config2 -> description2, etc.
This class is basically iterating over the hashmap
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidderegister(String service, ServiceType serviceType) Deregisters a service with the given name.getEntries(ServiceType serviceType) Retrieves a map of services with the given type.ai.wanaku.api.types.management.ServicegetService(String service) Retrieves a service with the given name.List<ai.wanaku.api.types.management.State> voidregister(ServiceTarget serviceTarget, Map<String, String> configurations) Registers a new service with the given configurations.voidvoid
-
Constructor Details
-
ValkeyRegistry
public ValkeyRegistry()
-
-
Method Details
-
register
Registers a new service with the given configurations.- Specified by:
registerin interfaceServiceRegistry- Parameters:
serviceTarget- The service target, including its address and type.configurations- A map of configuration key-value pairs for the service.
-
deregister
Deregisters a service with the given name.- Specified by:
deregisterin interfaceServiceRegistry- Parameters:
service- The name of the service to deregister.serviceType- the type of service to deregister
-
saveState
- Specified by:
saveStatein interfaceServiceRegistry
-
getState
- Specified by:
getStatein interfaceServiceRegistry
-
getService
Retrieves a service with the given name.- Specified by:
getServicein interfaceServiceRegistry- Parameters:
service- The name of the service to retrieve.- Returns:
- A Service object representing the retrieved service.
-
getEntries
Retrieves a map of services with the given type.- Specified by:
getEntriesin interfaceServiceRegistry- Parameters:
serviceType- The type of services to retrieve.- Returns:
- A map of Service objects representing the retrieved services.
-
update
- Specified by:
updatein interfaceServiceRegistry
-