Skip to content

Commit

Permalink
Merge pull request #54 from basho/bos-bucket-type
Browse files Browse the repository at this point in the history
Bucket type support
  • Loading branch information
engelsanchez committed Sep 7, 2013
2 parents 8d48069 + a9a73b4 commit a3e4fc8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/riak.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ message RpbPair {
// Get bucket properties request
message RpbGetBucketReq {
required bytes bucket = 1;
optional bytes type = 2;
}

// Get bucket properties response
Expand All @@ -63,6 +64,7 @@ message RpbGetBucketResp {
message RpbSetBucketReq {
required bytes bucket = 1;
required RpbBucketProps props = 2;
optional bytes type = 3;
}

// Set bucket properties response - no message defined, just send
Expand All @@ -71,8 +73,29 @@ message RpbSetBucketReq {
// Reset bucket properties request
message RpbResetBucketReq {
required bytes bucket = 1;
optional bytes type = 2;
}

// Get bucket properties request
message RpbGetBucketTypeReq {
required bytes type = 1;
}

// Set bucket properties request
message RpbSetBucketTypeReq {
required bytes type = 1;
required RpbBucketProps props = 2;
}

// Set bucket properties response - no message defined, just send
// RpbSetBucketResp

// Reset bucket properties request
message RpbResetBucketTypeReq {
required bytes type = 1;
}


// Reset bucket properties response - no message defined, just send
// RpbResetBucketResp

Expand Down
9 changes: 9 additions & 0 deletions src/riak_kv.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ message RpbGetReq {
optional uint32 timeout = 10;
optional bool sloppy_quorum = 11; // Experimental, may change/disappear
optional uint32 n_val = 12; // Experimental, may change/disappear
optional bytes type = 13; // Bucket type, if not set we assume the 'default' type
}

// Get Response - if the record was not found there will be no content/vclock
Expand Down Expand Up @@ -84,6 +85,7 @@ message RpbPutReq {
optional bool asis = 13;
optional bool sloppy_quorum = 14; // Experimental, may change/disappear
optional uint32 n_val = 15; // Experimental, may change/disappear
optional bytes type = 16; // Bucket type, if not set we assume the 'default' type
}

// Put response - same as get response with optional key if one was generated
Expand All @@ -108,6 +110,7 @@ message RpbDelReq {
optional uint32 timeout = 10;
optional bool sloppy_quorum = 11; // Experimental, may change/disappear
optional uint32 n_val = 12; // Experimental, may change/disappear
optional bytes type = 13; // Bucket type, if not set we assume the 'default' type
}

// Delete response - not defined, will return a RpbDelResp on success or RpbErrorResp on failure
Expand All @@ -116,6 +119,7 @@ message RpbDelReq {
message RpbListBucketsReq {
optional uint32 timeout = 1;
optional bool stream = 2;
optional bytes type = 3; // Bucket type, if not set we assume the 'default' type
}

// List buckets response - one or more of these packets will be sent
Expand All @@ -130,6 +134,7 @@ message RpbListBucketsResp {
message RpbListKeysReq {
required bytes bucket = 1;
optional uint32 timeout = 2;
optional bytes type = 3; // Bucket type, if not set we assume the 'default' type
}

// List keys in bucket response - one or more of these packets will be sent
Expand Down Expand Up @@ -173,6 +178,7 @@ message RpbIndexReq {
optional uint32 max_results = 9;
optional bytes continuation = 10;
optional uint32 timeout = 11;
optional bytes type = 12; // Bucket type, if not set we assume the 'default' type
}

// Secondary Index query response
Expand All @@ -195,6 +201,7 @@ message RpbCSBucketReq {
optional bytes continuation = 6;
optional uint32 max_results = 7;
optional uint32 timeout = 8;
optional bytes type = 9; // Bucket type, if not set we assume the 'default' type
}

// return for CS bucket fold
Expand Down Expand Up @@ -241,6 +248,7 @@ message RpbCounterUpdateReq {
optional uint32 dw = 5;
optional uint32 pw = 6;
optional bool returnvalue = 7;
optional bytes type = 8; // Bucket type, if not set we assume the 'default' type
}

// Counter update response? No message | error response
Expand All @@ -256,6 +264,7 @@ message RpbCounterGetReq {
optional uint32 pr = 4;
optional bool basic_quorum = 5;
optional bool notfound_ok = 6;
optional bytes type = 7; // Bucket type, if not set we assume the 'default' type
}

// Counter value response
Expand Down
11 changes: 10 additions & 1 deletion src/riak_pb_codec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ msg_type(27) -> rpbsearchqueryreq;
msg_type(28) -> rpbsearchqueryresp;
msg_type(29) -> rpbresetbucketreq;
msg_type(30) -> rpbresetbucketresp;
msg_type(31) -> rpbgetbuckettypereq;
msg_type(32) -> rpbsetbuckettypereq;
msg_type(33) -> rpbresetbuckettypereq;
msg_type(40) -> rpbcsbucketreq;
msg_type(41) -> rpbcsbucketresp;
msg_type(50) -> rpbcounterupdatereq;
Expand Down Expand Up @@ -168,6 +171,9 @@ msg_code(rpbsearchqueryreq) -> 27;
msg_code(rpbsearchqueryresp) -> 28;
msg_code(rpbresetbucketreq) -> 29;
msg_code(rpbresetbucketresp) -> 30;
msg_code(rpbgetbuckettypereq) -> 31;
msg_code(rpbsetbuckettypereq) -> 32;
msg_code(rpbresetbuckettypereq) -> 33;
msg_code(rpbcsbucketreq) -> 40;
msg_code(rpbcsbucketresp) -> 41;
msg_code(rpbcounterupdatereq) -> 50;
Expand All @@ -186,7 +192,10 @@ msg_code(rpbyokozunaschemaputreq) -> 60.
-spec decoder_for(pos_integer()) -> module().
decoder_for(N) when N >= 0, N < 3;
N == 7; N == 8;
N == 29; N == 30 ->
(N >= 19 andalso N =< 22);
N == 29; N == 30;
N == 31; N == 32;
N == 33 ->
riak_pb;
decoder_for(N) when N >= 3, N < 7;
N >= 9, N =< 26;
Expand Down

0 comments on commit a3e4fc8

Please sign in to comment.