public class

AtomicClusterAccessor

extends ClusterAccessor
java.lang.Object
   ↳ org.apache.helix.api.accessor.ClusterAccessor
     ↳ org.apache.helix.api.accessor.AtomicClusterAccessor

Class Overview

An atomic version of the ClusterAccessor. If atomic operations are required, use instances of this class. Atomicity is not guaranteed when using instances of ClusterAccessor alongside instances of this class. Furthermore, depending on the semantics of the lock, lock acquisition may fail, in which case users should handle the return value of each function if necessary.

Using this class is quite expensive; it should thus be used sparingly and only in systems where contention on these operations is expected. For most systems running Helix, this is typically not the case.

Summary

Public Constructors
AtomicClusterAccessor(ClusterId clusterId, HelixDataAccessor accessor, HelixLockable lockProvider)
Instantiate the accessor
Public Methods
boolean addParticipant(ParticipantConfig participant)
add a participant to cluster
boolean addResource(ResourceConfig resource)
add a resource to cluster
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
Cluster readCluster()
read entire cluster data
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
[Expand]
Inherited Methods
From class org.apache.helix.api.accessor.ClusterAccessor
From class java.lang.Object

Public Constructors

public AtomicClusterAccessor (ClusterId clusterId, HelixDataAccessor accessor, HelixLockable lockProvider)

Instantiate the accessor

Parameters
clusterId the cluster to access
accessor a HelixDataAccessor for the physical properties
lockProvider a lock provider

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 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 Cluster readCluster ()

read entire cluster data

Returns
  • cluster 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