Skip to content

Commit

Permalink
Fixing for detect breaking changes workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Vacha Shah <[email protected]>
  • Loading branch information
VachaShah committed Apr 5, 2024
1 parent 398f286 commit 8a90d0e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.opensearch.core.common.io.stream.NamedWriteableRegistry;
import org.opensearch.telemetry.tracing.Tracer;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.nativeprotocol.NativeInboundMessage;

import java.io.IOException;
import java.util.Map;
Expand Down Expand Up @@ -67,7 +68,7 @@ public class InboundHandler {
) {
this.threadPool = threadPool;
this.protocolMessageHandlers = Map.of(
ProtocolInboundMessage.NATIVE_PROTOCOL,
NativeInboundMessage.NATIVE_PROTOCOL,
new NativeMessageHandler(
threadPool,
outboundHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,9 @@ public String toString() {
return this.nativeInboundMessage.toString();
}

@Override
public String getProtocol() {
return this.nativeInboundMessage.getProtocol();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,20 @@

package org.opensearch.transport;

import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.common.annotation.PublicApi;

/**
* Base class for inbound data as a message.
* Different implementations are used for different protocols.
*
* @opensearch.internal
*/
@ExperimentalApi
@PublicApi(since = "2.14.0")
public interface ProtocolInboundMessage {

/**
* The protocol used to encode this message
*/
static String NATIVE_PROTOCOL = "native";
static String PROTOBUF_PROTOCOL = "protobuf";

/**
* @return the protocol used to encode this message
*/
default public String getProtocol() {
return NATIVE_PROTOCOL;
}
public String getProtocol();

}
12 changes: 12 additions & 0 deletions server/src/main/java/org/opensearch/transport/TcpTransport.java
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,18 @@ protected void serverAcceptedChannel(TcpChannel channel) {
*/
protected abstract void stopInternal();

/**
* @deprecated use {@link #inboundMessage(TcpChannel, ProtocolInboundMessage)}
* Handles inbound message that has been decoded.
*
* @param channel the channel the message is from
* @param message the message
*/
@Deprecated(since = "2.14.0", forRemoval = true)
public void inboundMessage(TcpChannel channel, InboundMessage message) {
inboundMessage(channel, message);
}

/**
* Handles inbound message that has been decoded.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@
*
* @opensearch.api
*/
@PublicApi(since = "3.0.0")
@PublicApi(since = "2.14.0")
public class NativeInboundMessage implements Releasable, ProtocolInboundMessage {

/**
* The protocol used to encode this message
*/
public static String NATIVE_PROTOCOL = "native";

private final Header header;
private final ReleasableBytesReference content;
private final Exception exception;
Expand Down Expand Up @@ -82,6 +87,11 @@ public NativeInboundMessage(Header header, boolean isPing) {
this.isPing = isPing;
}

@Override
public String getProtocol() {
return NATIVE_PROTOCOL;
}

public Header getHeader() {
return header;
}
Expand Down

0 comments on commit 8a90d0e

Please sign in to comment.