Package uk.co.ractf.polaris.state
Class ConsulState
- java.lang.Object
-
- uk.co.ractf.polaris.state.ConsulState
-
- All Implemented Interfaces:
ClusterState
public class ConsulState extends java.lang.Object implements ClusterState
-
-
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 voiddeleteAPIToken(java.lang.String id)voiddeleteCredential(uk.co.ractf.polaris.api.namespace.NamespacedId id)voiddeleteInstance(uk.co.ractf.polaris.api.instance.Instance instance)Unregisters anInstancefrom a givenTask, probably because its been descheduledvoiddeleteNamespace(java.lang.String id)voiddeleteNotificationReceiver(uk.co.ractf.polaris.api.namespace.NamespacedId id)voiddeleteTask(uk.co.ractf.polaris.api.namespace.NamespacedId id)uk.co.ractf.polaris.api.authentication.APITokengetAPIToken(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.ContainerRegistryCredentialsgetCredential(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.InstancegetInstance(java.lang.String id)Gets anInstanceby idjava.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 ofInstances on a given node.uk.co.ractf.polaris.api.namespace.NamespacegetNamespace(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.NodeInfogetNode(java.lang.String id)Gets aNodeInfoby id@NotNull java.util.Map<java.lang.String,uk.co.ractf.polaris.api.node.NodeInfo>getNodes()Gets aMapof host id toNodeuk.co.ractf.polaris.api.notification.NotificationReceivergetNotificationReceiver(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.TaskgetTask(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)booleaninstanceExists(java.lang.String id)booleanlockTask(uk.co.ractf.polaris.api.task.Task task)voidsetAPIToken(uk.co.ractf.polaris.api.authentication.APIToken apiToken)voidsetCredential(uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials credential)voidsetInstance(uk.co.ractf.polaris.api.instance.Instance instance)Sets the state of an instancevoidsetNamespace(uk.co.ractf.polaris.api.namespace.Namespace namespace)voidsetNodeInfo(uk.co.ractf.polaris.api.node.NodeInfo nodeInfo)Sets the info for a nodevoidsetNotificationReceiver(uk.co.ractf.polaris.api.notification.NotificationReceiver receiver)voidsetTask(uk.co.ractf.polaris.api.task.Task task)booleanunlockTask(uk.co.ractf.polaris.api.task.Task task)
-
-
-
Method Detail
-
getNodes
@NotNull public @NotNull java.util.Map<java.lang.String,uk.co.ractf.polaris.api.node.NodeInfo> getNodes()
Description copied from interface:ClusterStateGets aMapof host id toNode- Specified by:
getNodesin interfaceClusterState- Returns:
- map of hosts
-
getNode
@Nullable public @Nullable uk.co.ractf.polaris.api.node.NodeInfo getNode(java.lang.String id)
Description copied from interface:ClusterStateGets aNodeInfoby id- Specified by:
getNodein interfaceClusterState- Parameters:
id- host id- Returns:
- the host
-
setNodeInfo
public void setNodeInfo(uk.co.ractf.polaris.api.node.NodeInfo nodeInfo)
Description copied from interface:ClusterStateSets the info for a node- Specified by:
setNodeInfoin interfaceClusterState- Parameters:
nodeInfo- node info
-
getInstance
@Nullable public @Nullable uk.co.ractf.polaris.api.instance.Instance getInstance(java.lang.String id)
Description copied from interface:ClusterStateGets anInstanceby id- Specified by:
getInstancein interfaceClusterState- Parameters:
id- the instance id- Returns:
- the instance
-
deleteInstance
public void deleteInstance(uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:ClusterStateUnregisters anInstancefrom a givenTask, probably because its been descheduled- Specified by:
deleteInstancein interfaceClusterState- Parameters:
instance- the instance
-
setInstance
public void setInstance(uk.co.ractf.polaris.api.instance.Instance instance)
Description copied from interface:ClusterStateSets the state of an instance- Specified by:
setInstancein interfaceClusterState- Parameters:
instance- the instance details
-
instanceExists
public boolean instanceExists(java.lang.String id)
- Specified by:
instanceExistsin interfaceClusterState
-
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:ClusterStateGets a list ofInstances on a given node. Returns an empty collection if the node id is invalid.- Specified by:
getInstancesOnNodein interfaceClusterState- 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:
getInstancesOfTaskin interfaceClusterState
-
getInstanceIds
public java.util.List<java.lang.String> getInstanceIds()
- Specified by:
getInstanceIdsin interfaceClusterState
-
getInstances
public java.util.Map<java.lang.String,uk.co.ractf.polaris.api.instance.Instance> getInstances()
- Specified by:
getInstancesin interfaceClusterState
-
getInstanceCounts
public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,java.lang.Integer> getInstanceCounts()
- Specified by:
getInstanceCountsin interfaceClusterState
-
getTasks
public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,uk.co.ractf.polaris.api.task.Task> getTasks()
- Specified by:
getTasksin interfaceClusterState
-
getTaskIds
public java.util.List<uk.co.ractf.polaris.api.namespace.NamespacedId> getTaskIds()
- Specified by:
getTaskIdsin interfaceClusterState
-
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:
getTasksin interfaceClusterState
-
getTask
public uk.co.ractf.polaris.api.task.Task getTask(uk.co.ractf.polaris.api.namespace.NamespacedId id)
- Specified by:
getTaskin interfaceClusterState
-
setTask
public void setTask(uk.co.ractf.polaris.api.task.Task task)
- Specified by:
setTaskin interfaceClusterState
-
deleteTask
public void deleteTask(uk.co.ractf.polaris.api.namespace.NamespacedId id)
- Specified by:
deleteTaskin interfaceClusterState
-
lockTask
public boolean lockTask(uk.co.ractf.polaris.api.task.Task task)
- Specified by:
lockTaskin interfaceClusterState
-
unlockTask
public boolean unlockTask(uk.co.ractf.polaris.api.task.Task task)
- Specified by:
unlockTaskin interfaceClusterState
-
getNamespaces
public java.util.Map<java.lang.String,uk.co.ractf.polaris.api.namespace.Namespace> getNamespaces()
- Specified by:
getNamespacesin interfaceClusterState
-
getNamespace
public uk.co.ractf.polaris.api.namespace.Namespace getNamespace(java.lang.String id)
- Specified by:
getNamespacein interfaceClusterState
-
setNamespace
public void setNamespace(uk.co.ractf.polaris.api.namespace.Namespace namespace)
- Specified by:
setNamespacein interfaceClusterState
-
deleteNamespace
public void deleteNamespace(java.lang.String id)
- Specified by:
deleteNamespacein interfaceClusterState
-
getCredentials
public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials> getCredentials()
- Specified by:
getCredentialsin interfaceClusterState
-
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:
getCredentialsin interfaceClusterState
-
getCredential
public uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials getCredential(uk.co.ractf.polaris.api.namespace.NamespacedId id)
- Specified by:
getCredentialin interfaceClusterState
-
setCredential
public void setCredential(uk.co.ractf.polaris.api.registry.credentials.ContainerRegistryCredentials credential)
- Specified by:
setCredentialin interfaceClusterState
-
deleteCredential
public void deleteCredential(uk.co.ractf.polaris.api.namespace.NamespacedId id)
- Specified by:
deleteCredentialin interfaceClusterState
-
getAPITokens
public java.util.Map<java.lang.String,uk.co.ractf.polaris.api.authentication.APIToken> getAPITokens()
- Specified by:
getAPITokensin interfaceClusterState
-
getAPIToken
public uk.co.ractf.polaris.api.authentication.APIToken getAPIToken(java.lang.String id)
- Specified by:
getAPITokenin interfaceClusterState
-
setAPIToken
public void setAPIToken(uk.co.ractf.polaris.api.authentication.APIToken apiToken)
- Specified by:
setAPITokenin interfaceClusterState
-
deleteAPIToken
public void deleteAPIToken(java.lang.String id)
- Specified by:
deleteAPITokenin interfaceClusterState
-
setNotificationReceiver
public void setNotificationReceiver(uk.co.ractf.polaris.api.notification.NotificationReceiver receiver)
- Specified by:
setNotificationReceiverin interfaceClusterState
-
deleteNotificationReceiver
public void deleteNotificationReceiver(uk.co.ractf.polaris.api.namespace.NamespacedId id)
- Specified by:
deleteNotificationReceiverin interfaceClusterState
-
getNotificationReceivers
public java.util.Map<uk.co.ractf.polaris.api.namespace.NamespacedId,uk.co.ractf.polaris.api.notification.NotificationReceiver> getNotificationReceivers()
- Specified by:
getNotificationReceiversin interfaceClusterState
-
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:
getNotificationReceiversin interfaceClusterState
-
getNotificationReceiver
public uk.co.ractf.polaris.api.notification.NotificationReceiver getNotificationReceiver(uk.co.ractf.polaris.api.namespace.NamespacedId id)
- Specified by:
getNotificationReceiverin interfaceClusterState
-
-