@Override public <T extends HelixProperty> boolean[] createChildren(List<PropertyKey> keys, List<T> children) { // TODO: add validation int options = -1; List<String> paths = new ArrayList<String>(); List<ZNRecord> records = new ArrayList<ZNRecord>(); for (int i = 0; i < keys.size(); i++) { PropertyKey key = keys.get(i); PropertyType type = key.getType(); String path = key.getPath(); paths.add(path); HelixProperty value = children.get(i); records.add(value.getRecord()); options = constructOptions(type); } return _baseDataAccessor.createChildren(paths, records, options); }
@Override public <T extends HelixProperty> boolean[] createChildren(List<PropertyKey> keys, List<T> children) { // TODO: add validation int options = -1; List<String> paths = new ArrayList<String>(); List<ZNRecord> records = new ArrayList<ZNRecord>(); for (int i = 0; i < keys.size(); i++) { PropertyKey key = keys.get(i); PropertyType type = key.getType(); String path = key.getPath(); paths.add(path); HelixProperty value = children.get(i); records.add(value.getRecord()); options = constructOptions(type); } return _baseDataAccessor.createChildren(paths, records, options); }
@Override public List<String> getChildNames(PropertyKey key) { PropertyType type = key.getType(); String parentPath = key.getPath(); int options = constructOptions(type); List<String> childNames = _baseDataAccessor.getChildNames(parentPath, options); if (childNames == null) { childNames = Collections.emptyList(); } return childNames; }
@Override public List<String> getChildNames(PropertyKey key) { PropertyType type = key.getType(); String parentPath = key.getPath(); int options = constructOptions(type); List<String> childNames = _baseDataAccessor.getChildNames(parentPath, options); if (childNames == null) { childNames = Collections.emptyList(); } return childNames; }
@Override public <T extends HelixProperty> Map<String, T> getChildValuesMap(PropertyKey key, boolean throwException) { PropertyType type = key.getType(); String parentPath = key.getPath(); int options = constructOptions(type); List<T> children = getChildValues(key, throwException); Map<String, T> childValuesMap = new HashMap<String, T>(); for (T t : children) { childValuesMap.put(t.getRecord().getId(), t); } return childValuesMap; }
@Override public boolean removeProperty(PropertyKey key) { PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); return _baseDataAccessor.remove(path, options); }
@Override public boolean removeProperty(PropertyKey key) { PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); return _baseDataAccessor.remove(path, options); }
@Override public <T extends HelixProperty> Map<String, T> getChildValuesMap(PropertyKey key, boolean throwException) { PropertyType type = key.getType(); String parentPath = key.getPath(); int options = constructOptions(type); List<T> children = getChildValues(key, throwException); Map<String, T> childValuesMap = new HashMap<String, T>(); for (T t : children) { childValuesMap.put(t.getRecord().getId(), t); } return childValuesMap; }
String path = key.getPath(); paths.add(path); options = constructOptions(type);
@Override public <T extends HelixProperty> boolean updateProperty(PropertyKey key, DataUpdater<ZNRecord> updater, T value) { PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); boolean success = false; switch (type) { case CURRENTSTATES: success = _groupCommit.commit(_baseDataAccessor, options, path, value.getRecord(), true); break; case STATUSUPDATES: if (LOG.isTraceEnabled()) { LOG.trace("Update status. path: " + key.getPath() + ", record: " + value.getRecord()); } break; default: success = _baseDataAccessor.update(path, updater, options); break; } return success; }
@Override public <T extends HelixProperty> boolean updateProperty(PropertyKey key, DataUpdater<ZNRecord> updater, T value) { PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); boolean success = false; switch (type) { case CURRENTSTATES: success = _groupCommit.commit(_baseDataAccessor, options, path, value.getRecord(), true); break; case STATUSUPDATES: if (LOG.isTraceEnabled()) { LOG.trace("Update status. path: " + key.getPath() + ", record: " + value.getRecord()); } break; default: success = _baseDataAccessor.update(path, updater, options); break; } return success; }
int options = constructOptions(type); if (record != null) { record.setCreationTime(stat.getCtime());
@Override public HelixProperty.Stat getPropertyStat(PropertyKey key) { PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); try { Stat stat = _baseDataAccessor.getStat(path, options); if (stat != null) { return new HelixProperty.Stat(stat.getVersion(), stat.getCtime(), stat.getMtime()); } } catch (ZkNoNodeException e) { } return null; }
@Override public HelixProperty.Stat getPropertyStat(PropertyKey key) { PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); try { Stat stat = _baseDataAccessor.getStat(path, options); if (stat != null) { return new HelixProperty.Stat(stat.getVersion(), stat.getCtime(), stat.getMtime(), stat.getEphemeralOwner()); } } catch (ZkNoNodeException e) { } return null; }
int options = constructOptions(type);
int options = constructOptions(type);
PropertyType type = key.getType(); String parentPath = key.getPath(); int options = constructOptions(type); List<T> childValues = new ArrayList<T>(); List<ZNRecord> children;
PropertyType type = key.getType(); String parentPath = key.getPath(); int options = constructOptions(type); List<T> childValues = new ArrayList<T>(); List<ZNRecord> children;
PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); ZNRecord record = null; try {
PropertyType type = key.getType(); String path = key.getPath(); int options = constructOptions(type); ZNRecord record = null; try {