public class

AutoFallbackPropertyStore

extends ZkHelixPropertyStore<T>
java.lang.Object
   ↳ org.apache.helix.manager.zk.ZkCacheBaseDataAccessor<T>
     ↳ org.apache.helix.store.zk.ZkHelixPropertyStore<T>
       ↳ org.apache.helix.store.zk.AutoFallbackPropertyStore<T>

Class Overview

Property store that does auto fallback to an old location. Assuming no concurrent updates

Summary

[Expand]
Inherited Fields
From class org.apache.helix.manager.zk.ZkCacheBaseDataAccessor
Public Constructors
AutoFallbackPropertyStore(ZkBaseDataAccessor<T> accessor, String root, String fallbackRoot)
Public Methods
boolean[] exists(List<String> paths, int options)
checks if the all the paths exists
boolean exists(String path, int options)
checks if the path exists in zk
List<T> get(List<String> paths, List<Stat> stats, int options)
Get List of T corresponding to the paths using async api
T get(String path, Stat stat, int options)
Get the T corresponding to the path
List<String> getChildNames(String parentPath, int options)
Returns the child names given a parent path
Stat getStat(String path, int options)
Get the stats of a single path
Stat[] getStats(List<String> paths, int options)
Get the stats of all the paths
boolean[] remove(List<String> paths, int options)
remove multiple paths using async api.
boolean remove(String path, int options)
This will remove the ZNode and all its descendants if any
void reset()
TODO refactor this.
void start()
Perform resource allocation when property store starts Resource allocation includes: - start an internal thread for fire callbacks
void stop()
Perform clean up when property store stops Cleanup includes: - stop the internal thread for fire callbacks
boolean update(String path, DataUpdater<T> updater, int options)
This will attempt to update the data using the updater.
boolean[] updateChildren(List<String> paths, List<DataUpdater<T>> updaters, int options)
Can update multiple nodes using async api for better performance.
[Expand]
Inherited Methods
From class org.apache.helix.manager.zk.ZkCacheBaseDataAccessor
From class java.lang.Object
From interface org.apache.helix.BaseDataAccessor
From interface org.apache.helix.store.HelixPropertyStore

Public Constructors

public AutoFallbackPropertyStore (ZkBaseDataAccessor<T> accessor, String root, String fallbackRoot)

Public Methods

public boolean[] exists (List<String> paths, int options)

checks if the all the paths exists

Parameters
paths paths to the ZNodes to test
options Set the type of ZNode see the valid values in AccessOption
Returns
  • for each path, true if a valid ZNode exists, false otherwise

public boolean exists (String path, int options)

checks if the path exists in zk

Parameters
path path to the ZNode to test
options Set the type of ZNode see the valid values in AccessOption
Returns
  • true if the ZNode exists, false otherwise

public List<T> get (List<String> paths, List<Stat> stats, int options)

Get List of T corresponding to the paths using async api

Parameters
paths paths to the ZNodes
stats retrieve a list of stats for the ZNodes
options Set the type of ZNode see the valid values in AccessOption
Returns
  • List of record data stored at each ZNode

public T get (String path, Stat stat, int options)

Get the T corresponding to the path

Parameters
path path to the ZNode
stat retrieve the stat of the ZNode
options Set the type of ZNode see the valid values in AccessOption
Returns
  • the record data stored at the ZNode

public List<String> getChildNames (String parentPath, int options)

Returns the child names given a parent path

Parameters
parentPath path to the immediate parent ZNode
options Set the type of ZNode see the valid values in AccessOption
Returns
  • a list of the names of all of the parent ZNode's children

public Stat getStat (String path, int options)

Get the stats of a single path

Parameters
path path of the ZNode to query
options Set the type of ZNode see the valid values in AccessOption
Returns
  • Zookeeper Stat object corresponding to the ZNode

public Stat[] getStats (List<String> paths, int options)

Get the stats of all the paths

Parameters
paths paths of the ZNodes to query
options Set the type of ZNode see the valid values in AccessOption
Returns
  • Zookeeper Stat object for each path

public boolean[] remove (List<String> paths, int options)

remove multiple paths using async api. will remove any child nodes if any

Parameters
paths paths to the ZNodes to remove
options Set the type of ZNode see the valid values in AccessOption
Returns
  • For each ZNode, true if successfully removed, false otherwise

public boolean remove (String path, int options)

This will remove the ZNode and all its descendants if any

Parameters
path path to the root ZNode to remove
options Set the type of ZNode see the valid values in AccessOption
Returns
  • true if the removal succeeded, false otherwise

public void reset ()

TODO refactor this. reset() should not be in data accessor reset the cache if any, when session expiry happens

public void start ()

Perform resource allocation when property store starts Resource allocation includes: - start an internal thread for fire callbacks

public void stop ()

Perform clean up when property store stops Cleanup includes: - stop the internal thread for fire callbacks

public boolean update (String path, DataUpdater<T> updater, int options)

This will attempt to update the data using the updater. If the ZNode does not exist it will create it and all its parent ZNodes. Updater will be invoked with null value if node does not exist.

Parameters
path path to the ZNode to update
updater an update routine for the data to merge in
options Set the type of ZNode see the valid values in AccessOption
Returns
  • true if data update succeeded, false otherwise

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

Can update multiple nodes using async api for better performance. If a child does not exist it will create it.

Parameters
updaters List of update routines for records to update
options Set the type of ZNode see the valid values in AccessOption
Returns
  • For each child, true if the data is updated successfully, false otherwise