sklaha commented on code in PR #258: URL: https://github.com/apache/cassandra-sidecar/pull/258#discussion_r2442722502
########## server/src/main/java/org/apache/cassandra/sidecar/job/NodeDrainJob.java: ########## @@ -0,0 +1,142 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.cassandra.sidecar.job; + +import java.io.IOException; +import java.util.UUID; +import java.util.concurrent.ExecutionException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.cassandra.sidecar.common.data.OperationalJobStatus; +import org.apache.cassandra.sidecar.common.server.StorageOperations; +import org.apache.cassandra.sidecar.common.server.exceptions.OperationalJobException; + +/** + * Implementation of {@link OperationalJob} to perform node drain operation. + */ +public class NodeDrainJob extends OperationalJob +{ + private static final Logger LOGGER = LoggerFactory.getLogger(NodeDrainJob.class); + private static final String OPERATION = "drain"; + protected StorageOperations storageOperations; + + /** + * Enum representing the various drain states of a Cassandra node. + */ + public enum NodeDrainStateEnum Review Comment: If we combine the enum for all operations, each job will need to store the mapping of running vs not running statuses. Please check the implementation of the status() for the context: https://github.com/apache/cassandra-sidecar/pull/258/files#diff-7dc78ce3affd3c55b0f2fd978064df7d3bbeb4e22b67f14cc02e64d4885a1b52R98 The other option is to keep the status enums separate for for job, as I implemented. Please let me know your thoughts. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

