use of io.zeebe.broker.system.log.PendingPartitionsIndex.PendingPartition in project zeebe by zeebe-io.
the class CompletePartitionProcessor method processEvent.
@Override
public void processEvent(TypedEvent<PartitionEvent> event) {
final PartitionEvent value = event.getValue();
final PendingPartition partition = partitions.get(value.getId());
if (partition != null) {
value.setState(PartitionState.CREATED);
} else {
value.setState(PartitionState.CREATE_COMPLETE_REJECTED);
}
}
use of io.zeebe.broker.system.log.PendingPartitionsIndex.PendingPartition in project zeebe by zeebe-io.
the class ExpirePartitionCreationProcessor method processEvent.
@Override
public void processEvent(TypedEvent<PartitionEvent> event) {
final PartitionEvent value = event.getValue();
final PendingPartition partition = partitions.get(value.getId());
if (partition != null) {
value.setState(PartitionState.CREATE_EXPIRED);
} else {
value.setState(PartitionState.CREATE_EXPIRE_REJECTED);
}
}
use of io.zeebe.broker.system.log.PendingPartitionsIndex.PendingPartition in project zeebe by zeebe-io.
the class ResolvePendingPartitionsCommand method checkExpiredCreation.
private void checkExpiredCreation() {
final Iterator<PendingPartition> partitionIt = partitions.iterator();
final long now = ActorClock.currentTimeMillis();
while (partitionIt.hasNext()) {
final PendingPartition partition = partitionIt.next();
if (partition.getCreationTimeout() < now) {
final TypedEvent<PartitionEvent> event = reader.readValue(partition.getPosition(), PartitionEvent.class);
event.getValue().setState(PartitionState.CREATE_EXPIRE);
// it is ok if writing fails,
// we will then try it again with the next command execution (there are no other side effects of expiration)
writer.writeFollowupEvent(event.getKey(), event.getValue());
}
}
}
use of io.zeebe.broker.system.log.PendingPartitionsIndex.PendingPartition in project zeebe by zeebe-io.
the class ResolvePendingPartitionsCommand method checkCompletedCreation.
private void checkCompletedCreation() {
final Iterator<Member> currentMembers = partitionManager.getKnownMembers();
while (currentMembers.hasNext()) {
final Member currentMember = currentMembers.next();
final IntIterator partitionsLeadByMember = currentMember.getLeadingPartitions();
while (partitionsLeadByMember.hasNext()) {
final int currentPartition = partitionsLeadByMember.nextInt();
final PendingPartition partition = partitions.get(currentPartition);
if (partition != null) {
final TypedEvent<PartitionEvent> event = reader.readValue(partition.getPosition(), PartitionEvent.class);
event.getValue().setState(PartitionState.CREATE_COMPLETE);
// it is ok if writing fails,
// we will then try it again with the next command execution (there are no other side effects of completion)
writer.writeFollowupEvent(event.getKey(), event.getValue());
}
}
}
}
Aggregations