Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Adding support for handling multiple transport protocols (#12967) #13125

Merged
merged 2 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading