public class

ClusterConstraints

extends HelixProperty
java.lang.Object
   ↳ org.apache.helix.HelixProperty
     ↳ org.apache.helix.model.ClusterConstraints

Class Overview

All of the constraints on a given cluster and its subcomponents, both physical and logical.

Summary

Nested Classes
enum ClusterConstraints.ConstraintAttribute Attributes on which constraints operate  
enum ClusterConstraints.ConstraintType What is being constrained  
enum ClusterConstraints.ConstraintValue Possible special values that constraint attributes can take  
[Expand]
Inherited Fields
From class org.apache.helix.HelixProperty
Public Constructors
ClusterConstraints(ClusterConstraints.ConstraintType type)
Instantiate constraints as a given type
ClusterConstraints(ZNRecord record)
Instantiate constraints from a pre-populated ZNRecord
Public Methods
void addConstraintItem(String constraintId, ConstraintItem item)
add the constraint, overwrite existing one if constraint with same constraint-id already exists
void addConstraintItem(ConstraintId constraintId, ConstraintItem item)
add the constraint, overwrite existing one if constraint with same constraint-id already exists
void addConstraintItems(Map<StringConstraintItem> items)
Add multiple constraint items.
ConstraintItem getConstraintItem(String constraintId)
get a constraint-item
ConstraintItem getConstraintItem(ConstraintId constraintId)
get a constraint-item
Map<ConstraintIdConstraintItem> getConstraintItems()
Get all constraint items in this collection of constraints
ClusterConstraints.ConstraintType getType()
Get the type of constraint this object represents
boolean isValid()
Get property validity
Set<ConstraintItem> match(Map<ClusterConstraints.ConstraintAttributeString> attributes)
return a set of constraints that match the attribute pairs
void removeConstraintItem(String constraintId)
remove a constraint-item
void removeConstraintItem(ConstraintId constraintId)
remove a constraint-item
static Map<ClusterConstraints.ConstraintAttributeString> toConstraintAttributes(Message msg)
convert a message to constraint attribute pairs
[Expand]
Inherited Methods
From class org.apache.helix.HelixProperty
From class java.lang.Object

Public Constructors

public ClusterConstraints (ClusterConstraints.ConstraintType type)

Instantiate constraints as a given type

Parameters
type ClusterConstraints.ConstraintType representing what this constrains

public ClusterConstraints (ZNRecord record)

Instantiate constraints from a pre-populated ZNRecord

Parameters
record ZNRecord containing all constraints

Public Methods

public void addConstraintItem (String constraintId, ConstraintItem item)

add the constraint, overwrite existing one if constraint with same constraint-id already exists

Parameters
constraintId unique constraint identifier
item the constraint as a ConstraintItem

public void addConstraintItem (ConstraintId constraintId, ConstraintItem item)

add the constraint, overwrite existing one if constraint with same constraint-id already exists

Parameters
constraintId unique constraint identifier
item the constraint as a ConstraintItem

public void addConstraintItems (Map<StringConstraintItem> items)

Add multiple constraint items.

Parameters
items (constraint identifier, ConstrantItem) pairs

public ConstraintItem getConstraintItem (String constraintId)

get a constraint-item

Parameters
constraintId unique constraint identifier
Returns

public ConstraintItem getConstraintItem (ConstraintId constraintId)

get a constraint-item

Parameters
constraintId unique constraint identifier
Returns

public Map<ConstraintIdConstraintItem> getConstraintItems ()

Get all constraint items in this collection of constraints

Returns
  • map of constraint id to constraint item

public ClusterConstraints.ConstraintType getType ()

Get the type of constraint this object represents

Returns
  • constraint type

public boolean isValid ()

Get property validity

Returns
  • true if valid, false if invalid

public Set<ConstraintItem> match (Map<ClusterConstraints.ConstraintAttributeString> attributes)

return a set of constraints that match the attribute pairs

Parameters
attributes (constraint scope, constraint string) pairs
Returns

public void removeConstraintItem (String constraintId)

remove a constraint-item

Parameters
constraintId unique constraint identifier

public void removeConstraintItem (ConstraintId constraintId)

remove a constraint-item

Parameters
constraintId unique constraint identifier

public static Map<ClusterConstraints.ConstraintAttributeString> toConstraintAttributes (Message msg)

convert a message to constraint attribute pairs

Parameters
msg a Message containing constraint attributes
Returns
  • constraint attribute scope-value pairs