/** * returns the cluster map for current deploy. The keys of the map are node names, the values contain names of clusters (data * files) available on the single node. * * @return the cluster map for current deploy */ default Map<String, Set<String>> getActiveClusterMap() { Map<String, Set<String>> result = new HashMap<>(); result.put(getLocalNodeName(), getStorage().getClusterNames()); return result; }
@Override public boolean existsCluster(final String iClusterName) { checkIfActive(); return getStorage().getClusterNames().contains(iClusterName.toLowerCase(Locale.ENGLISH)); }
@Override public Collection<String> getClusterNames() { checkIfActive(); return getStorage().getClusterNames(); }
protected List<OCluster> getClusters() { final ODatabaseDocumentInternal database = getDatabase(); final List<OCluster> result = new ArrayList<OCluster>(); if (clusterName.endsWith("*")) { final String toMatch = clusterName.substring(0, clusterName.length() - 1).toLowerCase(Locale.ENGLISH); for (String cl : database.getStorage().getClusterNames()) { if (cl.startsWith(toMatch)) result.add(database.getStorage().getClusterByName(cl)); } } else { if (clusterId > -1) { result.add(database.getStorage().getClusterById(clusterId)); } else { result.add(database.getStorage().getClusterById(database.getStorage().getClusterIdByName(clusterName))); } } return result; }
private List<com.orientechnologies.orient.core.storage.OCluster> getClusters(OCommandContext ctx) { OStorage storage = ((ODatabaseDocumentInternal) ctx.getDatabase()).getStorage(); if (starred) { List<com.orientechnologies.orient.core.storage.OCluster> result = new ArrayList<>(); for (String clusterName : storage.getClusterNames()) { if (clusterName.startsWith(name.getStringValue())) { result.add(storage.getClusterByName(clusterName)); } } return result; } else { int clusterId = ctx.getDatabase().getClusterIdByName(name.getStringValue()); if (clusterId <= 0) { throw new OCommandExecutionException("Cannot find cluster " + name); } com.orientechnologies.orient.core.storage.OCluster cluster = storage.getClusterById(clusterId); return Collections.singletonList(cluster); } }