public class

Resource

extends Object
java.lang.Object
   ↳ org.apache.helix.api.Resource

Class Overview

Represent a resource entity in helix cluster

Summary

Public Constructors
Resource(ResourceId id, ResourceConfig.ResourceType type, IdealState idealState, ResourceAssignment resourceAssignment, ExternalView externalView, RebalancerContext rebalancerContext, UserConfig userConfig, int bucketSize, boolean batchMessageMode)
Construct a resource
Public Methods
boolean getBatchMessageMode()
Get batch message mode
int getBucketSize()
Get bucket size
ResourceConfig getConfig()
Get the configuration of this resource
ExternalView getExternalView()
Get the external view of the resource
ResourceId getId()
Get the resource id
RebalancerConfig getRebalancerConfig()
Get the resource properties configuring rebalancing
ResourceAssignment getResourceAssignment()
Get the current resource assignment
SchedulerTaskConfig getSchedulerTaskConfig()
Get the properties configuring scheduler tasks
Partition getSubUnit(PartitionId subUnitId)
Get a subunit that the resource contains
Map<? extends PartitionId, ? extends Partition> getSubUnitMap()
Get the subunits of the resource
Set<? extends PartitionId> getSubUnitSet()
Get the set of subunit ids that the resource contains
UserConfig getUserConfig()
Get user-specified configuration properties of this resource
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Resource (ResourceId id, ResourceConfig.ResourceType type, IdealState idealState, ResourceAssignment resourceAssignment, ExternalView externalView, RebalancerContext rebalancerContext, UserConfig userConfig, int bucketSize, boolean batchMessageMode)

Construct a resource

Parameters
id resource id
type ResourceType type
idealState ideal state of the resource
resourceAssignment current resource assignment of the cluster
externalView external view of the resource
rebalancerContext contextual parameters that the rebalancer should be aware of
userConfig any resource user-defined configuration
bucketSize the bucket size to use for physically saved state
batchMessageMode true if batch messaging allowed, false otherwise

Public Methods

public boolean getBatchMessageMode ()

Get batch message mode

Returns
  • true if in batch message mode, false otherwise

public int getBucketSize ()

Get bucket size

Returns
  • bucket size

public ResourceConfig getConfig ()

Get the configuration of this resource

Returns
  • ResourceConfig that backs this Resource

public ExternalView getExternalView ()

Get the external view of the resource

Returns
  • the external view of the resource

public ResourceId getId ()

Get the resource id

Returns
  • ResourceId

public RebalancerConfig getRebalancerConfig ()

Get the resource properties configuring rebalancing

Returns
  • RebalancerConfig properties

public ResourceAssignment getResourceAssignment ()

Get the current resource assignment

Returns
  • ResourceAssignment, or null if no current assignment

public SchedulerTaskConfig getSchedulerTaskConfig ()

Get the properties configuring scheduler tasks

Returns
  • SchedulerTaskConfig properties

public Partition getSubUnit (PartitionId subUnitId)

Get a subunit that the resource contains

Parameters
subUnitId the subunit id to look up
Returns
  • Partition or null if none is present with the given id

public Map<? extends PartitionId, ? extends Partition> getSubUnitMap ()

Get the subunits of the resource

Returns
  • map of subunit id to partition or empty map if none

public Set<? extends PartitionId> getSubUnitSet ()

Get the set of subunit ids that the resource contains

Returns
  • subunit id set, or empty if none

public UserConfig getUserConfig ()

Get user-specified configuration properties of this resource

Returns
  • UserConfig properties