-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Cat Nodes API with Protobuf #9097
Closed
VachaShah
wants to merge
38
commits into
opensearch-project:main
from
VachaShah:poc-cat-nodes-protobuf
Closed
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
9be33d7
Adding BaseWriteable and ProtobufWriteable
VachaShah 0034b0a
Adding proto messages for TaskId and TaskResourceStats
VachaShah cdb6806
Adding Task related classes with protobuf integration
VachaShah c8c2f53
Adding ProtobufStreamInput and ProtobufStreamOutput for additional st…
VachaShah a2be2fa
Adding TransportMessage and TransportRequest classes with protobuf in…
VachaShah c0bbf92
Fixing build and precommit
VachaShah 551fe82
Adding protobuf integrations for client, transport, request
VachaShah a1ab589
Fixing build and integrating protobuf for classes related to RestNode…
VachaShah 8e57034
Fixing node crashes
VachaShah a5ce258
Fixes
VachaShah 0d76b3b
Fixing nodes api response for protobuf
VachaShah e6f6190
ProtobufClusterState to ClusterState
VachaShah b94a49e
Fixing cluster manager x to *
VachaShah cb320c7
Eliminating a lot of protobuf classes to merge with original classes …
VachaShah 13c4568
This fixes the single node calls after the refactoring in the previou…
VachaShah b659260
Trying serialization and deserialization across nodes
VachaShah e96f3e0
Debugging and fixing compile errors
VachaShah 496cdbb
Trying proto message serde across nodes with tests and example request
VachaShah 8aab04b
Changes for multi node - working on single and multi node
VachaShah b583179
Calculating time
VachaShah 515110a
Removing sysouts
VachaShah f94f165
Cleaning up code
VachaShah 35d8906
Ignoring proto generated classes
VachaShah d511930
Cleaning up more code
VachaShah 562e6c3
Cleaning up CodedInputStream, CodedOutputStream and TryWriteable
VachaShah d5f3a0e
Performance improvements
VachaShah 2f423b9
Fixing compile errors after merging with main
VachaShah eeeb40f
Renaming proto messages and related classes
VachaShah 8f5a327
Fixing precommit failures
VachaShah d409e71
Cleaning up code
VachaShah 967d26b
Improvements
VachaShah 0e9a86e
[Refactor] Network and Transport common classes to Libraries (#9073)
nknize d73fd6a
[Snapshot Interop] Add Logic in Lock Manager to cleanup stale data po…
harishbhakuni f3a17fc
Avoid duplicate indexing in case of SegRep enabled indices' translog …
gbbafna 64a7457
Fix flaky test testStatsOnShardUnassigned in RemoteStoreStatsIT (#9057)
ashking94 6030039
Fix test testDropPrimaryDuringReplication and clean up ReplicationChe…
mch2 46aaea2
Getting latest changes from main
VachaShah c05f5aa
Merge branch 'main' into poc-cat-nodes-protobuf
VachaShah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
libs/core/src/main/java/org/opensearch/core/common/io/stream/ProtobufWriteable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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.core.common.io.stream; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
|
||
/** | ||
* Implementers can be written to write to output and read from input using Protobuf. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public interface ProtobufWriteable { | ||
|
||
/** | ||
* Write this into the stream output. | ||
*/ | ||
public void writeTo(OutputStream out) throws IOException; | ||
|
||
/** | ||
* Reference to a method that can write some object to a {@link OutputStream}. | ||
* Most classes should implement {@link ProtobufWriteable} and the {@link ProtobufWriteable#writeTo(OutputStream)} method should <em>use</em> | ||
* {@link OutputStream} methods directly or this indirectly: | ||
* <pre><code> | ||
* public void writeTo(OutputStream out) throws IOException { | ||
* out.writeVInt(someValue); | ||
* } | ||
* </code></pre> | ||
*/ | ||
@FunctionalInterface | ||
interface Writer<V> { | ||
|
||
/** | ||
* Write {@code V}-type {@code value} to the {@code out}put stream. | ||
* | ||
* @param out Output to write the {@code value} too | ||
* @param value The value to add | ||
*/ | ||
void write(OutputStream out, V value) throws IOException; | ||
|
||
} | ||
|
||
/** | ||
* Reference to a method that can read some object from a stream. By convention this is a constructor that takes | ||
* {@linkplain byte[]} as an argument for most classes and a static method for things like enums. | ||
* <pre><code> | ||
* public MyClass(final byte[] in) throws IOException { | ||
* this.someValue = in.readVInt(); | ||
* } | ||
* </code></pre> | ||
*/ | ||
@FunctionalInterface | ||
interface Reader<V> { | ||
|
||
/** | ||
* Read {@code V}-type value from a stream. | ||
* | ||
* @param in Input to read the value from | ||
*/ | ||
V read(byte[] in) throws IOException; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
|
||
package org.opensearch.core.transport; | ||
|
||
import org.opensearch.core.common.io.stream.ProtobufWriteable; | ||
import org.opensearch.core.common.io.stream.StreamInput; | ||
import org.opensearch.core.common.io.stream.Writeable; | ||
import org.opensearch.core.common.transport.TransportAddress; | ||
|
@@ -41,7 +42,7 @@ | |
* | ||
* @opensearch.internal | ||
*/ | ||
public abstract class TransportMessage implements Writeable { | ||
public abstract class TransportMessage implements Writeable, ProtobufWriteable { | ||
|
||
private TransportAddress remoteAddress; | ||
|
||
|
@@ -63,4 +64,10 @@ public TransportMessage() {} | |
* currently a no-op | ||
*/ | ||
public TransportMessage(StreamInput in) {} | ||
|
||
/** | ||
* Constructs a new transport message with the data from the {@link byte[]}. This is | ||
* currently a no-op | ||
*/ | ||
public TransportMessage(byte[] in) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we avoid adding this change by reusing the existing StreamInput? |
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its strange than the writer is via an OutputStream, but the reader isn't a symetrical version that uses InputStream. Can we align the types to be consistant, be it bytes[] or *Stream?