Class SafeHelixDataAccessor

java.lang.Object
com.linkedin.venice.helix.SafeHelixDataAccessor

public class SafeHelixDataAccessor extends Object
A wrapper around HelixDataAccessor which disables the unsafe functionality. Venice should never use a HelixDataAccessor directly. All uses of this class should always be wrapped in a SafeHelixDataAccessor. In order to ensure a compile-time guarantee that only safe APIs are called, we explicitly choose to remove the unsafe APIs from the interface. Therefore, we do not actually implement the HelixDataAccessor interface. These are the removed unsafe APIs: - HelixDataAccessor.getProperty(List, boolean) We don't want to allow calling this function, since it can be used unsafely if throwException=false. - HelixDataAccessor.getChildValues(PropertyKey, boolean) We don't want to allow calling this function, since it can be used unsafely if throwException=false. - HelixDataAccessor.getChildValuesMap(PropertyKey, boolean) We don't want to allow calling this function, since it can be used unsafely if throwException=false. - HelixDataAccessor.getBaseDataAccessor() If we want to allow the use of the BaseDataAccessor returned by this function, then we would likewise need to wrap it inside of a Safe API, because it provides unsafe calls such as BaseDataAccessor.get(List, List, int) and potentially others. TODO: Review the rest of the functions and determine if more should be culled.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SafeHelixDataAccessor(org.apache.helix.HelixDataAccessor helixDataAccessor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends org.apache.helix.HelixProperty>
    boolean[]
    createChildren(List<org.apache.helix.PropertyKey> keys, List<T> children)
     
    boolean
    createControllerLeader(org.apache.helix.model.LiveInstance leader)
     
    boolean
    createControllerMessage(org.apache.helix.model.Message message)
     
    boolean
    createMaintenance(org.apache.helix.model.MaintenanceSignal maintenanceSignal)
     
    boolean
    createPause(org.apache.helix.model.PauseSignal pauseSignal)
     
    boolean
    createStateModelDef(org.apache.helix.model.StateModelDefinition stateModelDef)
     
    getChildNames(org.apache.helix.PropertyKey key)
     
    <T extends org.apache.helix.HelixProperty>
    List<T>
    getChildValues(org.apache.helix.PropertyKey key)
    N.B.: The behavior of this function is different from that of HelixDataAccessor, which would swallow exceptions and return an empty collection.
    <T extends org.apache.helix.HelixProperty>
    Map<String,T>
    getChildValuesMap(org.apache.helix.PropertyKey key)
    N.B.: The behavior of this function is different from that of HelixDataAccessor, which would swallow exceptions and return an empty collection.
    <T extends org.apache.helix.HelixProperty>
    List<T>
    getProperty(List<org.apache.helix.PropertyKey> keys)
    N.B.: The behavior of this function is different from that of HelixDataAccessor, which would swallow exceptions and return an empty collection.
    <T extends org.apache.helix.HelixProperty>
    T
    getProperty(org.apache.helix.PropertyKey key)
     
    org.apache.helix.HelixProperty.Stat
    getPropertyStat(org.apache.helix.PropertyKey key)
     
    List<org.apache.helix.HelixProperty.Stat>
    getPropertyStats(List<org.apache.helix.PropertyKey> keys)
     
    org.apache.helix.PropertyKey.Builder
     
    boolean
    removeProperty(org.apache.helix.PropertyKey key)
     
    <T extends org.apache.helix.HelixProperty>
    boolean[]
    setChildren(List<org.apache.helix.PropertyKey> keys, List<T> children)
     
    <T extends org.apache.helix.HelixProperty>
    boolean
    setProperty(org.apache.helix.PropertyKey key, T value)
     
    <T extends org.apache.helix.HelixProperty>
    boolean[]
    updateChildren(List<String> paths, List<org.apache.helix.zookeeper.zkclient.DataUpdater<org.apache.helix.zookeeper.datamodel.ZNRecord>> updaters, int options)
     
    <T extends org.apache.helix.HelixProperty>
    boolean
    updateProperty(org.apache.helix.PropertyKey key, org.apache.helix.zookeeper.zkclient.DataUpdater<org.apache.helix.zookeeper.datamodel.ZNRecord> updater, T value)
     
    <T extends org.apache.helix.HelixProperty>
    boolean
    updateProperty(org.apache.helix.PropertyKey key, T value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SafeHelixDataAccessor

      public SafeHelixDataAccessor(org.apache.helix.HelixDataAccessor helixDataAccessor)
  • Method Details

    • createStateModelDef

      public boolean createStateModelDef(org.apache.helix.model.StateModelDefinition stateModelDef)
    • createControllerMessage

      public boolean createControllerMessage(org.apache.helix.model.Message message)
    • createControllerLeader

      public boolean createControllerLeader(org.apache.helix.model.LiveInstance leader)
    • createPause

      public boolean createPause(org.apache.helix.model.PauseSignal pauseSignal)
    • createMaintenance

      public boolean createMaintenance(org.apache.helix.model.MaintenanceSignal maintenanceSignal)
    • setProperty

      public <T extends org.apache.helix.HelixProperty> boolean setProperty(org.apache.helix.PropertyKey key, T value)
    • updateProperty

      public <T extends org.apache.helix.HelixProperty> boolean updateProperty(org.apache.helix.PropertyKey key, T value)
    • updateProperty

      public <T extends org.apache.helix.HelixProperty> boolean updateProperty(org.apache.helix.PropertyKey key, org.apache.helix.zookeeper.zkclient.DataUpdater<org.apache.helix.zookeeper.datamodel.ZNRecord> updater, T value)
    • getProperty

      public <T extends org.apache.helix.HelixProperty> T getProperty(org.apache.helix.PropertyKey key)
    • getProperty

      public <T extends org.apache.helix.HelixProperty> List<T> getProperty(List<org.apache.helix.PropertyKey> keys) throws org.apache.helix.api.exceptions.HelixMetaDataAccessException
      N.B.: The behavior of this function is different from that of HelixDataAccessor, which would swallow exceptions and return an empty collection.
      Throws:
      org.apache.helix.api.exceptions.HelixMetaDataAccessException
    • removeProperty

      public boolean removeProperty(org.apache.helix.PropertyKey key)
    • getPropertyStat

      public org.apache.helix.HelixProperty.Stat getPropertyStat(org.apache.helix.PropertyKey key)
    • getPropertyStats

      public List<org.apache.helix.HelixProperty.Stat> getPropertyStats(List<org.apache.helix.PropertyKey> keys)
    • getChildNames

      public List<String> getChildNames(org.apache.helix.PropertyKey key)
    • getChildValues

      public <T extends org.apache.helix.HelixProperty> List<T> getChildValues(org.apache.helix.PropertyKey key) throws org.apache.helix.api.exceptions.HelixMetaDataAccessException
      N.B.: The behavior of this function is different from that of HelixDataAccessor, which would swallow exceptions and return an empty collection.
      Throws:
      org.apache.helix.api.exceptions.HelixMetaDataAccessException
    • getChildValuesMap

      public <T extends org.apache.helix.HelixProperty> Map<String,T> getChildValuesMap(org.apache.helix.PropertyKey key) throws org.apache.helix.api.exceptions.HelixMetaDataAccessException
      N.B.: The behavior of this function is different from that of HelixDataAccessor, which would swallow exceptions and return an empty collection.
      Throws:
      org.apache.helix.api.exceptions.HelixMetaDataAccessException
    • createChildren

      public <T extends org.apache.helix.HelixProperty> boolean[] createChildren(List<org.apache.helix.PropertyKey> keys, List<T> children)
    • setChildren

      public <T extends org.apache.helix.HelixProperty> boolean[] setChildren(List<org.apache.helix.PropertyKey> keys, List<T> children)
    • updateChildren

      public <T extends org.apache.helix.HelixProperty> boolean[] updateChildren(List<String> paths, List<org.apache.helix.zookeeper.zkclient.DataUpdater<org.apache.helix.zookeeper.datamodel.ZNRecord>> updaters, int options)
    • keyBuilder

      public org.apache.helix.PropertyKey.Builder keyBuilder()