use of io.atomix.cluster.NoopSnapshotStoreFactory in project zeebe by camunda.
the class RaftRolesTest method startPartitionManagerWithPartitionConsumer.
private CompletableFuture<Void> startPartitionManagerWithPartitionConsumer(final int nodeId, final int partitionCount, final List<Integer> nodeIds, final Consumer<? super Partition> partitionConsumer) {
final List<String> memberIds = nodeIds.stream().map(Object::toString).collect(Collectors.toList());
final RaftPartitionGroup partitionGroup = RaftPartitionGroup.builder("normal").withNumPartitions(partitionCount).withPartitionSize(memberIds.size()).withPriorityElection(false).withMembers(memberIds).withDataDirectory(new File(new File(atomixClusterRule.getDataDir(), "log"), "" + nodeId)).withSnapshotStoreFactory(new NoopSnapshotStoreFactory()).build();
final var atomixFuture = atomixClusterRule.startAtomix(nodeId, nodeIds, AtomixClusterBuilder::build);
final AtomixCluster atomix;
try {
atomix = atomixFuture.get();
final var partitionService = new DefaultPartitionService(atomix.getMembershipService(), atomix.getCommunicationService(), partitionGroup);
partitionGroup.getPartitions().forEach(partitionConsumer);
return partitionService.start().thenApply(ps -> null);
} catch (final InterruptedException | ExecutionException e) {
LangUtil.rethrowUnchecked(e);
// won't be executed
return null;
}
}
use of io.atomix.cluster.NoopSnapshotStoreFactory in project zeebe by zeebe-io.
the class RaftRolesTest method startPartitionManagerWithPartitionConsumer.
private CompletableFuture<Void> startPartitionManagerWithPartitionConsumer(final int nodeId, final int partitionCount, final List<Integer> nodeIds, final Consumer<? super Partition> partitionConsumer) {
final List<String> memberIds = nodeIds.stream().map(Object::toString).collect(Collectors.toList());
final RaftPartitionGroup partitionGroup = RaftPartitionGroup.builder("normal").withNumPartitions(partitionCount).withPartitionSize(memberIds.size()).withPriorityElection(false).withMembers(memberIds).withDataDirectory(new File(new File(atomixClusterRule.getDataDir(), "log"), "" + nodeId)).withSnapshotStoreFactory(new NoopSnapshotStoreFactory()).build();
final var atomixFuture = atomixClusterRule.startAtomix(nodeId, nodeIds, AtomixClusterBuilder::build);
final AtomixCluster atomix;
try {
atomix = atomixFuture.get();
final var partitionService = new DefaultPartitionService(atomix.getMembershipService(), atomix.getCommunicationService(), partitionGroup);
partitionGroup.getPartitions().forEach(partitionConsumer);
return partitionService.start().thenApply(ps -> null);
} catch (final InterruptedException | ExecutionException e) {
LangUtil.rethrowUnchecked(e);
// won't be executed
return null;
}
}
use of io.atomix.cluster.NoopSnapshotStoreFactory in project zeebe by camunda-cloud.
the class RaftRolesTest method startPartitionManagerWithPartitionConsumer.
private CompletableFuture<Void> startPartitionManagerWithPartitionConsumer(final int nodeId, final int partitionCount, final List<Integer> nodeIds, final Consumer<? super Partition> partitionConsumer) {
final List<String> memberIds = nodeIds.stream().map(Object::toString).collect(Collectors.toList());
final RaftPartitionGroup partitionGroup = RaftPartitionGroup.builder("normal").withNumPartitions(partitionCount).withPartitionSize(memberIds.size()).withPriorityElection(false).withMembers(memberIds).withDataDirectory(new File(new File(atomixClusterRule.getDataDir(), "log"), "" + nodeId)).withSnapshotStoreFactory(new NoopSnapshotStoreFactory()).build();
final var atomixFuture = atomixClusterRule.startAtomix(nodeId, nodeIds, AtomixClusterBuilder::build);
final AtomixCluster atomix;
try {
atomix = atomixFuture.get();
final var partitionService = new DefaultPartitionService(atomix.getMembershipService(), atomix.getCommunicationService(), partitionGroup);
partitionGroup.getPartitions().forEach(partitionConsumer);
return partitionService.start().thenApply(ps -> null);
} catch (final InterruptedException | ExecutionException e) {
LangUtil.rethrowUnchecked(e);
// won't be executed
return null;
}
}
Aggregations