Package com.linkedin.venice.helix
Class SafeHelixDataAccessor
- java.lang.Object
-
- com.linkedin.venice.helix.SafeHelixDataAccessor
-
public class SafeHelixDataAccessor extends java.lang.Object
A wrapper aroundHelixDataAccessor
which disables the unsafe functionality. Venice should never use aHelixDataAccessor
directly. All uses of this class should always be wrapped in aSafeHelixDataAccessor
. 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 theHelixDataAccessor
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 theBaseDataAccessor
returned by this function, then we would likewise need to wrap it inside of a Safe API, because it provides unsafe calls such asBaseDataAccessor.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends org.apache.helix.HelixProperty>
boolean[]createChildren(java.util.List<org.apache.helix.PropertyKey> keys, java.util.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)
java.util.List<java.lang.String>
getChildNames(org.apache.helix.PropertyKey key)
<T extends org.apache.helix.HelixProperty>
java.util.List<T>getChildValues(org.apache.helix.PropertyKey key)
N.B.: The behavior of this function is different from that ofHelixDataAccessor
, which would swallow exceptions and return an empty collection.<T extends org.apache.helix.HelixProperty>
java.util.Map<java.lang.String,T>getChildValuesMap(org.apache.helix.PropertyKey key)
N.B.: The behavior of this function is different from that ofHelixDataAccessor
, which would swallow exceptions and return an empty collection.<T extends org.apache.helix.HelixProperty>
java.util.List<T>getProperty(java.util.List<org.apache.helix.PropertyKey> keys)
N.B.: The behavior of this function is different from that ofHelixDataAccessor
, which would swallow exceptions and return an empty collection.<T extends org.apache.helix.HelixProperty>
TgetProperty(org.apache.helix.PropertyKey key)
org.apache.helix.HelixProperty.Stat
getPropertyStat(org.apache.helix.PropertyKey key)
java.util.List<org.apache.helix.HelixProperty.Stat>
getPropertyStats(java.util.List<org.apache.helix.PropertyKey> keys)
org.apache.helix.PropertyKey.Builder
keyBuilder()
boolean
removeProperty(org.apache.helix.PropertyKey key)
<T extends org.apache.helix.HelixProperty>
boolean[]setChildren(java.util.List<org.apache.helix.PropertyKey> keys, java.util.List<T> children)
<T extends org.apache.helix.HelixProperty>
booleansetProperty(org.apache.helix.PropertyKey key, T value)
<T extends org.apache.helix.HelixProperty>
boolean[]updateChildren(java.util.List<java.lang.String> paths, java.util.List<org.apache.helix.zookeeper.zkclient.DataUpdater<org.apache.helix.zookeeper.datamodel.ZNRecord>> updaters, int options)
<T extends org.apache.helix.HelixProperty>
booleanupdateProperty(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>
booleanupdateProperty(org.apache.helix.PropertyKey key, T value)
-
-
-
Method Detail
-
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> java.util.List<T> getProperty(java.util.List<org.apache.helix.PropertyKey> keys) throws org.apache.helix.api.exceptions.HelixMetaDataAccessException
N.B.: The behavior of this function is different from that ofHelixDataAccessor
, 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 java.util.List<org.apache.helix.HelixProperty.Stat> getPropertyStats(java.util.List<org.apache.helix.PropertyKey> keys)
-
getChildNames
public java.util.List<java.lang.String> getChildNames(org.apache.helix.PropertyKey key)
-
getChildValues
public <T extends org.apache.helix.HelixProperty> java.util.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 ofHelixDataAccessor
, which would swallow exceptions and return an empty collection.- Throws:
org.apache.helix.api.exceptions.HelixMetaDataAccessException
-
getChildValuesMap
public <T extends org.apache.helix.HelixProperty> java.util.Map<java.lang.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 ofHelixDataAccessor
, 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(java.util.List<org.apache.helix.PropertyKey> keys, java.util.List<T> children)
-
setChildren
public <T extends org.apache.helix.HelixProperty> boolean[] setChildren(java.util.List<org.apache.helix.PropertyKey> keys, java.util.List<T> children)
-
updateChildren
public <T extends org.apache.helix.HelixProperty> boolean[] updateChildren(java.util.List<java.lang.String> paths, java.util.List<org.apache.helix.zookeeper.zkclient.DataUpdater<org.apache.helix.zookeeper.datamodel.ZNRecord>> updaters, int options)
-
keyBuilder
public org.apache.helix.PropertyKey.Builder keyBuilder()
-
-