public class

CurrentState

extends HelixProperty
java.lang.Object
   ↳ org.apache.helix.HelixProperty
     ↳ org.apache.helix.model.CurrentState

Class Overview

Current states of partitions in a resource for an instance.

Summary

Nested Classes
enum CurrentState.CurrentStateProperty Lookup keys for the current state  
[Expand]
Inherited Fields
From class org.apache.helix.HelixProperty
Public Constructors
CurrentState(String resourceName)
Instantiate a current state with a resource
CurrentState(ResourceId resourceId)
Instantiate a current state with a resource
CurrentState(ZNRecord record)
Instantiate a current state with a pre-populated ZNRecord
Public Methods
String getInfo(PartitionId partitionId)
Map<StringString> getPartitionStateMap()
Get the partitions on this instance and the state that each partition is currently in.
State getRequestedState(PartitionId partitionId)
ResourceId getResourceId()
Get the resource id
String getResourceName()
Get the name of the resource
String getSessionId()
Get the session that this current state corresponds to
State getState(PartitionId partitionId)
Get the state of a partition on this instance
String getState(String partitionName)
Get the state of a partition on this instance
StateModelDefId getStateModelDefId()
Get the state model that the resource follows
String getStateModelDefRef()
Get the state model that the resource follows
String getStateModelFactoryName()
Get the state model factory
Map<PartitionIdState> getTypedPartitionStateMap()
Get the partitions on this instance and the state that each partition is currently in
SessionId getTypedSessionId()
Get the session that this current state corresponds to
boolean isValid()
Get property validity
static Map<PartitionIdState> partitionStateMapFromStringMap(Map<StringString> rawMap)
Convert a string map to a concrete partition map
void setInfo(PartitionId partitionId, String info)
void setRequestedState(PartitionId partitionId, State state)
void setSessionId(SessionId sessionId)
Set the session that this current state corresponds to
void setSessionId(String sessionId)
Set the session that this current state corresponds to
void setState(PartitionId partitionId, State state)
Set the state that a partition is currently in on this instance
void setState(String partitionName, String state)
Set the state that a partition is currently in on this instance
void setStateModelDefId(StateModelDefId stateModelId)
Set the state model that the resource follows
void setStateModelDefRef(String stateModelName)
Set the state model that the resource follows
void setStateModelFactoryName(String factoryName)
Set the state model factory
static Map<StringString> stringMapFromPartitionStateMap(Map<PartitionIdState> partitionStateMap)
Convert a partition map to a string map
[Expand]
Inherited Methods
From class org.apache.helix.HelixProperty
From class java.lang.Object

Public Constructors

public CurrentState (String resourceName)

Instantiate a current state with a resource

Parameters
resourceName name identifying the resource

public CurrentState (ResourceId resourceId)

Instantiate a current state with a resource

Parameters
resourceId identifier for the resource

public CurrentState (ZNRecord record)

Instantiate a current state with a pre-populated ZNRecord

Parameters
record a ZNRecord corresponding to the current state

Public Methods

public String getInfo (PartitionId partitionId)

public Map<StringString> getPartitionStateMap ()

Get the partitions on this instance and the state that each partition is currently in.

Returns
  • (partition, state) pairs

public State getRequestedState (PartitionId partitionId)

public ResourceId getResourceId ()

Get the resource id

Returns
  • ResourceId

public String getResourceName ()

Get the name of the resource

Returns
  • String resource identifier

public String getSessionId ()

Get the session that this current state corresponds to

Returns
  • session identifier

public State getState (PartitionId partitionId)

Get the state of a partition on this instance

Parameters
partitionId partition id
Returns
  • State

public String getState (String partitionName)

Get the state of a partition on this instance

Parameters
partitionName the name of the partition
Returns
  • the state, or null if the partition is not present

public StateModelDefId getStateModelDefId ()

Get the state model that the resource follows

Returns
  • an identifier of the state model

public String getStateModelDefRef ()

Get the state model that the resource follows

Returns
  • an identifier of the state model

public String getStateModelFactoryName ()

Get the state model factory

Returns
  • a name that identifies the state model factory

public Map<PartitionIdState> getTypedPartitionStateMap ()

Get the partitions on this instance and the state that each partition is currently in

Returns
  • (partition id, state) pairs

public SessionId getTypedSessionId ()

Get the session that this current state corresponds to

Returns
  • session identifier

public boolean isValid ()

Get property validity

Returns
  • true if valid, false if invalid

public static Map<PartitionIdState> partitionStateMapFromStringMap (Map<StringString> rawMap)

Convert a string map to a concrete partition map

Parameters
rawMap map of partition name to state name
Returns
  • map of partition id to state

public void setInfo (PartitionId partitionId, String info)

public void setRequestedState (PartitionId partitionId, State state)

public void setSessionId (SessionId sessionId)

Set the session that this current state corresponds to

Parameters
sessionId session identifier

public void setSessionId (String sessionId)

Set the session that this current state corresponds to

Parameters
sessionId session identifier

public void setState (PartitionId partitionId, State state)

Set the state that a partition is currently in on this instance

Parameters
partitionId the id of the partition
state the state of the partition

public void setState (String partitionName, String state)

Set the state that a partition is currently in on this instance

Parameters
partitionName the name of the partition
state the state of the partition

public void setStateModelDefId (StateModelDefId stateModelId)

Set the state model that the resource follows

public void setStateModelDefRef (String stateModelName)

Set the state model that the resource follows

Parameters
stateModelName an identifier of the state model

public void setStateModelFactoryName (String factoryName)

Set the state model factory

Parameters
factoryName the name of the factory

public static Map<StringString> stringMapFromPartitionStateMap (Map<PartitionIdState> partitionStateMap)

Convert a partition map to a string map

Parameters
partitionStateMap map of partition id to state
Returns
  • map of partition name to state name