Skip to content

Commit

Permalink
[Javadocs] add to o.o.cluster (#3170) (#3178)
Browse files Browse the repository at this point in the history
Adds javadocs to classes in the o.o.cluster package.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
  • Loading branch information
nknize committed May 5, 2022
1 parent 0a28453 commit f82510d
Show file tree
Hide file tree
Showing 221 changed files with 617 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
/**
* Abstract diffable object with simple diffs implementation that sends the entire object if object has changed or
* nothing if object remained the same.
*
* @opensearch.internal
*/
public abstract class AbstractDiffable<T extends Diffable<T>> implements Diffable<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
/**
* Abstract diffable object with simple diffs implementation that sends the entire object if object has changed or
* nothing is object remained the same. Comparing to AbstractDiffable, this class also works with NamedWriteables
*
* @opensearch.internal
*/
public abstract class AbstractNamedDiffable<T extends NamedDiffable<T>> implements Diffable<T>, NamedWriteable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
import org.opensearch.common.Nullable;
import org.opensearch.common.unit.TimeValue;

/**
* Listener when cluster state task is acknowledged
*
* @opensearch.internal
*/
public interface AckedClusterStateTaskListener extends ClusterStateTaskListener {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
/**
* An extension interface to {@link ClusterStateUpdateTask} that allows to be notified when
* all the nodes have acknowledged a cluster state update request
*
* @opensearch.internal
*/
public abstract class AckedClusterStateUpdateTask<Response> extends ClusterStateUpdateTask implements AckedClusterStateTaskListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@

/**
* An event received by the local node, signaling that the cluster state has changed.
*
* @opensearch.internal
*/
public class ClusterChangedEvent {

Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/cluster/ClusterInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
* and a map of shard ids to shard sizes, see
* <code>InternalClusterInfoService.shardIdentifierFromRouting(String)</code>
* for the key used in the shardSizes map
*
* @opensearch.internal
*/
public class ClusterInfo implements ToXContentFragment, Writeable {
private final ImmutableOpenMap<String, DiskUsage> leastAvailableSpaceUsage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

/**
* Interface for a class used to gather information about a cluster periodically.
*
* @opensearch.internal
*/
@FunctionalInterface
public interface ClusterInfoService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@

/**
* Configures classes and services that affect the entire cluster.
*
* @opensearch.internal
*/
public class ClusterModule extends AbstractModule {

Expand Down
5 changes: 5 additions & 0 deletions server/src/main/java/org/opensearch/cluster/ClusterName.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
import java.util.Objects;
import java.util.function.Predicate;

/**
* Cluster Name
*
* @opensearch.internal
*/
public class ClusterName implements Writeable {

public static final Setting<ClusterName> CLUSTER_NAME_SETTING = new Setting<>("cluster.name", "opensearch", (s) -> {
Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/cluster/ClusterState.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@
* make sure that the correct diffs are applied. If uuids don’t match, the {@link ClusterStateDiff#apply} method
* throws the {@link IncompatibleClusterStateVersionException}, which causes the publishing mechanism to send
* a full version of the cluster state to the node on which this exception was thrown.
*
* @opensearch.internal
*/
public class ClusterState implements ToXContentFragment, Diffable<ClusterState> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
/**
* A component that is in charge of applying an incoming cluster state to the node internal data structures.
* The single apply method is called before the cluster state becomes visible via {@link ClusterService#state()}.
*
* @opensearch.internal
*/
public interface ClusterStateApplier {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
/**
* A listener to be notified when a cluster state changes.
*
*
* @opensearch.internal
*/
public interface ClusterStateListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
* A utility class which simplifies interacting with the cluster state in cases where
* one tries to take action based on the current state but may want to wait for a new state
* and retry upon failure.
*
* @opensearch.internal
*/
public class ClusterStateObserver {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

/**
* Cluster state update task configuration for timeout and priority
*
* @opensearch.internal
*/
public interface ClusterStateTaskConfig {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
import java.util.List;
import java.util.Map;

/**
* Interface that updates the cluster state based on the task
*
* @opensearch.internal
*/
public interface ClusterStateTaskExecutor<T> {
/**
* Update the cluster state based on the current state and the given tasks. Return the *same instance* if no state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@

import java.util.List;

/**
* Interface to implement a cluster state change listener
*
* @opensearch.internal
*/
public interface ClusterStateTaskListener {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

/**
* A task that can update the cluster state.
*
* @opensearch.internal
*/
public abstract class ClusterStateUpdateTask
implements
Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/cluster/Diff.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

/**
* Represents difference between states of cluster state parts
*
* @opensearch.internal
*/
public interface Diff<T> extends Writeable {

Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/cluster/Diffable.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

/**
* Cluster state part, changes in which can be serialized
*
* @opensearch.internal
*/
public interface Diffable<T> extends Writeable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
import java.util.Map;
import java.util.Set;

/**
* Utility class for a diffable
*
* @opensearch.internal
*/
public final class DiffableUtils {
private DiffableUtils() {}

Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/cluster/DiskUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@

/**
* Encapsulation class used to represent the amount of disk used on a node.
*
* @opensearch.internal
*/
public class DiskUsage implements ToXContentFragment, Writeable {
final String nodeId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

/**
* {@link ClusterInfoService} that provides empty maps for disk usage and shard sizes
*
* @opensearch.internal
*/
public class EmptyClusterInfoService implements ClusterInfoService {
public static final EmptyClusterInfoService INSTANCE = new EmptyClusterInfoService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

/**
* Thrown by {@link Diff#apply} method
*
* @opensearch.internal
*/
public class IncompatibleClusterStateVersionException extends OpenSearchException {
public IncompatibleClusterStateVersionException(String msg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
*
* Every time the timer runs, gathers information about the disk usage and
* shard sizes across the cluster.
*
* @opensearch.internal
*/
public class InternalClusterInfoService implements ClusterInfoService, ClusterStateListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
import java.util.List;

/**
* Used to apply state updates on nodes that are not necessarily master
* Used to apply state updates on nodes that are not necessarily cluster-manager
*
* @opensearch.internal
*/
public abstract class LocalClusterUpdateTask
implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@
package org.opensearch.cluster;

/**
* Enables listening to master changes events of the local node (when the local node becomes the master, and when the local
* node cease being a master).
* Enables listening to cluster-manager changes events of the local node (when the local node becomes the cluster-manager, and when the local
* node cease being a cluster-manager).
*
* @opensearch.internal
*/
public interface LocalNodeMasterListener extends ClusterStateListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@

import java.util.function.Predicate;

/**
* Utility class to build a predicate that accepts cluster state changes
*
* @opensearch.internal
*/
public final class MasterNodeChangePredicate {

private MasterNodeChangePredicate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
* Custom metadata can be merged using {@link #merge(Metadata.Custom)}.
*
* @param <T> type of custom meta data
*
* @opensearch.internal
*/
public interface MergableCustomMetadata<T extends Metadata.Custom> {

Expand Down
2 changes: 2 additions & 0 deletions server/src/main/java/org/opensearch/cluster/NamedDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

/**
* Diff that also support NamedWriteable interface
*
* @opensearch.internal
*/
public interface NamedDiff<T extends Diffable<T>> extends Diff<T>, NamedWriteable {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@

/**
* Diff that also support {@link VersionedNamedWriteable} interface
*
* @opensearch.internal
*/
public interface NamedDiffable<T> extends Diffable<T>, VersionedNamedWriteable {}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

/**
* Value Serializer for named diffables
*
* @opensearch.internal
*/
public class NamedDiffableValueSerializer<T extends NamedDiffable<T>> extends DiffableUtils.DiffableValueSerializer<String, T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
* <p>
* This component does not block on disconnections at all, because a disconnection might need to wait for an ongoing (background) connection
* attempt to complete first.
*
* @opensearch.internal
*/
public class NodeConnectionsService extends AbstractLifecycleComponent {
private static final Logger logger = LogManager.getLogger(NodeConnectionsService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
import java.io.IOException;

/**
* Thrown when a node join request or a master ping reaches a node which is not
* currently acting as a master or when a cluster state update task is to be executed
* on a node that is no longer master.
* Thrown when a node join request or a cluster-manager ping reaches a node which is not
* currently acting as a cluster-manager or when a cluster state update task is to be executed
* on a node that is no longer cluster-manager.
*
* @opensearch.internal
*/
public class NotMasterException extends OpenSearchException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
import java.util.Collections;
import java.util.List;

/**
* Information passed during repository cleanup
*
* @opensearch.internal
*/
public final class RepositoryCleanupInProgress extends AbstractNamedDiffable<ClusterState.Custom> implements ClusterState.Custom {

public static final RepositoryCleanupInProgress EMPTY = new RepositoryCleanupInProgress(Collections.emptyList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

/**
* Meta data about restore processes that are currently executing
*
* @opensearch.internal
*/
public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements Custom, Iterable<RestoreInProgress.Entry> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@

/**
* A class that represents the snapshot deletions that are in progress in the cluster.
*
* @opensearch.internal
*/
public class SnapshotDeletionsInProgress extends AbstractNamedDiffable<Custom> implements Custom {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@

/**
* Meta data about snapshots that are currently executing
*
* @opensearch.internal
*/
public class SnapshotsInProgress extends AbstractNamedDiffable<Custom> implements Custom {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/**
* An exception to cluster state listener that allows for timeouts and for post added notifications.
*
*
* @opensearch.internal
*/
public interface TimeoutClusterStateListener extends ClusterStateListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

/**
* Identifies a cluster state update request with acknowledgement support
*
* @opensearch.internal
*/
public interface AckedRequest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
/**
* Base class to be used when needing to update the cluster state
* Contains the basic fields that are always needed
*
* @opensearch.internal
*/
public abstract class ClusterStateUpdateRequest<T extends ClusterStateUpdateRequest<T>> implements AckedRequest {

Expand Down
Loading

0 comments on commit f82510d

Please sign in to comment.