Skip to content

Commit

Permalink
[Backport 2.x] Adding support for handling multiple transport protoco…
Browse files Browse the repository at this point in the history
…ls (#12967) (#13125)

* Adding support for handling multiple transport protocols (#12967)

* Adding support for more than one protocol for transport

Signed-off-by: Vacha Shah <[email protected]>

* Adding CHANGELOG entry

Signed-off-by: Vacha Shah <[email protected]>

* Addressing comments

Signed-off-by: Vacha Shah <[email protected]>

* Addressing comments

Signed-off-by: Vacha Shah <[email protected]>

* Removing determineTransportProtocol

Signed-off-by: Vacha Shah <[email protected]>

* Determine transport protocol only on first byte reference

Signed-off-by: Vacha Shah <[email protected]>

* Making InboundBytesHandler closeable

Signed-off-by: Vacha Shah <[email protected]>

* Fixing close() for InboundPipeline

Signed-off-by: Vacha Shah <[email protected]>

* Adding DeprecatedAPI annotation to japicmp task

Signed-off-by: Vacha Shah <[email protected]>

* Fixing for detect breaking changes workflow

Signed-off-by: Vacha Shah <[email protected]>

* Fixing recursion

Signed-off-by: Vacha Shah <[email protected]>

---------

Signed-off-by: Vacha Shah <[email protected]>

* Fixing precommit for 2.x

Signed-off-by: Vacha Shah <[email protected]>

---------

Signed-off-by: Vacha Shah <[email protected]>
  • Loading branch information
VachaShah authored Apr 9, 2024
1 parent e68754c commit 1dde447
Show file tree
Hide file tree
Showing 19 changed files with 1,011 additions and 571 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Detect breaking changes on pull requests ([#9044](https://github.com/opensearch-project/OpenSearch/pull/9044))
- Add cluster primary balance contraint for rebalancing with buffer ([#12656](https://github.com/opensearch-project/OpenSearch/pull/12656))
- Derived fields support to derive field values at query time without indexing ([#12569](https://github.com/opensearch-project/OpenSearch/pull/12569))
- Add support for more than one protocol for transport ([#12967](https://github.com/opensearch-project/OpenSearch/pull/12967))

### Dependencies
- Bump `org.apache.commons:commons-configuration2` from 2.10.0 to 2.10.1 ([#12896](https://github.com/opensearch-project/OpenSearch/pull/12896))
Expand Down
2 changes: 1 addition & 1 deletion server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ tasks.register("japicmp", me.champeau.gradle.japicmp.JapicmpTask) {
onlyModified = true
failOnModification = true
ignoreMissingClasses = true
annotationIncludes = ['@org.opensearch.common.annotation.PublicApi']
annotationIncludes = ['@org.opensearch.common.annotation.PublicApi', '@org.opensearch.common.annotation.DeprecatedApi']
txtOutputFile = layout.buildDirectory.file("reports/java-compatibility/report.txt")
htmlOutputFile = layout.buildDirectory.file("reports/java-compatibility/report.html")
dependsOn downloadSnapshot
Expand Down
8 changes: 4 additions & 4 deletions server/src/main/java/org/opensearch/transport/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ public int getNetworkMessageSize() {
return networkMessageSize;
}

Version getVersion() {
public Version getVersion() {
return version;
}

long getRequestId() {
public long getRequestId() {
return requestId;
}

byte getStatus() {
return status;
}

boolean isRequest() {
public boolean isRequest() {
return TransportStatus.isRequest(status);
}

Expand All @@ -99,7 +99,7 @@ boolean isError() {
return TransportStatus.isError(status);
}

boolean isHandshake() {
public boolean isHandshake() {
return TransportStatus.isHandshake(status);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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.
*/

package org.opensearch.transport;

import org.opensearch.common.bytes.ReleasableBytesReference;

import java.io.Closeable;
import java.io.IOException;
import java.util.function.BiConsumer;

/**
* Interface for handling inbound bytes. Can be implemented by different transport protocols.
*/
public interface InboundBytesHandler extends Closeable {

public void doHandleBytes(
TcpChannel channel,
ReleasableBytesReference reference,
BiConsumer<TcpChannel, ProtocolInboundMessage> messageHandler
) throws IOException;

public boolean canHandleBytes(ReleasableBytesReference reference);

@Override
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
*/
public class InboundDecoder implements Releasable {

static final Object PING = new Object();
static final Object END_CONTENT = new Object();
public static final Object PING = new Object();
public static final Object END_CONTENT = new Object();

private final Version version;
private final PageCacheRecycler recycler;
Expand Down
Loading

0 comments on commit 1dde447

Please sign in to comment.