use of voldemort.xml.ClusterMapper in project voldemort by voldemort.
the class VoldemortServer method getTestMetadataStore.
private static MetadataStore getTestMetadataStore(VoldemortConfig voldemortConfig, Cluster cluster) {
ConfigurationStorageEngine metadataInnerEngine = new ConfigurationStorageEngine("metadata-config-store", voldemortConfig.getMetadataDirectory());
List<Versioned<String>> clusterXmlValue = metadataInnerEngine.get(MetadataStore.CLUSTER_KEY, null);
VectorClock version = null;
if (clusterXmlValue.size() <= 0) {
version = new VectorClock();
} else {
version = (VectorClock) clusterXmlValue.get(0).getVersion();
}
int nodeId = getNodeId(voldemortConfig, cluster);
version.incrementVersion(nodeId, System.currentTimeMillis());
metadataInnerEngine.put(MetadataStore.CLUSTER_KEY, new Versioned<String>(new ClusterMapper().writeCluster(cluster), version), null);
return MetadataStore.createInMemoryMetadataStore(metadataInnerEngine, nodeId);
}
use of voldemort.xml.ClusterMapper in project voldemort by voldemort.
the class ServerTestUtils method getStores.
public static StoreRepository getStores(String storeName, String clusterXml, String storesXml) {
StoreRepository repository = new StoreRepository();
Store<ByteArray, byte[], byte[]> store = new InMemoryStorageEngine<ByteArray, byte[], byte[]>(storeName);
repository.addLocalStore(store);
repository.addRoutedStore(store);
// create new metadata store.
MetadataStore metadata = createMetadataStore(new ClusterMapper().readCluster(new StringReader(clusterXml)), new StoreDefinitionsMapper().readStoreList(new StringReader(storesXml)));
repository.addLocalStore(metadata);
return repository;
}
use of voldemort.xml.ClusterMapper in project voldemort by voldemort.
the class ServerTestUtils method createMetadataStore.
public static MetadataStore createMetadataStore(Cluster cluster, List<StoreDefinition> storeDefs) {
Store<String, String, String> innerStore = new InMemoryStorageEngine<String, String, String>("inner-store");
innerStore.put(MetadataStore.CLUSTER_KEY, new Versioned<String>(new ClusterMapper().writeCluster(cluster)), null);
innerStore.put(MetadataStore.STORES_KEY, new Versioned<String>(new StoreDefinitionsMapper().writeStoreList(storeDefs)), null);
return MetadataStore.createInMemoryMetadataStore(innerStore, 0);
}
use of voldemort.xml.ClusterMapper in project voldemort by voldemort.
the class ServerTestUtils method createMetadataStore.
public static MetadataStore createMetadataStore(Cluster cluster, List<StoreDefinition> storeDefs, int nodeId) {
Store<String, String, String> innerStore = new InMemoryStorageEngine<String, String, String>("inner-store");
innerStore.put(MetadataStore.CLUSTER_KEY, new Versioned<String>(new ClusterMapper().writeCluster(cluster)), null);
innerStore.put(MetadataStore.STORES_KEY, new Versioned<String>(new StoreDefinitionsMapper().writeStoreList(storeDefs)), null);
return MetadataStore.createInMemoryMetadataStore(innerStore, nodeId);
}
use of voldemort.xml.ClusterMapper in project voldemort by voldemort.
the class ZoneShrinkageCLI method shrinkClusterXml.
protected static String shrinkClusterXml(String clusterXml, int droppingZoneId) {
Cluster initialCluster = new ClusterMapper().readCluster(new StringReader(clusterXml));
Cluster intermediateCluster = RebalanceUtils.vacateZone(initialCluster, droppingZoneId);
Cluster finalCluster = RebalanceUtils.dropZone(intermediateCluster, droppingZoneId);
String newClusterXml = new ClusterMapper().writeCluster(finalCluster);
return newClusterXml;
}
Aggregations