Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed Jun 10, 2024
1 parent 2b37896 commit aea22d9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ class ReactorNetty4HttpChunk implements HttpChunk {
private final boolean last;

ReactorNetty4HttpChunk(ByteBuf content, boolean last) {
this(new AtomicBoolean(false), true, content, last);
}

private ReactorNetty4HttpChunk(AtomicBoolean released, boolean pooled, ByteBuf content, boolean last) {
this.content = content;
this.pooled = pooled;
this.released = released;
this.pooled = true;
this.released = new AtomicBoolean(false);
this.last = last;
}

Expand Down
6 changes: 4 additions & 2 deletions server/src/main/java/org/opensearch/http/HttpChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

package org.opensearch.http;

import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.common.lease.Releasable;
import org.opensearch.core.common.bytes.BytesReference;

/**
* Represents a chunk of the HTTP request / response stream
*
* @opensearch.experimental
*/
@PublicApi(since = "2.15.0")
@ExperimentalApi
public interface HttpChunk extends Releasable {
/**
* Signals this is the last chunk of the stream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.opensearch.http;

import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.core.action.ActionListener;

import java.util.List;
Expand All @@ -19,9 +19,9 @@
/**
* Represents an HTTP communication channel with streaming capabilities.
*
* @opensearch.api
* @opensearch.experimental
*/
@PublicApi(since = "2.15.0")
@ExperimentalApi
public interface StreamingHttpChannel extends HttpChannel, Publisher<HttpChunk> {
/**
* Sends the next {@link HttpChunk} to the response stream
Expand Down
5 changes: 3 additions & 2 deletions server/src/main/java/org/opensearch/rest/BaseRestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.opensearch.action.support.clustermanager.ClusterManagerNodeRequest;
import org.opensearch.client.node.NodeClient;
import org.opensearch.common.CheckedConsumer;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.logging.DeprecationLogger;
Expand Down Expand Up @@ -204,10 +205,10 @@ protected interface RestChannelConsumer extends CheckedConsumer<RestChannel, Exc
* Streaming REST requests are handled by preparing a streaming channel consumer that represents the execution of
* the request against a channel.
*
* @opensearch.api
* @opensearch.experimental
*/
@FunctionalInterface
@PublicApi(since = "2.15.0")
@ExperimentalApi
protected interface StreamingRestChannelConsumer extends CheckedConsumer<StreamingRestChannel, Exception> {}

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

package org.opensearch.rest;

import org.opensearch.common.annotation.PublicApi;
import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.core.rest.RestStatus;
import org.opensearch.http.HttpChunk;

Expand All @@ -20,9 +20,9 @@
/**
* A streaming channel used to prepare response and sending the response in chunks.
*
* @opensearch.api
* @opensearch.experimental
*/
@PublicApi(since = "2.15.0")
@ExperimentalApi
public interface StreamingRestChannel extends RestChannel, Publisher<HttpChunk> {
/**
* Sends the next {@link HttpChunk} to the response stream
Expand Down

0 comments on commit aea22d9

Please sign in to comment.