use of cz.o2.proxima.storage.StorageFilter in project proxima-platform by O2-Czech-Republic.
the class ReplicationController method runTransform.
private void runTransform(String name, TransformationDescriptor transform, DirectAttributeFamilyDescriptor family) {
final StorageFilter filter = transform.getFilter();
final String consumer = transform.getConsumerNameFactory().apply();
final CommitLogReader reader = family.getCommitLogReader().orElseThrow(() -> new IllegalStateException("Unable to get reader for family " + family.getDesc().getName() + "."));
final TransformationObserver observer;
if (transform.getTransformation().isContextual()) {
DirectElementWiseTransform transformation = transform.getTransformation().as(DirectElementWiseTransform.class);
observer = contextualObserver(dataOperator, name, transformation, transform.getOutputTransactionMode() == OutputTransactionMode.ENABLED, filter);
} else {
ElementWiseTransformation transformation = transform.getTransformation().asElementWiseTransform();
observer = nonContextualObserver(dataOperator, name, transformation, transform.getOutputTransactionMode() == OutputTransactionMode.ENABLED, filter);
}
startTransformationObserverUsing(consumer, reader, observer);
log.info("Started transformer {} reading from {} using {}", consumer, reader.getUri(), transform.getTransformation().getClass());
}
use of cz.o2.proxima.storage.StorageFilter in project proxima-platform by O2-Czech-Republic.
the class ReplicationController method consumeLog.
private void consumeLog(DirectAttributeFamilyDescriptor primaryFamily, DirectAttributeFamilyDescriptor replicaFamily) {
final CommitLogReader commitLog = primaryFamily.getCommitLogReader().orElseThrow(() -> new IllegalStateException(String.format("Failed to find commit-log reader in family %s.", primaryFamily)));
final AttributeWriterBase writer = replicaFamily.getWriter().orElseThrow(() -> new IllegalStateException(String.format("Unable to get writer for family %s.", replicaFamily.getDesc().getName())));
final StorageFilter filter = replicaFamily.getDesc().getFilter();
final Set<AttributeDescriptor<?>> allowedAttributes = new HashSet<>(replicaFamily.getAttributes());
final String name = replicaFamily.getDesc().getReplicationConsumerNameFactory().apply();
log.info("Using consumer name {} to replicate family {}", name, replicaFamily.getDesc().getName());
registerWriterTo(name, commitLog, allowedAttributes, filter, writer);
log.info("Started consumer {} consuming from log {} with URI {} into {} attributes {}", name, commitLog, commitLog.getUri(), writer.getUri(), allowedAttributes);
}
Aggregations