use of voldemort.serialization.StringSerializer in project voldemort by voldemort.
the class VoldemortAdminTool method getMetadataVersionsForNode.
private static String getMetadataVersionsForNode(AdminClient adminClient, int nodeId) {
List<Integer> partitionIdList = Lists.newArrayList();
for (Node node : adminClient.getAdminClientCluster().getNodes()) {
partitionIdList.addAll(node.getPartitionIds());
}
Iterator<Pair<ByteArray, Versioned<byte[]>>> entriesIterator = adminClient.bulkFetchOps.fetchEntries(nodeId, SystemStoreConstants.SystemStoreName.voldsys$_metadata_version_persistence.name(), partitionIdList, null, true);
Serializer<String> serializer = new StringSerializer("UTF8");
String keyObject = null;
String valueObject = null;
while (entriesIterator.hasNext()) {
try {
Pair<ByteArray, Versioned<byte[]>> kvPair = entriesIterator.next();
byte[] keyBytes = kvPair.getFirst().get();
byte[] valueBytes = kvPair.getSecond().getValue();
keyObject = serializer.toObject(keyBytes);
if (!keyObject.equals(SystemStoreConstants.VERSIONS_METADATA_KEY)) {
continue;
}
valueObject = serializer.toObject(valueBytes);
} catch (Exception e) {
System.err.println("Error while retrieving Metadata versions from node : " + nodeId + ". Exception = \n");
e.printStackTrace();
System.exit(-1);
}
}
return valueObject;
}
use of voldemort.serialization.StringSerializer in project voldemort by voldemort.
the class AbstractStoreClientFactory method getRemoteMetadata.
protected List<Versioned<String>> getRemoteMetadata(String key, URI url) {
Store<ByteArray, byte[], byte[]> remoteStore = getStore(MetadataStore.METADATA_STORE_NAME, url.getHost(), url.getPort(), this.requestFormatType);
Store<String, String, byte[]> store = SerializingStore.wrap(remoteStore, new StringSerializer("UTF-8"), new StringSerializer("UTF-8"), new IdentitySerializer());
return store.get(key, null);
}
use of voldemort.serialization.StringSerializer in project voldemort by voldemort.
the class ExternalSorterTest method testSorting.
public void testSorting(int threads) {
ExternalSorter<String> sorter = new ExternalSorter<String>(new StringSerializer(), 10, threads);
List<String> sorted = Lists.newArrayList(sorter.sorted(strings.iterator()));
List<String> expected = new ArrayList<String>(strings);
Collections.sort(expected);
assertEquals(expected, sorted);
}
Aggregations