public class

ResourceAccessor

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

Summary

Public Constructors
ResourceAccessor(HelixDataAccessor accessor)
Public Methods
boolean dropExternalView(ResourceId resourceId)
drop external view of a resource
boolean dropUserConfig(ResourceId resourceId)
Clear any user-specified configuration from the resource
boolean generateDefaultAssignment(ResourceId resourceId, int replicaCount, String participantGroupTag)
Generate a default assignment for partitioned resources
ResourceConfiguration getConfiguration(ResourceId resourceId)
Get a resource configuration, which may include user-defined configuration, as well as rebalancer configuration
ResourceAssignment getResourceAssignment(ResourceId resourceId)
get resource assignment
ExternalView readExternalView(ResourceId resourceId)
get the external view of a resource
RebalancerConfig readRebalancerConfig(ResourceId resourceId)
Read the rebalancer config of the resource
Resource readResource(ResourceId resourceId)
Read a single snapshot of a resource
UserConfig readUserConfig(ResourceId resourceId)
Read the user config of the resource
boolean resetResources(Set<ResourceId> resetResourceIdSet)
reset resources for all participants
boolean setExternalView(ResourceId resourceId, ExternalView extView)
set external view of a resource
boolean setRebalancerContext(ResourceId resourceId, RebalancerContext context)
Set the context of the rebalancer.
boolean setResource(ResourceConfig resourceConfig)
Persist an existing resource's logical configuration
boolean setResourceAssignment(ResourceId resourceId, ResourceAssignment resourceAssignment)
save resource assignment
boolean setUserConfig(ResourceId resourceId, UserConfig userConfig)
Set the user config of the resource, overwriting existing user configs
ResourceConfig updateResource(ResourceId resourceId, ResourceConfig.Delta resourceDelta)
Update a resource configuration
boolean updateUserConfig(ResourceId resourceId, UserConfig userConfig)
Add user configuration to the existing resource user configuration.
Protected Methods
ParticipantAccessor participantAccessor()
Get a ParticipantAccessor instance
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ResourceAccessor (HelixDataAccessor accessor)

Public Methods

public boolean dropExternalView (ResourceId resourceId)

drop external view of a resource

Returns
  • true if dropped, false otherwise

public boolean dropUserConfig (ResourceId resourceId)

Clear any user-specified configuration from the resource

Parameters
resourceId the resource to update
Returns
  • true if the config was cleared, false otherwise

public boolean generateDefaultAssignment (ResourceId resourceId, int replicaCount, String participantGroupTag)

Generate a default assignment for partitioned resources

Parameters
resourceId the resource to update
replicaCount the new replica count (or -1 to use the existing one)
participantGroupTag the new participant group tag (or null to use the existing one)
Returns
  • true if assignment successful, false otherwise

public ResourceConfiguration getConfiguration (ResourceId resourceId)

Get a resource configuration, which may include user-defined configuration, as well as rebalancer configuration

Returns
  • configuration or null

public ResourceAssignment getResourceAssignment (ResourceId resourceId)

get resource assignment

Returns
  • resource assignment or null

public ExternalView readExternalView (ResourceId resourceId)

get the external view of a resource

Parameters
resourceId the resource to look up
Returns
  • external view or null

public RebalancerConfig readRebalancerConfig (ResourceId resourceId)

Read the rebalancer config of the resource

Parameters
resourceId the resource to to look up
Returns
  • RebalancerConfig, or null

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 UserConfig readUserConfig (ResourceId resourceId)

Read the user config of the resource

Parameters
resourceId the resource to to look up
Returns
  • UserConfig, or null

public boolean resetResources (Set<ResourceId> resetResourceIdSet)

reset resources for all participants

Parameters
resetResourceIdSet the resources to reset
Returns
  • true if they were reset, false otherwise

public boolean setExternalView (ResourceId resourceId, ExternalView extView)

set external view of a resource

Returns
  • true if set, false otherwise

public boolean setRebalancerContext (ResourceId resourceId, RebalancerContext context)

Set the context of the rebalancer. This includes all properties required for rebalancing this resource

Parameters
resourceId the resource to update
context the new rebalancer context
Returns
  • true if the context was set, false otherwise

public boolean setResource (ResourceConfig resourceConfig)

Persist an existing resource's logical configuration

Parameters
resourceConfig logical resource configuration
Returns
  • true if resource is set, false otherwise

public boolean setResourceAssignment (ResourceId resourceId, ResourceAssignment resourceAssignment)

save resource assignment

Returns
  • true if set, false otherwise

public boolean setUserConfig (ResourceId resourceId, UserConfig userConfig)

Set the user config of the resource, overwriting existing user configs

Parameters
resourceId the resource to update
userConfig the new user config
Returns
  • true if the user config was set, false otherwise

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

public boolean updateUserConfig (ResourceId resourceId, UserConfig userConfig)

Add user configuration to the existing resource user configuration. Overwrites properties with the same key

Parameters
resourceId the resource to update
userConfig the user config key-value pairs to add
Returns
  • true if the user config was updated, false otherwise

Protected Methods

protected ParticipantAccessor participantAccessor ()

Get a ParticipantAccessor instance

Returns
  • ParticipantAccessor