public class

ExternalView

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

Class Overview

External view is an aggregation (across all instances) of current states for the partitions in a resource

Summary

[Expand]
Inherited Fields
From class org.apache.helix.HelixProperty
Public Constructors
ExternalView(String resource)
Instantiate an external view with the resource it corresponds to
ExternalView(ResourceId resource)
Instantiate an external view with the resource it corresponds to
ExternalView(ZNRecord record)
Instantiate an external view with a pre-populated record
Public Methods
Set<PartitionId> getPartitionIdSet()
Get all the partitions of the resource
Set<String> getPartitionSet()
Get all the partitions of the resource
ResourceId getResourceId()
Get the resource represented by this view
String getResourceName()
Get the resource represented by this view
Map<ParticipantIdState> getStateMap(PartitionId partitionId)
Get the participant and the state for each partition replica
Map<StringString> getStateMap(String partitionName)
Get the instance and the state for each partition replica
boolean isValid()
Get property validity
void setState(String partition, String instance, String state)
For a given replica, specify which partition it corresponds to, where it is served, and its current state
void setState(PartitionId partitionId, ParticipantId participantId, State state)
For a given replica, specify which partition it corresponds to, where it is served, and its current state
void setStateMap(String partitionName, Map<StringString> currentStateMap)
For a given partition, indicate where and in what state each of its replicas is in
void setStateMap(PartitionId partitionId, Map<ParticipantIdState> currentStateMap)
For a given partition, indicate where and in what state each of its replicas is in
static Map<ParticipantIdState> stateMapFromStringMap(Map<StringString> rawMap)
Convert a partition mapping as strings into a participant state map
[Expand]
Inherited Methods
From class org.apache.helix.HelixProperty
From class java.lang.Object

Public Constructors

public ExternalView (String resource)

Instantiate an external view with the resource it corresponds to

Parameters
resource the name of the resource

public ExternalView (ResourceId resource)

Instantiate an external view with the resource it corresponds to

Parameters
resource the id of the resource

public ExternalView (ZNRecord record)

Instantiate an external view with a pre-populated record

Parameters
record ZNRecord corresponding to an external view

Public Methods

public Set<PartitionId> getPartitionIdSet ()

Get all the partitions of the resource

Returns
  • a set of partition ids

public Set<String> getPartitionSet ()

Get all the partitions of the resource

Returns
  • a set of partition names

public ResourceId getResourceId ()

Get the resource represented by this view

Returns
  • resource id

public String getResourceName ()

Get the resource represented by this view

Returns
  • the name of the resource

public Map<ParticipantIdState> getStateMap (PartitionId partitionId)

Get the participant and the state for each partition replica

Parameters
partitionId the partition to look up
Returns
  • (participant, state) pairs

public Map<StringString> getStateMap (String partitionName)

Get the instance and the state for each partition replica

Parameters
partitionName the partition to look up
Returns
  • (instance, state) pairs

public boolean isValid ()

Get property validity

Returns
  • true if valid, false if invalid

public void setState (String partition, String instance, String state)

For a given replica, specify which partition it corresponds to, where it is served, and its current state

Parameters
partition the partition of the replica being served
instance the instance serving the replica
state the state the replica is in

public void setState (PartitionId partitionId, ParticipantId participantId, State state)

For a given replica, specify which partition it corresponds to, where it is served, and its current state

Parameters
partitionId the partition of the replica being served
participantId the instance serving the replica
state the state the replica is in

public void setStateMap (String partitionName, Map<StringString> currentStateMap)

For a given partition, indicate where and in what state each of its replicas is in

Parameters
partitionName the partition to set
currentStateMap (instance, state) pairs

public void setStateMap (PartitionId partitionId, Map<ParticipantIdState> currentStateMap)

For a given partition, indicate where and in what state each of its replicas is in

Parameters
partitionId the partition to set
currentStateMap (participant, state) pairs

public static Map<ParticipantIdState> stateMapFromStringMap (Map<StringString> rawMap)

Convert a partition mapping as strings into a participant state map

Parameters
rawMap the map of participant name to state
Returns
  • converted map