All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.camunda.zeebe.dynamic.config.api.ClusterConfigurationManagementRequest Maven / Gradle / Ivy

/*
 * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH under
 * one or more contributor license agreements. See the NOTICE file distributed
 * with this work for additional information regarding copyright ownership.
 * Licensed under the Camunda License 1.0. You may not use this file
 * except in compliance with the Camunda License 1.0.
 */
package io.camunda.zeebe.dynamic.config.api;

import io.atomix.cluster.MemberId;
import java.util.Optional;
import java.util.Set;

/** Defines the supported requests for the configuration management. */
public sealed interface ClusterConfigurationManagementRequest {

  /**
   * Marks a request as dry run. Changes are planned and validated but not applied so the cluster
   * configuration remains unchanged.
   */
  boolean dryRun();

  record AddMembersRequest(Set members, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record RemoveMembersRequest(Set members, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record JoinPartitionRequest(MemberId memberId, int partitionId, int priority, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record LeavePartitionRequest(MemberId memberId, int partitionId, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record ReassignPartitionsRequest(Set members, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record BrokerScaleRequest(
      Set members, Optional newReplicationFactor, boolean dryRun)
      implements ClusterConfigurationManagementRequest {
    public BrokerScaleRequest(final Set members, final boolean dryRun) {
      this(members, Optional.empty(), dryRun);
    }
  }

  record ClusterScaleRequest(
      Optional newClusterSize,
      Optional newPartitionCount,
      Optional newReplicationFactor,
      boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record ClusterPatchRequest(
      Set membersToAdd,
      Set membersToRemove,
      Optional newPartitionCount,
      Optional newReplicationFactor,
      boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record ForceRemoveBrokersRequest(Set membersToRemove, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record ExporterDisableRequest(String exporterId, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record ExporterEnableRequest(String exporterId, Optional initializeFrom, boolean dryRun)
      implements ClusterConfigurationManagementRequest {}

  record CancelChangeRequest(long changeId) implements ClusterConfigurationManagementRequest {

    @Override
    public boolean dryRun() {
      return false;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy