Skip to content

Commit

Permalink
[Javadocs] add remaining internal classes and reenable missingJavadoc…
Browse files Browse the repository at this point in the history
… on server (opensearch-project#3296)

Adds the remaining javadocs to internal classes and reenables the missingJavadoc
gradle task on the server module. From here forward if class level javadocs are
missing in the server module, gradle check will fail!

Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
nknize committed May 14, 2022
1 parent 9aa0dbe commit 31f06ed
Show file tree
Hide file tree
Showing 184 changed files with 1,608 additions and 14 deletions.
5 changes: 2 additions & 3 deletions gradle/missing-javadoc.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ configure([

configure(project(":server")) {
project.tasks.withType(MissingJavadocTask) {
isExcluded = true
// TODO: reenable after fixing missing javadocs
// javadocMissingLevel = "class"
// TODO: bump to variable missing level after increasing javadoc coverage
javadocMissingLevel = "class"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ default boolean includeDataStreams() {
return false;
}

/**
* Replaceable interface.
*
* @opensearch.internal
*/
interface Replaceable extends IndicesRequest {
/**
* Sets the indices that the action relates to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ public ActionRequestValidationException validate() {
return null;
}

/**
* The level of the health request.
*
* @opensearch.internal
*/
public enum Level {
CLUSTER,
INDICES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ public static class AliasActions implements AliasesRequest, Writeable, ToXConten
private static final ParseField REMOVE = new ParseField("remove");
private static final ParseField REMOVE_INDEX = new ParseField("remove_index");

/**
* The type of request.
*
* @opensearch.internal
*/
public enum Type {
ADD((byte) 0, AliasActions.ADD),
REMOVE((byte) 1, AliasActions.REMOVE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
* @opensearch.internal
*/
public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
/**
* The features to get.
*
* @opensearch.internal
*/
public enum Feature {
ALIASES((byte) 0),
MAPPINGS((byte) 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ public CommonStatsFlags clone() {
}
}

/**
* The flags.
*
* @opensearch.internal
*/
public enum Flag {
Store("store", 0),
Indexing("indexing", 1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ protected void doExecute(Task task, SearchRequest searchRequest, ActionListener<
executeRequest(task, searchRequest, this::searchAsyncAction, listener);
}

/**
* The single phase search action.
*
* @opensearch.internal
*/
public interface SinglePhaseSearchAction {
void executeOnShardTarget(
SearchTask searchTask,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
*/
public class IndicesOptions implements ToXContentFragment {

/**
* The wildcard states.
*
* @opensearch.internal
*/
public enum WildcardStates {
OPEN,
CLOSED,
Expand Down Expand Up @@ -120,6 +125,11 @@ private static void updateSetForValue(EnumSet<WildcardStates> states, String wil
}
}

/**
* The options.
*
* @opensearch.internal
*/
public enum Option {
IGNORE_UNAVAILABLE,
IGNORE_ALIASES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ default R setRefreshPolicy(String refreshPolicy) {

ActionRequestValidationException validate();

/**
* The refresh policy of the request.
*
* @opensearch.internal
*/
enum RefreshPolicy implements Writeable {
/**
* Don't refresh after this request. The default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,11 @@ public RetryOnPrimaryException(StreamInput in) throws IOException {
}
}

/**
* The result of the primary.
*
* @opensearch.internal
*/
public interface PrimaryResult<RequestT extends ReplicationRequest<RequestT>> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,11 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeLong(version);
}

/**
* The flags.
*
* @opensearch.internal
*/
public enum Flag {
// Do not change the order of these flags we use
// the ordinal for encoding! Only append to the end!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

/** jvm specific bootstrapping */
package org.opensearch.bootstrap.jvm;
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public static <T extends Diffable<T>> Diff<T> readDiffFrom(Reader<T> reader, Str
return (Diff<T>) EMPTY;
}

/**
* A complete diff.
*
* @opensearch.internal
*/
private static class CompleteDiff<T extends Diffable<T>> implements Diff<T> {

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public static <T extends NamedDiffable<T>> NamedDiff<T> readDiffFrom(Class<? ext
return new CompleteNamedDiff<>(tClass, name, in);
}

/**
* A complete named diff.
*
* @opensearch.internal
*/
private static class CompleteNamedDiff<T extends NamedDiffable<T>> implements NamedDiff<T> {

@Nullable
Expand Down
9 changes: 9 additions & 0 deletions server/src/main/java/org/opensearch/cluster/ClusterInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ static String shardIdentifierFromRouting(ShardRouting shardRouting) {

/**
* Represents a data path on a node
*
* @opensearch.internal
*/
public static class NodeAndPath implements Writeable {
public final String nodeId;
Expand Down Expand Up @@ -281,6 +283,8 @@ public void writeTo(StreamOutput out) throws IOException {

/**
* Represents the total amount of "reserved" space on a particular data path, together with the set of shards considered.
*
* @opensearch.internal
*/
public static class ReservedSpace implements Writeable {

Expand Down Expand Up @@ -344,6 +348,11 @@ void toXContent(XContentBuilder builder, Params params) throws IOException {
builder.endArray(); // end "shards"
}

/**
* Builder for Reserved Space.
*
* @opensearch.internal
*/
public static class Builder {
private long total;
private ObjectHashSet<ShardId> shardIds = new ObjectHashSet<>();
Expand Down
22 changes: 22 additions & 0 deletions server/src/main/java/org/opensearch/cluster/ClusterState.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ public class ClusterState implements ToXContentFragment, Diffable<ClusterState>

/**
* An interface that implementors use when a class requires a client to maybe have a feature.
*
* @opensearch.internal
*/
public interface FeatureAware {

Expand Down Expand Up @@ -135,6 +137,11 @@ static <T extends VersionedNamedWriteable & FeatureAware> boolean shouldSerializ

}

/**
* Custom cluster state.
*
* @opensearch.internal
*/
public interface Custom extends NamedDiffable<Custom>, ToXContentFragment, FeatureAware {

/**
Expand Down Expand Up @@ -402,6 +409,11 @@ public boolean supersedes(ClusterState other) {

}

/**
* Metrics for cluster state.
*
* @opensearch.internal
*/
public enum Metric {
VERSION("version"),

Expand Down Expand Up @@ -581,6 +593,11 @@ public static Builder builder(ClusterState state) {
return new Builder(state);
}

/**
* Builder for cluster state.
*
* @opensearch.internal
*/
public static class Builder {

private final ClusterName clusterName;
Expand Down Expand Up @@ -777,6 +794,11 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(minimumMasterNodesOnPublishingMaster);
}

/**
* The cluster state diff.
*
* @opensearch.internal
*/
private static class ClusterStateDiff implements Diff<ClusterState> {

private final long toVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ public void waitForNextChange(Listener listener, Predicate<ClusterState> statePr
}
}

/**
* An observer of the cluster state for changes.
*
* @opensearch.internal
*/
class ObserverClusterStateListener implements TimeoutClusterStateListener {

@Override
Expand Down Expand Up @@ -297,7 +302,9 @@ public String toString() {
}

/**
* The observer considers two cluster states to be the same if they have the same version and master node id (i.e. null or set)
* The observer considers two cluster states to be the same if they have the same version and cluster-manager node id (i.e. null or set)
*
* @opensearch.internal
*/
private static class StoredState {
private final String masterNodeId;
Expand All @@ -316,6 +323,11 @@ public boolean isOlderOrDifferentMaster(ClusterState clusterState) {
}
}

/**
* Listener for the observer.
*
* @opensearch.internal
*/
public interface Listener {

/** called when a new state is observed */
Expand All @@ -327,6 +339,11 @@ public interface Listener {
void onTimeout(TimeValue timeout);
}

/**
* Context for the observer.
*
* @opensearch.internal
*/
static class ObservingContext {
public final Listener listener;
public final Predicate<ClusterState> statePredicate;
Expand All @@ -342,6 +359,11 @@ public String toString() {
}
}

/**
* A context preserving listener.
*
* @opensearch.internal
*/
private static final class ContextPreservingListener implements Listener {
private final Listener delegate;
private final Supplier<ThreadContext.StoredContext> contextSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ static ClusterStateTaskConfig build(Priority priority, TimeValue timeout) {
return new Basic(priority, timeout);
}

/**
* Basic task config.
*
* @opensearch.internal
*/
class Basic implements ClusterStateTaskConfig {
final TimeValue timeout;
final Priority priority;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ default String describeTasks(List<T> tasks) {
/**
* Represents the result of a batched execution of cluster state update tasks
* @param <T> the type of the cluster state update task
*
* @opensearch.internal
*/
class ClusterTasksResult<T> {
@Nullable
Expand All @@ -101,6 +103,11 @@ public static <T> Builder<T> builder() {
return new Builder<>();
}

/**
* Builder for cluster state task.
*
* @opensearch.internal
*/
public static class Builder<T> {
private final Map<T, TaskResult> executionResults = new IdentityHashMap<>();

Expand Down Expand Up @@ -142,6 +149,11 @@ ClusterTasksResult<T> build(ClusterTasksResult<T> result, ClusterState previousS
}
}

/**
* The task result.
*
* @opensearch.internal
*/
final class TaskResult {
private final Exception failure;

Expand Down
Loading

0 comments on commit 31f06ed

Please sign in to comment.