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

Add GRPC server query RPC endpoints #152

Merged
merged 2 commits into from
Mar 3, 2019
Merged

Conversation

xichen2020
Copy link
Owner

@xichen2020 xichen2020 commented Mar 2, 2019

cc @black-adder @cw9 @notbdu

This PR adds gRPC server query RPC endpoints.

Will be addressed in followup PRs:

  • gRPC client
  • Integration tests

Copy link
Collaborator

@notbdu notbdu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -45,6 +46,23 @@ func (u ValueUnion) MarshalJSON() ([]byte, error) {
}
}

// ToProto converts a value to a calculation value protobuf message.
func (u ValueUnion) ToProto() servicepb.CalculationValue {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this safe? rename to Must...? Also feels more readable to put panic in default:

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is safe yeah. Sure can move panic to default.

OptionalFilterValue value = 3 [(gogoproto.nullable) = false];
}

message OptionalString {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: move all the Optional types together?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure np.

message OptionalString {
oneof value {
bool no_value = 1;
string data = 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be bytes?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used in query proto to specify things like fields to filter against, so it's more readable to use strings on the client side.

message WriteResults {}

message RawQueryResults {
repeated string raw = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intended for performance reasons? or is string enough for the results?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is to return a list of raw results, so you need to have an array here.

Type type = 1;
bool bool_val = 2;
double number_val = 3;
string string_val = 4;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: string to bytes?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used in the query filter in a query expression and is probably more readable to use strings. It should have no impact on performance.

}

enum SortOrder {
UNKNOWNSORTORDER = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? Should it be by default ASCENDING? Or handle that logic in converting functions?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally prefer to have the default slot to be something unknown and make this explicitly optional if needed (i.e., handling in converting functions)

@xichen2020 xichen2020 merged commit 1c001ec into master Mar 3, 2019
@xichen2020 xichen2020 deleted the xichen-grpc-server-query-rpc branch March 3, 2019 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants