Class ValkeyRegistry

java.lang.Object
ai.wanaku.core.service.discovery.ValkeyRegistry
All Implemented Interfaces:
ServiceRegistry

@ApplicationScoped public class ValkeyRegistry extends Object implements 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 Details

    • ValkeyRegistry

      public ValkeyRegistry()
  • Method Details

    • register

      public void register(ServiceTarget serviceTarget, Map<String,String> configurations)
      Registers a new service with the given configurations.
      Specified by:
      register in interface ServiceRegistry
      Parameters:
      serviceTarget - The service target, including its address and type.
      configurations - A map of configuration key-value pairs for the service.
    • deregister

      public void deregister(String service, ServiceType serviceType)
      Deregisters a service with the given name.
      Specified by:
      deregister in interface ServiceRegistry
      Parameters:
      service - The name of the service to deregister.
      serviceType - the type of service to deregister
    • saveState

      public void saveState(String service, boolean healthy, String message)
      Specified by:
      saveState in interface ServiceRegistry
    • getState

      public List<ai.wanaku.api.types.management.State> getState(String service, int count)
      Specified by:
      getState in interface ServiceRegistry
    • getService

      public ai.wanaku.api.types.management.Service getService(String service)
      Retrieves a service with the given name.
      Specified by:
      getService in interface ServiceRegistry
      Parameters:
      service - The name of the service to retrieve.
      Returns:
      A Service object representing the retrieved service.
    • getEntries

      public Map<String,ai.wanaku.api.types.management.Service> getEntries(ServiceType serviceType)
      Retrieves a map of services with the given type.
      Specified by:
      getEntries in interface ServiceRegistry
      Parameters:
      serviceType - The type of services to retrieve.
      Returns:
      A map of Service objects representing the retrieved services.
    • update

      public void update(String target, String option, String value)
      Specified by:
      update in interface ServiceRegistry