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

Where is RpbGetServerInfoReq defined? #73

Closed
xpe opened this issue Dec 16, 2013 · 8 comments
Closed

Where is RpbGetServerInfoReq defined? #73

xpe opened this issue Dec 16, 2013 · 8 comments

Comments

@xpe
Copy link

xpe commented Dec 16, 2013

I'm pretty new to protocol buffers. This is what I see in riak.proto:

// Get server info request - no message defined,
// just send RpbGetServerInfoReq message code
message RpbGetServerInfoResp {
    optional bytes node = 1;
    optional bytes server_version = 2;
}

Where is RpbGetServerInfoReq defined?

@xpe
Copy link
Author

xpe commented Dec 16, 2013

Ok, I looked in the Java client and found this in RiakMessageCodes.java:

interface RiakMessageCodes {
  public static final int MSG_ErrorResp = 0;
  public static final int MSG_PingReq = 1;
  public static final int MSG_PingResp = 2;
  public static final int MSG_GetClientIdReq = 3;
  public static final int MSG_GetClientIdResp = 4;
  public static final int MSG_SetClientIdReq = 5;
  public static final int MSG_SetClientIdResp = 6;
  public static final int MSG_GetServerInfoReq = 7;
  public static final int MSG_GetServerInfoResp = 8;
  // ...
}

@xpe xpe closed this as completed Dec 16, 2013
@xpe
Copy link
Author

xpe commented Dec 16, 2013

Why not define these codes in this repository? They are defined for Erlang, so why not Java?

%% @doc Converts a symbolic message name into a message code. Replaces
%% `riakc_pb:msg_code/1'.
-spec msg_code(atom()) -> integer().
msg_code(rpberrorresp)           -> 0;
msg_code(rpbpingreq)             -> 1;
msg_code(rpbpingresp)            -> 2;
msg_code(rpbgetclientidreq)      -> 3;
msg_code(rpbgetclientidresp)     -> 4;
msg_code(rpbsetclientidreq)      -> 5;
msg_code(rpbsetclientidresp)     -> 6;
msg_code(rpbgetserverinforeq)    -> 7;
msg_code(rpbgetserverinforesp)   -> 8;
msg_code(rpbgetreq)              -> 9;

@xpe
Copy link
Author

xpe commented Dec 17, 2013

I'm reopening so Basho might see my comment, above.

@xpe xpe reopened this Dec 17, 2013
@evanmcc
Copy link
Contributor

evanmcc commented Dec 23, 2013

If you look in the readme the code is defined as 7. Since there are no fields, there's no point in defining a message structure.

@xpe
Copy link
Author

xpe commented Dec 24, 2013

@evanmcc: Hello. I'm aware of what you said, but it isn't directly tied to my suggestion.

My argument is this: Since the Riak messages codes are part of the Riak PB API, it would be best for them to be kept in this source code. I'd suggest creating constants for them in a Java file that becomes part of the Maven artifact and can be referred to. Otherwise, a Java/Clojure/Scala/Groovy client has to define them in their own. That's error prone, but that is the way it is now. It would be better to define the constants in one place. Here, in this repo.

One might make the argument that only Protocol Buffer files belong in this repo. Meh. This repo is (or should be) about anything that Basho can provide so that JVM languages can make API calls without duplicating things. That includes .proto files and message code constants.

Would you ask a developer to "go write you own .proto files"? Probably not. So why tell them to go write their own constants?

@seancribbs
Copy link

@xpe We have implemented code-generation for these in Erlang and Python already, using a CSV file in the repository. We do have plans to generate them for Java as well, which will be straightforward. Please do engage @broach and @mgodave on this.

@broach
Copy link
Contributor

broach commented Feb 28, 2014

This has now been addressed, see #82

@broach broach closed this as completed Feb 28, 2014
@xpe
Copy link
Author

xpe commented Feb 28, 2014

Thanks!

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

No branches or pull requests

4 participants