Skip to content

Commit

Permalink
Adding support for handling multiple transport protocols (#12967)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
VachaShah authored Apr 8, 2024
1 parent 9b0f578 commit d202d90
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 @@ -114,6 +114,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add cluster primary balance contraint for rebalancing with buffer ([#12656](https://github.com/opensearch-project/OpenSearch/pull/12656))
- [Remote Store] Make translog transfer timeout configurable ([#12704](https://github.com/opensearch-project/OpenSearch/pull/12704))
- Reject Resize index requests (i.e, split, shrink and clone), While DocRep to SegRep migration is in progress.([#12686](https://github.com/opensearch-project/OpenSearch/pull/12686))
- 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 @@ -387,7 +387,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 d202d90

Please sign in to comment.