/** * Check if an Instance exists in the Helix cluster. * * @param instanceName: Name of instance to check. * @return True if instance exists in the Helix cluster, False otherwise. */ public boolean instanceExists(String instanceName) { ZNRecord znRecord = _cacheInstanceConfigsDataAccessor.get("/" + instanceName, null, AccessOption.PERSISTENT); return (znRecord != null); }
@Override public List<T> getChildren(String parentPath, List<Stat> stats, int options) { List<String> childNames = getChildNames(parentPath, options); if (childNames == null) { return null; } List<String> paths = new ArrayList<>(); for (String childName : childNames) { String path = parentPath.equals("/") ? "/" + childName : parentPath + "/" + childName; paths.add(path); } return get(paths, stats, options); }
records = accessor.get(paths, null, 0); for (int i = 0; i < 10; i++) { Assert.assertEquals(records.get(i).getId(), "TestDB" + i);
@Override public List<T> getChildren(String parentPath, List<Stat> stats, int options) { List<String> childNames = getChildNames(parentPath, options); if (childNames == null) { return null; } List<String> paths = new ArrayList<>(); for (String childName : childNames) { String path = parentPath.equals("/") ? "/" + childName : parentPath + "/" + childName; paths.add(path); } return get(paths, stats, options); }
records = accessor.get(paths, null, 0); for (int i = 0; i < 10; i++) { Assert.assertEquals(records.get(i).getId(), "TestDB" + i);
/** * Get the Helix instance config for the given instance Id. * * @param instanceId Instance Id * @return Helix instance config */ public InstanceConfig getHelixInstanceConfig(@Nonnull String instanceId) { ZNRecord znRecord = _cacheInstanceConfigsDataAccessor.get("/" + instanceId, null, AccessOption.PERSISTENT); return znRecord != null ? new InstanceConfig(znRecord) : null; }
ZNRecord record = accessor.get(path, null, 0); Assert.assertEquals(record.getId(), "TestDB" + i);
@Override public List<T> get(List<String> paths, List<Stat> stats, int options) { return get(paths, stats, options, false); }
@Override public List<T> get(List<String> paths, List<Stat> stats, int options) { return get(paths, stats, options, false); }