Class ConsulState

    • Constructor Summary

      Constructors 
      Constructor Description
      ConsulState​(com.orbitz.consul.Consul consul, com.codahale.metrics.MetricRegistry metricRegistry)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deleteAPIToken​(java.lang.String id)  
      void deleteCredential​(uk.co.ractf.polaris.api.namespace.NamespacedId id)  
      void deleteInstance​(uk.co.ractf.polaris.api.instance.Instance instance)
      Unregisters an Instance from a given Task, probably because its been descheduled
      void deleteNamespace​(java.lang.String id)  
      void deleteNotificationReceiver​(uk.co.ractf.polaris.api.namespace.NamespacedId id)  
      void deleteTask​(uk.co.ractf.polaris.api.namespace.NamespacedId id)  
      uk.co.ractf.polaris.api.authentication.APIToken getAPIToken​(java.lang.String id)  
      java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.authentication.APIToken> getAPITokens()  
      uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials getCredential​(uk.co.ractf.polaris.api.namespace.NamespacedId id)  
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials> getCredentials()  
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials> getCredentials​(java.lang.String namespace)  
      @Nullable uk.co.ractf.polaris.api.instance.Instance getInstance​(java.lang.String id)
      Gets an Instance by id
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​java.lang.Integer> getInstanceCounts()  
      java.util.List<java.lang.String> getInstanceIds()  
      java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.instance.Instance> getInstances()  
      java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.instance.Instance> getInstancesOfTask​(uk.co.ractf.polaris.api.namespace.NamespacedId namespacedId)  
      @NotNull java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.instance.Instance> getInstancesOnNode​(java.lang.String node)
      Gets a list of Instances on a given node.
      uk.co.ractf.polaris.api.namespace.Namespace getNamespace​(java.lang.String id)  
      java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.namespace.Namespace> getNamespaces()  
      @Nullable uk.co.ractf.polaris.api.node.NodeInfo getNode​(java.lang.String id)
      Gets a NodeInfo by id
      @NotNull java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.node.NodeInfo> getNodes()
      Gets a Map of host id to Node
      uk.co.ractf.polaris.api.notification.NotificationReceiver getNotificationReceiver​(uk.co.ractf.polaris.api.namespace.NamespacedId id)  
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.notification.NotificationReceiver> getNotificationReceivers()  
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.notification.NotificationReceiver> getNotificationReceivers​(java.lang.String namespace)  
      uk.co.ractf.polaris.api.task.Task getTask​(uk.co.ractf.polaris.api.namespace.NamespacedId id)  
      java.util.List<uk.co.ractf.polaris.api.namespace.NamespacedId> getTaskIds()  
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.task.Task> getTasks()  
      java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.task.Task> getTasks​(java.lang.String namespace)  
      boolean instanceExists​(java.lang.String id)  
      boolean lockTask​(uk.co.ractf.polaris.api.task.Task task)  
      void setAPIToken​(uk.co.ractf.polaris.api.authentication.APIToken apiToken)  
      void setCredential​(uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials credential)  
      void setInstance​(uk.co.ractf.polaris.api.instance.Instance instance)
      Sets the state of an instance
      void setNamespace​(uk.co.ractf.polaris.api.namespace.Namespace namespace)  
      void setNodeInfo​(uk.co.ractf.polaris.api.node.NodeInfo nodeInfo)
      Sets the info for a node
      void setNotificationReceiver​(uk.co.ractf.polaris.api.notification.NotificationReceiver receiver)  
      void setTask​(uk.co.ractf.polaris.api.task.Task task)  
      boolean unlockTask​(uk.co.ractf.polaris.api.task.Task task)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConsulState

        @Inject
        public ConsulState​(com.orbitz.consul.Consul consul,
                           com.codahale.metrics.MetricRegistry metricRegistry)
    • Method Detail

      • getNodes

        @NotNull
        public @NotNull java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.node.NodeInfo> getNodes()
        Description copied from interface: ClusterState
        Gets a Map of host id to Node
        Specified by:
        getNodes in interface ClusterState
        Returns:
        map of hosts
      • getNode

        @Nullable
        public @Nullable uk.co.ractf.polaris.api.node.NodeInfo getNode​(java.lang.String id)
        Description copied from interface: ClusterState
        Gets a NodeInfo by id
        Specified by:
        getNode in interface ClusterState
        Parameters:
        id - host id
        Returns:
        the host
      • setNodeInfo

        public void setNodeInfo​(uk.co.ractf.polaris.api.node.NodeInfo nodeInfo)
        Description copied from interface: ClusterState
        Sets the info for a node
        Specified by:
        setNodeInfo in interface ClusterState
        Parameters:
        nodeInfo - node info
      • getInstance

        @Nullable
        public @Nullable uk.co.ractf.polaris.api.instance.Instance getInstance​(java.lang.String id)
        Description copied from interface: ClusterState
        Gets an Instance by id
        Specified by:
        getInstance in interface ClusterState
        Parameters:
        id - the instance id
        Returns:
        the instance
      • deleteInstance

        public void deleteInstance​(uk.co.ractf.polaris.api.instance.Instance instance)
        Description copied from interface: ClusterState
        Unregisters an Instance from a given Task, probably because its been descheduled
        Specified by:
        deleteInstance in interface ClusterState
        Parameters:
        instance - the instance
      • setInstance

        public void setInstance​(uk.co.ractf.polaris.api.instance.Instance instance)
        Description copied from interface: ClusterState
        Sets the state of an instance
        Specified by:
        setInstance in interface ClusterState
        Parameters:
        instance - the instance details
      • instanceExists

        public boolean instanceExists​(java.lang.String id)
        Specified by:
        instanceExists in interface ClusterState
      • getInstancesOnNode

        @NotNull
        public @NotNull java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.instance.Instance> getInstancesOnNode​(java.lang.String node)
        Description copied from interface: ClusterState
        Gets a list of Instances on a given node. Returns an empty collection if the node id is invalid.
        Specified by:
        getInstancesOnNode in interface ClusterState
        Parameters:
        node - node id
        Returns:
        instances on the node
      • getInstancesOfTask

        public java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.instance.Instance> getInstancesOfTask​(uk.co.ractf.polaris.api.namespace.NamespacedId namespacedId)
        Specified by:
        getInstancesOfTask in interface ClusterState
      • getInstanceIds

        public java.util.List<java.lang.String> getInstanceIds()
        Specified by:
        getInstanceIds in interface ClusterState
      • getInstances

        public java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.instance.Instance> getInstances()
        Specified by:
        getInstances in interface ClusterState
      • getInstanceCounts

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​java.lang.Integer> getInstanceCounts()
        Specified by:
        getInstanceCounts in interface ClusterState
      • getTasks

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.task.Task> getTasks()
        Specified by:
        getTasks in interface ClusterState
      • getTaskIds

        public java.util.List<uk.co.ractf.polaris.api.namespace.NamespacedId> getTaskIds()
        Specified by:
        getTaskIds in interface ClusterState
      • getTasks

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.task.Task> getTasks​(java.lang.String namespace)
        Specified by:
        getTasks in interface ClusterState
      • getTask

        public uk.co.ractf.polaris.api.task.Task getTask​(uk.co.ractf.polaris.api.namespace.NamespacedId id)
        Specified by:
        getTask in interface ClusterState
      • setTask

        public void setTask​(uk.co.ractf.polaris.api.task.Task task)
        Specified by:
        setTask in interface ClusterState
      • deleteTask

        public void deleteTask​(uk.co.ractf.polaris.api.namespace.NamespacedId id)
        Specified by:
        deleteTask in interface ClusterState
      • lockTask

        public boolean lockTask​(uk.co.ractf.polaris.api.task.Task task)
        Specified by:
        lockTask in interface ClusterState
      • unlockTask

        public boolean unlockTask​(uk.co.ractf.polaris.api.task.Task task)
        Specified by:
        unlockTask in interface ClusterState
      • getNamespaces

        public java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.namespace.Namespace> getNamespaces()
        Specified by:
        getNamespaces in interface ClusterState
      • getNamespace

        public uk.co.ractf.polaris.api.namespace.Namespace getNamespace​(java.lang.String id)
        Specified by:
        getNamespace in interface ClusterState
      • setNamespace

        public void setNamespace​(uk.co.ractf.polaris.api.namespace.Namespace namespace)
        Specified by:
        setNamespace in interface ClusterState
      • getCredentials

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials> getCredentials()
        Specified by:
        getCredentials in interface ClusterState
      • getCredentials

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials> getCredentials​(java.lang.String namespace)
        Specified by:
        getCredentials in interface ClusterState
      • getCredential

        public uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials getCredential​(uk.co.ractf.polaris.api.namespace.NamespacedId id)
        Specified by:
        getCredential in interface ClusterState
      • setCredential

        public void setCredential​(uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials credential)
        Specified by:
        setCredential in interface ClusterState
      • deleteCredential

        public void deleteCredential​(uk.co.ractf.polaris.api.namespace.NamespacedId id)
        Specified by:
        deleteCredential in interface ClusterState
      • getAPITokens

        public java.util.Map<java.lang.String,​uk.co.ractf.polaris.api.authentication.APIToken> getAPITokens()
        Specified by:
        getAPITokens in interface ClusterState
      • getAPIToken

        public uk.co.ractf.polaris.api.authentication.APIToken getAPIToken​(java.lang.String id)
        Specified by:
        getAPIToken in interface ClusterState
      • setAPIToken

        public void setAPIToken​(uk.co.ractf.polaris.api.authentication.APIToken apiToken)
        Specified by:
        setAPIToken in interface ClusterState
      • setNotificationReceiver

        public void setNotificationReceiver​(uk.co.ractf.polaris.api.notification.NotificationReceiver receiver)
        Specified by:
        setNotificationReceiver in interface ClusterState
      • deleteNotificationReceiver

        public void deleteNotificationReceiver​(uk.co.ractf.polaris.api.namespace.NamespacedId id)
        Specified by:
        deleteNotificationReceiver in interface ClusterState
      • getNotificationReceivers

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.notification.NotificationReceiver> getNotificationReceivers()
        Specified by:
        getNotificationReceivers in interface ClusterState
      • getNotificationReceivers

        public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,​uk.co.ractf.polaris.api.notification.NotificationReceiver> getNotificationReceivers​(java.lang.String namespace)
        Specified by:
        getNotificationReceivers in interface ClusterState
      • getNotificationReceiver

        public uk.co.ractf.polaris.api.notification.NotificationReceiver getNotificationReceiver​(uk.co.ractf.polaris.api.namespace.NamespacedId id)
        Specified by:
        getNotificationReceiver in interface ClusterState