public interface

HelixDataAccessor

org.apache.helix.HelixDataAccessor
Known Indirect Subclasses

Class Overview

Interface used to interact with Helix Data Types like IdealState, Config, LiveInstance, Message, ExternalView etc PropertyKey represent the HelixData type. See PropertyKey.Builder to get more information on building a propertyKey.

Summary

Public Methods
abstract <T extends HelixProperty> boolean[] createChildren(List<PropertyKey> keys, List<T> children)
Adds multiple children to a parent.
abstract <T extends HelixProperty> boolean createProperty(PropertyKey key, T value)
Create a helix property only if it does not exist.
abstract BaseDataAccessor<ZNRecord> getBaseDataAccessor()
Get underlying base data accessor
abstract List<String> getChildNames(PropertyKey key)
Return the child names for a property.
abstract <T extends HelixProperty> List<T> getChildValues(PropertyKey key)
Get the child values for a property.
abstract <T extends HelixProperty> Map<String, T> getChildValuesMap(PropertyKey key)
Same as getChildValues except that it converts list into a map using the id of the HelixProperty
abstract <T extends HelixProperty> T getProperty(PropertyKey key)
Return the property value, it must be refer to a single Helix Property.
abstract <T extends HelixProperty> List<T> getProperty(List<PropertyKey> keys)
Return a list of property values, each of which must be refer to a single Helix Property.
abstract PropertyKey.Builder keyBuilder()
Get key builder for the accessor
abstract boolean removeProperty(PropertyKey key)
Removes the property
abstract <T extends HelixProperty> boolean[] setChildren(List<PropertyKey> keys, List<T> children)
Sets multiple children under one parent
abstract <T extends HelixProperty> boolean setProperty(PropertyKey key, T value)
Set a property, overwrite if it exists and creates if not exists.
abstract <T extends HelixProperty> boolean[] updateChildren(List<String> paths, List<DataUpdater<ZNRecord>> updaters, int options)
Updates multiple children under one parent TODO: change to use property-keys instead of paths
abstract <T extends HelixProperty> boolean updateProperty(PropertyKey key, T value)
Updates a property using newvalue.merge(oldvalue)

Public Methods

public abstract boolean[] createChildren (List<PropertyKey> keys, List<T> children)

Adds multiple children to a parent.

Returns
  • array where true means the child was added and false means it was not

public abstract boolean createProperty (PropertyKey key, T value)

Create a helix property only if it does not exist.

Returns
  • true if creation was successful. False if already exists or if it failed to create

public abstract BaseDataAccessor<ZNRecord> getBaseDataAccessor ()

Get underlying base data accessor

Returns
  • a data accessor that can process ZNRecord objects

public abstract List<String> getChildNames (PropertyKey key)

Return the child names for a property. PropertyKey needs to refer to a collection like instances, resources. PropertyKey.isLeaf must be false

Returns
  • SubPropertyNames

public abstract List<T> getChildValues (PropertyKey key)

Get the child values for a property. PropertyKey needs to refer to just one level above the non leaf. PropertyKey.isCollection must be true.

Returns
  • subPropertyValues

public abstract Map<String, T> getChildValuesMap (PropertyKey key)

Same as getChildValues except that it converts list into a map using the id of the HelixProperty

Returns
  • a map of property identifiers to typed properties

public abstract T getProperty (PropertyKey key)

Return the property value, it must be refer to a single Helix Property. i.e PropertyKey.isLeaf() must return true.

Returns
  • value, Null if absent or on error

public abstract List<T> getProperty (List<PropertyKey> keys)

Return a list of property values, each of which must be refer to a single Helix Property. Property may be bucketized.

public abstract PropertyKey.Builder keyBuilder ()

Get key builder for the accessor

Returns
  • instantiated PropertyKey.Builder

public abstract boolean removeProperty (PropertyKey key)

Removes the property

Returns
  • true if removal was successful or node does not exist. false if the node existed and failed to remove it

public abstract boolean[] setChildren (List<PropertyKey> keys, List<T> children)

Sets multiple children under one parent

Returns
  • array where true means the child was set and false means it was not

public abstract boolean setProperty (PropertyKey key, T value)

Set a property, overwrite if it exists and creates if not exists. This api assumes the node exists and only tries to update it only if the call fail it will create the node. So there is a performance cost if always ends up creating the node.

Returns
  • true if the operation was successful

public abstract boolean[] updateChildren (List<String> paths, List<DataUpdater<ZNRecord>> updaters, int options)

Updates multiple children under one parent TODO: change to use property-keys instead of paths

Returns
  • array where true means the child was updated and false means it was not

public abstract boolean updateProperty (PropertyKey key, T value)

Updates a property using newvalue.merge(oldvalue)

Returns
  • true if the update was successful