Skip to content

Commit

Permalink
Adding support for handling multiple transport protocols (opensearch-…
Browse files Browse the repository at this point in the history
…project#12967)

* Adding support for more than one protocol for transport

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Adding CHANGELOG entry

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Addressing comments

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Addressing comments

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Removing determineTransportProtocol

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Determine transport protocol only on first byte reference

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Making InboundBytesHandler closeable

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixing close() for InboundPipeline

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Adding DeprecatedAPI annotation to japicmp task

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixing for detect breaking changes workflow

Signed-off-by: Vacha Shah <vachshah@amazon.com>

* Fixing recursion

Signed-off-by: Vacha Shah <vachshah@amazon.com>

---------

Signed-off-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
VachaShah committed Apr 8, 2024
1 parent e68754c commit 5580bbf
Show file tree
Hide file tree
Showing 18 changed files with 1,010 additions and 570 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 5580bbf

Please sign in to comment.