use of io.atomix.core.map.ConsistentTreeMap in project atomix by atomix.
the class ConsistentTreeMapProxyBuilder method buildAsync.
@Override
@SuppressWarnings("unchecked")
public CompletableFuture<ConsistentTreeMap<V>> buildAsync() {
PrimitiveProtocol protocol = protocol();
return managementService.getPartitionService().getPartitionGroup(protocol).getPartition(name()).getPrimitiveClient().newProxy(name(), primitiveType(), protocol).connect().thenApply(proxy -> {
ConsistentTreeMapProxy rawMap = new ConsistentTreeMapProxy(proxy);
Serializer serializer = serializer();
return new TranscodingAsyncConsistentTreeMap<V, byte[]>(rawMap, value -> value == null ? null : serializer.encode(value), bytes -> serializer.decode(bytes)).sync();
});
}
Aggregations