basho / riak

Riak is a decentralized datastore from Basho Technologies.
http://docs.basho.com
Apache License 2.0
3.95k stars 538 forks source link

Some missing Riak protobuf message codes #500

Open xpe opened 10 years ago

xpe commented 10 years ago

I'm working on an asynchronous Clojure protocol buffer client.

Most of Riak's protocol buffer message codes are sequential and alternate between request and response. But some codes are missing. I first noticed this issue in the context of the Java client, but now I am pretty sure this is a Riak issue.

To make my client logic make more sense, I've defined the missing codes as shown below. I starred the problematic message codes.

(def ^:const message-codes
  {:error-resp 0
   :ping-req 1
   :ping-resp 2
   :get-client-id-req 3
   :get-client-id-resp 4
   :set-client-id-req 5
   :set-client-id-resp 6
   :get-server-info-req 7
   :get-server-info-resp 8
   :get-req 9
   :get-resp 10
   :put-req 11
   :put-resp 12
   :del-req 13
   :del-resp 14
   :list-buckets-req 15
   :list-buckets-resp 16
   :list-keys-req 17
   :list-keys-resp 18
   :get-bucket-req 19
   :get-bucket-resp 20
   :set-bucket-req 21
   :set-bucket-resp 22
   :map-red-req 23
   :map-red-resp 24
   :index-req 25
   :index-resp 26
   :search-query-req 27
   :search-query-resp 28
   :reset-bucket-req 29
   :reset-bucket-resp 30
   :counter-update-req 50
   :counter-update-resp 51
   :counter-get-req 52
   :counter-get-resp 53
   :yz-index-get-req 54
   :yz-index-get-resp 55
   :yz-index-put-req 56
   :yz-index-put-resp 12 ; ***
   :yz-index-del-req 57
   :yz-index-del-resp 14 ; ***
   :yz-schema-get-req 58
   :yz-schema-get-resp 59
   :yz-schema-put-req 60
   :yz-schema-put-resp 12 ; ***
   :dt-fetch-req 80
   :dt-fetch-resp 81
   :dt-update-req 82
   :dt-update-resp 83})

I consider the code mix-up (above) to be a mistake. Using unique codes for messages is a cleaner way to go, and that is how a bulk of the API works. I admit that only people writing clients would probably notice it.

It would be nice to get it cleaned up if possible.

jaredmorrow commented 10 years ago

/cc @rzezeski since the codes are in relation to Yokozuna. I'm setting the milestone to be 2.1 for now since we are too late in the 2.0 cycle to change the API.