public class

ClusterAccessor

extends Object
java.lang.Object
   ↳ org.apache.helix.api.accessor.ClusterAccessor
Known Direct Subclasses

Summary

Public Constructors
ClusterAccessor(ClusterId clusterId, HelixDataAccessor accessor)
Instantiate a cluster accessor
ClusterAccessor(ClusterId clusterId, HelixDataAccessor accessor, ClusterDataCache cache)
Instantiate a cluster accessor
Public Methods
boolean addParticipant(ParticipantConfig participant)
add a participant to cluster
boolean addResource(ResourceConfig resource)
add a resource to cluster
boolean addStateModelDefinition(StateModelDefinition stateModelDef)
Add a state model definition.
boolean createCluster(ClusterConfig cluster)
create a new cluster, fail if it already exists
boolean dropCluster()
drop a cluster
boolean dropParticipant(ParticipantId participantId)
drop a participant from cluster
boolean dropResource(ResourceId resourceId)
drop a resource from cluster
boolean dropStateModelDefinition(StateModelDefId stateModelDefId)
Remove a state model definition if it exists
Cluster readCluster()
read entire cluster data
Controller readLeader()
Read the leader controller if it is live
Participant readParticipant(ParticipantId participantId)
read participant related data
Resource readResource(ResourceId resourceId)
Read a single snapshot of a resource
ClusterConfig updateCluster(ClusterConfig.Delta clusterDelta)
Update the cluster configuration
ParticipantConfig updateParticipant(ParticipantId participantId, ParticipantConfig.Delta participantDelta)
Update a participant configuration
ResourceConfig updateResource(ResourceId resourceId, ResourceConfig.Delta resourceDelta)
Update a resource configuration
Protected Methods
ClusterId clusterId()
Get the cluster ID this accessor is connected to
HelixDataAccessor dataAccessor()
Get the accessor for the properties stored for this cluster
boolean isClusterStructureValid()
check if cluster structure is valid
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ClusterAccessor (ClusterId clusterId, HelixDataAccessor accessor)

Instantiate a cluster accessor

Parameters
clusterId the cluster to access
accessor HelixDataAccessor for the physical store

public ClusterAccessor (ClusterId clusterId, HelixDataAccessor accessor, ClusterDataCache cache)

Instantiate a cluster accessor

Parameters
clusterId the cluster to access
accessor HelixDataAccessor for the physical store

Public Methods

public boolean addParticipant (ParticipantConfig participant)

add a participant to cluster

Returns
  • true if participant added, false otherwise

public boolean addResource (ResourceConfig resource)

add a resource to cluster

Returns
  • true if resource added, false if there was an error

public boolean addStateModelDefinition (StateModelDefinition stateModelDef)

Add a state model definition. Updates the existing state model definition if it already exists.

Parameters
stateModelDef fully initialized state model definition
Returns
  • true if the model is persisted, false otherwise

public boolean createCluster (ClusterConfig cluster)

create a new cluster, fail if it already exists

Returns
  • true if created, false if creation failed

public boolean dropCluster ()

drop a cluster

Returns
  • true if the cluster was dropped, false if there was an error

public boolean dropParticipant (ParticipantId participantId)

drop a participant from cluster

Returns
  • true if participant dropped, false if there was an error

public boolean dropResource (ResourceId resourceId)

drop a resource from cluster

Returns
  • true if removal succeeded, false otherwise

public boolean dropStateModelDefinition (StateModelDefId stateModelDefId)

Remove a state model definition if it exists

Parameters
stateModelDefId state model definition id
Returns
  • true if removed, false if it did not exist

public Cluster readCluster ()

read entire cluster data

Returns
  • cluster snapshot or null

public Controller readLeader ()

Read the leader controller if it is live

Returns
  • Controller snapshot, or null

public Participant readParticipant (ParticipantId participantId)

read participant related data

Returns
  • participant, or null if participant not available

public Resource readResource (ResourceId resourceId)

Read a single snapshot of a resource

Parameters
resourceId the resource id to read
Returns
  • Resource or null if not present

public ClusterConfig updateCluster (ClusterConfig.Delta clusterDelta)

Update the cluster configuration

Parameters
clusterDelta change to the cluster configuration
Returns
  • updated ClusterConfig, or null if there was an error

public ParticipantConfig updateParticipant (ParticipantId participantId, ParticipantConfig.Delta participantDelta)

Update a participant configuration

Parameters
participantId the participant to update
participantDelta changes to the participant
Returns
  • ParticipantConfig, or null if participant is not persisted

public ResourceConfig updateResource (ResourceId resourceId, ResourceConfig.Delta resourceDelta)

Update a resource configuration

Parameters
resourceId the resource id to update
resourceDelta changes to the resource
Returns
  • ResourceConfig, or null if the resource is not persisted

Protected Methods

protected ClusterId clusterId ()

Get the cluster ID this accessor is connected to

Returns
  • ClusterId

protected HelixDataAccessor dataAccessor ()

Get the accessor for the properties stored for this cluster

Returns
  • HelixDataAccessor

protected boolean isClusterStructureValid ()

check if cluster structure is valid

Returns
  • true if valid or false otherwise