Skip to content

Commit

Permalink
[Javadocs] add to internal classes in o.o.http, indices, and search (o…
Browse files Browse the repository at this point in the history
…pensearch-project#3288)

Adds javadocs to internal classes in org.opensearch.http, indices, and search
packages.

Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
nknize committed May 13, 2022
1 parent 9ef0f6e commit 739aa79
Show file tree
Hide file tree
Showing 193 changed files with 1,472 additions and 19 deletions.
5 changes: 5 additions & 0 deletions server/src/main/java/org/opensearch/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public class Build {
*/
public static final Build CURRENT;

/**
* The type of build
*
* @opensearch.internal
*/
public enum Type {

DEB("deb"),
Expand Down
5 changes: 5 additions & 0 deletions server/src/main/java/org/opensearch/http/CorsHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ private void setMaxAge(final HttpResponse response) {
response.addHeader(ACCESS_CONTROL_MAX_AGE, Long.toString(config.maxAge));
}

/**
* The cors handler configuration
*
* @opensearch.internal
*/
public static class Config {

private final boolean enabled;
Expand Down
5 changes: 5 additions & 0 deletions server/src/main/java/org/opensearch/http/HttpRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
*/
public interface HttpRequest {

/**
* Which HTTP version being used
*
* @opensearch.internal
*/
enum HttpVersion {
HTTP_1_0,
HTTP_1_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ private void recordOperationBytes(Engine.Operation operation, Engine.Result resu
}
}

/**
* The bytes used by a shard and a reference to the shard
*
* @opensearch.internal
*/
private static final class ShardAndBytesUsed implements Comparable<ShardAndBytesUsed> {
final long bytesUsed;
final IndexShard shard;
Expand Down
10 changes: 10 additions & 0 deletions server/src/main/java/org/opensearch/indices/IndicesQueryCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ public void close() {
cache.clear();
}

/**
* Statistics for the indices query cache
*
* @opensearch.internal
*/
private static class Stats implements Cloneable {

final ShardId shardId;
Expand Down Expand Up @@ -251,6 +256,11 @@ public String toString() {
}
}

/**
* Statistics and Counts
*
* @opensearch.internal
*/
private static class StatsAndCount {
volatile int count;
final Stats stats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ void invalidate(CacheEntity cacheEntity, DirectoryReader reader, BytesReference
cache.invalidate(new Key(cacheEntity, reader.getReaderCacheHelper().getKey(), cacheKey));
}

/**
* Loader for the request cache
*
* @opensearch.internal
*/
private static class Loader implements CacheLoader<Key, BytesReference> {

private final CacheEntity entity;
Expand Down Expand Up @@ -238,6 +243,11 @@ interface CacheEntity extends Accountable {
void onRemoval(RemovalNotification<Key, BytesReference> notification);
}

/**
* Unique key for the cache
*
* @opensearch.internal
*/
static class Key implements Accountable {
private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(Key.class);

Expand Down
17 changes: 17 additions & 0 deletions server/src/main/java/org/opensearch/indices/IndicesService.java
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,11 @@ public IndicesQueryCache getIndicesQueryCache() {
return indicesQueryCache;
}

/**
* Statistics for old shards
*
* @opensearch.internal
*/
static class OldShardsStats implements IndexEventListener {

final SearchStats searchStats = new SearchStats();
Expand Down Expand Up @@ -1236,6 +1241,11 @@ private void addPendingDelete(Index index, PendingDelete pendingDelete) {
}
}

/**
* A pending delete
*
* @opensearch.internal
*/
private static final class PendingDelete implements Comparable<PendingDelete> {
final Index index;
final int shardId;
Expand Down Expand Up @@ -1386,6 +1396,8 @@ public AnalysisRegistry getAnalysis() {
* periodically. In this case it is the field data cache, because a cache that
* has an entry invalidated may not clean up the entry if it is not read from
* or written to after invalidation.
*
* @opensearch.internal
*/
private static final class CacheCleaner implements Runnable, Releasable {

Expand Down Expand Up @@ -1574,6 +1586,11 @@ private BytesReference cacheShardLevelResult(
return indicesRequestCache.getOrCompute(cacheEntity, supplier, reader, cacheKey);
}

/**
* An item in the index shard cache
*
* @opensearch.internal
*/
static final class IndexShardCacheEntity extends AbstractIndexShardCacheEntity {
private static final long BASE_RAM_BYTES_USED = RamUsageEstimator.shallowSizeOfInstance(IndexShardCacheEntity.class);
private final IndexShard indexShard;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ public List<IndexShardStats> getShardStats(Index index) {
}
}

/**
* Fields used for parsing and toXContent
*
* @opensearch.internal
*/
static final class Fields {
static final String INDICES = "indices";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public enum CachingStrategy {
OPENSEARCH
}

/**
* The prebuilt cache
*
* @opensearch.internal
*/
public interface PreBuiltCache<T> {

T get(Version version);
Expand All @@ -86,6 +91,8 @@ public static <T> PreBuiltCache<T> getCache(CachingStrategy cachingStrategy) {

/**
* This is a pretty simple cache, it only contains one version
*
* @opensearch.internal
*/
private static class PreBuiltCacheStrategyOne<T> implements PreBuiltCache<T> {

Expand All @@ -109,6 +116,8 @@ public Collection<T> values() {

/**
* This cache contains one version for each opensearch version object
*
* @opensearch.internal
*/
private static class PreBuiltCacheStrategyOpenSearch<T> implements PreBuiltCache<T> {

Expand All @@ -132,6 +141,8 @@ public Collection<T> values() {

/**
* This cache uses the lucene version for caching
*
* @opensearch.internal
*/
private static class PreBuiltCacheStrategyLucene<T> implements PreBuiltCache<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
return builder;
}

/**
* Fields used for parsing and toXContent
*
* @opensearch.internal
*/
static final class Fields {
static final String BREAKERS = "breakers";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public String toString() {
+ "]";
}

/**
* Fields used for statistics
*
* @opensearch.internal
*/
static final class Fields {
static final String LIMIT = "limit_size_in_bytes";
static final String LIMIT_HUMAN = "limit_size";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ public CircuitBreakerStats stats(String name) {
);
}

/**
* Tracks memory usage
*
* @opensearch.internal
*/
static class MemoryUsage {
final long baseUsage;
final long totalUsage;
Expand Down Expand Up @@ -505,6 +510,11 @@ interface OverLimitStrategy {
MemoryUsage overLimit(MemoryUsage memoryUsed);
}

/**
* Kicks in G1GC if heap gets too high
*
* @opensearch.internal
*/
static class G1OverLimitStrategy implements OverLimitStrategy {
private final long g1RegionSize;
private final LongSupplier currentMemoryUsageSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,11 @@ public void accept(final IndexShard.ShardFailure shardFailure) {
}
}

/**
* A shard
*
* @opensearch.internal
*/
public interface Shard {

/**
Expand Down Expand Up @@ -890,6 +895,11 @@ void updateShardState(
) throws IOException;
}

/**
* An allocated index
*
* @opensearch.internal
*/
public interface AllocatedIndex<T extends Shard> extends Iterable<T>, IndexComponent {

/**
Expand Down Expand Up @@ -922,6 +932,11 @@ public interface AllocatedIndex<T extends Shard> extends Iterable<T>, IndexCompo
void removeShard(int shardId, String message);
}

/**
* Allocated indices
*
* @opensearch.internal
*/
public interface AllocatedIndices<T extends Shard, U extends AllocatedIndex<T>> extends Iterable<U> {

/**
Expand Down Expand Up @@ -1008,6 +1023,11 @@ default T getShardOrNull(ShardId shardId) {
void processPendingDeletes(Index index, IndexSettings indexSettings, TimeValue timeValue) throws IOException, InterruptedException,
ShardLockObtainFailedException;

/**
* Why the index was removed
*
* @opensearch.internal
*/
enum IndexRemovalReason {
/**
* Shard of this index were previously assigned to this node but all shards have been relocated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public void onRemoval(RemovalNotification<Key, Accountable> notification) {
}
}

/**
* Computes a weight based on ramBytesUsed
*
* @opensearch.internal
*/
public static class FieldDataWeigher implements ToLongBiFunction<Key, Accountable> {
@Override
public long applyAsLong(Key key, Accountable ramUsage) {
Expand All @@ -135,6 +140,8 @@ public long applyAsLong(Key key, Accountable ramUsage) {

/**
* A specific cache instance for the relevant parameters of it (index, fieldNames, fieldType).
*
* @opensearch.internal
*/
static class IndexFieldCache implements IndexFieldDataCache, IndexReader.ClosedListener {
private final Logger logger;
Expand Down Expand Up @@ -242,6 +249,11 @@ public void clear(String fieldName) {
}
}

/**
* Key for the indices field data cache
*
* @opensearch.internal
*/
public static class Key {
public final IndexFieldCache indexCache;
public final IndexReader.CacheKey readerKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ protected void onNewResource(Source resource) throws IOException {

protected abstract void handleError(Source resource, Exception e) throws Exception;

/**
* A file chunk item as the response
*
* @opensearch.internal
*/
private static class FileChunkResponseItem<Source> {
final long requestSeqId;
final Source source;
Expand All @@ -223,6 +228,11 @@ private static class FileChunkResponseItem<Source> {
}
}

/**
* A chunk request
*
* @opensearch.internal
*/
public interface ChunkRequest {
/**
* @return {@code true} if this chunk request is the last chunk of the current file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ public void renameAllTempFiles() throws IOException {
store.renameTempFilesSafe(tempFileNames);
}

/**
* A file chunk
*
* @opensearch.internal
*/
static final class FileChunk {
final StoreFileMetadata md;
final BytesReference content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public class PeerRecoverySourceService extends AbstractLifecycleComponent implem

private static final Logger logger = LogManager.getLogger(PeerRecoverySourceService.class);

/**
* The internal actions
*
* @opensearch.internal
*/
public static class Actions {
public static final String START_RECOVERY = "internal:index/shard/recovery/start_recovery";
public static final String REESTABLISH_RECOVERY = "internal:index/shard/recovery/reestablish_recovery";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public class PeerRecoveryTargetService implements IndexEventListener {

private static final Logger logger = LogManager.getLogger(PeerRecoveryTargetService.class);

/**
* The internal actions
*
* @opensearch.internal
*/
public static class Actions {
public static final String FILES_INFO = "internal:index/shard/recovery/filesInfo";
public static final String FILE_CHUNK = "internal:index/shard/recovery/file_chunk";
Expand Down Expand Up @@ -338,6 +343,11 @@ public static StartRecoveryRequest getStartRecoveryRequest(
return request;
}

/**
* The recovery listener
*
* @opensearch.internal
*/
public interface RecoveryListener {
void onRecoveryDone(RecoveryState state);

Expand Down
Loading

0 comments on commit 739aa79

Please sign in to comment.