-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: introduce handshake to client and gRPC server #36
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.numaproj.numaflow.info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
/** | ||
* Please exercise cautions when updating the values below because the exact same values are defined in other Numaflow SDKs | ||
* to form a contract between server and clients. | ||
*/ | ||
public enum Language { | ||
GO("go"), | ||
PYTHON("python"), | ||
JAVA("java"); | ||
|
||
private final String name; | ||
|
||
Language(String name) { | ||
this.name = name; | ||
} | ||
|
||
@JsonValue | ||
public String getName() { | ||
return name; | ||
} | ||
} |
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,23 @@ | ||
package io.numaproj.numaflow.info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
|
||
/** | ||
* Please exercise cautions when updating the values below because the exact same values are defined in other Numaflow SDKs | ||
* to form a contract between server and clients. | ||
*/ | ||
public enum Protocol { | ||
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. Same comment |
||
UDS_PROTOCOL("uds"), | ||
TCP_PROTOCOL("tcp"); | ||
|
||
private final String name; | ||
|
||
Protocol(String name) { | ||
this.name = name; | ||
} | ||
|
||
@JsonValue | ||
public String getName() { | ||
return name; | ||
} | ||
} |
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,31 @@ | ||
package io.numaproj.numaflow.info; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Server Information to be used by client to determine: | ||
* - protocol: what is right protocol to use (UDS or TCP) | ||
* - language: what is language used by the server | ||
* - version: what is the numaflow sdk version used by the server | ||
* - metadata: other information | ||
*/ | ||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class ServerInfo { | ||
@JsonProperty("protocol") | ||
private Protocol protocol; | ||
@JsonProperty("language") | ||
private Language language; | ||
@JsonProperty("version") | ||
private String version; | ||
@JsonProperty("metadata") | ||
private Map<String, String> metadata; | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/io/numaproj/numaflow/info/ServerInfoAccessor.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,32 @@ | ||
package io.numaproj.numaflow.info; | ||
|
||
public interface ServerInfoAccessor { | ||
/** | ||
* Get runtime Java SDK version. | ||
*/ | ||
String getSDKVersion(); | ||
|
||
/** | ||
* Delete filePath if it exists. | ||
* Write serverInfo to filePath in Json format. | ||
* Append {@link ServerInfoConstants#EOF} as a new line to indicate end of file. | ||
* | ||
* @param serverInfo server information POJO | ||
* @param filePath file path to write to | ||
* | ||
* @throws Exception any exceptions are thrown to the caller. | ||
*/ | ||
void write(ServerInfo serverInfo, String filePath) throws Exception; | ||
|
||
/** | ||
* Read from filePath to retrieve server information POJO. | ||
* This API is only used for unit tests. | ||
* | ||
* @param filePath file path to read from | ||
* | ||
* @return server information POJO | ||
* | ||
* @throws Exception any exceptions are thrown to the caller. | ||
*/ | ||
ServerInfo read(String filePath) throws Exception; | ||
} |
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.
Any reason why we didn't go with proto? Since it's common among all the sdks we could have kept a common proto file
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.
Good point Yashash. I think we should go with proto, that way we can catch any data format issue during development instead of runtime. @whynowy @vigith thoughts?
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.
+1, we need to standardize our proto location before we do that. today we manually sink it between the repos.
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.
To be addressed by numaproj/numaflow#693