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(ZNRecord record)
Instantiate an external view with a pre-populated record
Public Methods
Set<String> getPartitionSet()
Get all the partitions of the resource
String getResourceName()
Get the resource represented by this view
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 setStateMap(String partitionName, Map<StringString> currentStateMap)
For a given partition, indicate where and in what state each of its replicas is in
[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 (ZNRecord record)

Instantiate an external view with a pre-populated record

Parameters
record ZNRecord corresponding to an external view

Public Methods

public Set<String> getPartitionSet ()

Get all the partitions of the resource

Returns
  • a set of partition names

public String getResourceName ()

Get the resource represented by this view

Returns
  • the name of the resource

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 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