use of io.atomix.primitive.service.ServiceConfig in project atomix by atomix.
the class DefaultAtomicDocumentTreeBuilder method buildAsync.
@Override
@SuppressWarnings("unchecked")
public CompletableFuture<AtomicDocumentTree<V>> buildAsync() {
return newProxy(DocumentTreeService.class, new ServiceConfig()).thenCompose(proxy -> new AtomicDocumentTreeProxy(proxy, managementService.getPrimitiveRegistry()).connect()).thenApply(treeProxy -> {
Serializer serializer = serializer();
AsyncAtomicDocumentTree<V> tree = new TranscodingAsyncAtomicDocumentTree<>(treeProxy, key -> serializer.encode(key), bytes -> serializer.decode(bytes));
if (config.getCacheConfig().isEnabled()) {
tree = new CachingAsyncAtomicDocumentTree<V>(tree, config.getCacheConfig());
}
return tree.sync();
});
}
Aggregations