|
| 1 | +/* ------------------------------------------------------------------- |
| 2 | +** |
| 3 | +** riak_kv.proto: Protocol buffers for riak KV |
| 4 | +** |
| 5 | +** Copyright (c) 2007-2010 Basho Technologies, Inc. All Rights Reserved. |
| 6 | +** |
| 7 | +** This file is provided to you under the Apache License, |
| 8 | +** Version 2.0 (the "License"); you may not use this file |
| 9 | +** except in compliance with the License. You may obtain |
| 10 | +** a copy of the License at |
| 11 | +** |
| 12 | +** http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | +** |
| 14 | +** Unless required by applicable law or agreed to in writing, |
| 15 | +** software distributed under the License is distributed on an |
| 16 | +** "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 17 | +** KIND, either express or implied. See the License for the |
| 18 | +** specific language governing permissions and limitations |
| 19 | +** under the License. |
| 20 | +** |
| 21 | +** ------------------------------------------------------------------- |
| 22 | +*/ |
| 23 | + |
| 24 | +/* |
| 25 | +** Revision: 1.2 |
| 26 | +*/ |
| 27 | + |
| 28 | +// Java package specifiers |
| 29 | +option java_package = "com.basho.riak.protobuf"; |
| 30 | +option java_outer_classname = "RiakKvPB"; |
| 31 | + |
| 32 | +import "riak.proto"; // for RpbPair |
| 33 | + |
| 34 | +// Get ClientId Request - no message defined, just send RpbGetClientIdReq message code |
| 35 | +message RpbGetClientIdResp { |
| 36 | + required bytes client_id = 1; // Client id in use for this connection |
| 37 | +} |
| 38 | + |
| 39 | +message RpbSetClientIdReq { |
| 40 | + required bytes client_id = 1; // Client id to use for this connection |
| 41 | +} |
| 42 | +// Set ClientId Request - no message defined, just send RpbSetClientIdReq message code |
| 43 | + |
| 44 | + |
| 45 | +// Get Request - retrieve bucket/key |
| 46 | +message RpbGetReq { |
| 47 | + required bytes bucket = 1; |
| 48 | + required bytes key = 2; |
| 49 | + optional uint32 r = 3; |
| 50 | + optional uint32 pr = 4; |
| 51 | + optional bool basic_quorum = 5; |
| 52 | + optional bool notfound_ok = 6; |
| 53 | + optional bytes if_modified = 7; // fail if the supplied vclock does not match |
| 54 | + optional bool head = 8; // return everything but the value |
| 55 | + optional bool deletedvclock = 9; // return the tombstone's vclock, if applicable |
| 56 | +} |
| 57 | + |
| 58 | +// Get Response - if the record was not found there will be no content/vclock |
| 59 | +message RpbGetResp { |
| 60 | + repeated RpbContent content = 1; |
| 61 | + optional bytes vclock = 2; // the opaque vector clock for the object |
| 62 | + optional bool unchanged = 3; |
| 63 | +} |
| 64 | + |
| 65 | + |
| 66 | +// Put request - if options.return_body is set then the updated metadata/data for |
| 67 | +// the key will be returned. |
| 68 | +message RpbPutReq { |
| 69 | + required bytes bucket = 1; |
| 70 | + optional bytes key = 2; |
| 71 | + optional bytes vclock = 3; |
| 72 | + required RpbContent content = 4; |
| 73 | + optional uint32 w = 5; |
| 74 | + optional uint32 dw = 6; |
| 75 | + optional bool return_body = 7; |
| 76 | + optional uint32 pw = 8; |
| 77 | + optional bool if_not_modified = 9; |
| 78 | + optional bool if_none_match = 10; |
| 79 | + optional bool return_head = 11; |
| 80 | +} |
| 81 | + |
| 82 | +// Put response - same as get response with optional key if one was generated |
| 83 | +message RpbPutResp { |
| 84 | + repeated RpbContent content = 1; |
| 85 | + optional bytes vclock = 2; // the opaque vector clock for the object |
| 86 | + optional bytes key = 3; // the key generated, if any |
| 87 | +} |
| 88 | + |
| 89 | + |
| 90 | +// Delete request |
| 91 | +message RpbDelReq { |
| 92 | + required bytes bucket = 1; |
| 93 | + required bytes key = 2; |
| 94 | + optional uint32 rw = 3; |
| 95 | + optional bytes vclock = 4; |
| 96 | + optional uint32 r = 5; |
| 97 | + optional uint32 w = 6; |
| 98 | + optional uint32 pr = 7; |
| 99 | + optional uint32 pw = 8; |
| 100 | + optional uint32 dw = 9; |
| 101 | +} |
| 102 | + |
| 103 | +// Delete response - not defined, will return a RpbDelResp on success or RpbErrorResp on failure |
| 104 | + |
| 105 | +// List buckets request - no message defined, just send RpbListBucketsReq |
| 106 | + |
| 107 | +// List buckets response |
| 108 | +message RpbListBucketsResp { |
| 109 | + repeated bytes buckets = 1; |
| 110 | +} |
| 111 | + |
| 112 | + |
| 113 | +// List keys in bucket request |
| 114 | +message RpbListKeysReq { |
| 115 | + required bytes bucket = 1; |
| 116 | +} |
| 117 | + |
| 118 | +// List keys in bucket response - one or more of these packets will be sent |
| 119 | +// the last one will have done set true (and may not have any keys in it) |
| 120 | +message RpbListKeysResp { |
| 121 | + repeated bytes keys = 1; |
| 122 | + optional bool done = 2; |
| 123 | +} |
| 124 | + |
| 125 | +// Get bucket properties request |
| 126 | +message RpbGetBucketReq { |
| 127 | + required bytes bucket = 1; |
| 128 | +} |
| 129 | + |
| 130 | +// Get bucket properties response |
| 131 | +message RpbGetBucketResp { |
| 132 | + required RpbBucketProps props = 1; |
| 133 | +} |
| 134 | + |
| 135 | +// Set bucket properties request |
| 136 | +message RpbSetBucketReq { |
| 137 | + required bytes bucket = 1; |
| 138 | + required RpbBucketProps props = 2; |
| 139 | +} |
| 140 | + |
| 141 | + |
| 142 | +// Set bucket properties response - no message defined, just send RpbSetBucketResp |
| 143 | + |
| 144 | + |
| 145 | +// Map/Reduce request |
| 146 | +message RpbMapRedReq { |
| 147 | + required bytes request = 1; |
| 148 | + required bytes content_type = 2; |
| 149 | +} |
| 150 | + |
| 151 | +// Map/Reduce response |
| 152 | +// one or more of these packets will be sent the last one will have done set |
| 153 | +// true (and may not have phase/data in it) |
| 154 | +message RpbMapRedResp { |
| 155 | + optional uint32 phase = 1; |
| 156 | + optional bytes response = 2; |
| 157 | + optional bool done = 3; |
| 158 | +} |
| 159 | + |
| 160 | +// Secondary Index query request |
| 161 | +message RpbIndexReq { |
| 162 | + enum IndexQueryType { |
| 163 | + eq = 0; |
| 164 | + range = 1; |
| 165 | + } |
| 166 | + |
| 167 | + required bytes bucket = 1; |
| 168 | + required bytes index = 2; |
| 169 | + required IndexQueryType qtype = 3; |
| 170 | + optional bytes key = 4; |
| 171 | + optional bytes range_min = 5; |
| 172 | + optional bytes range_max = 6; |
| 173 | +} |
| 174 | + |
| 175 | +// Secondary Index query response |
| 176 | +message RpbIndexResp { |
| 177 | + repeated bytes keys = 1; |
| 178 | +} |
| 179 | + |
| 180 | +// Content message included in get/put responses |
| 181 | +// Holds the value and associated metadata |
| 182 | +message RpbContent { |
| 183 | + required bytes value = 1; |
| 184 | + optional bytes content_type = 2; // the media type/format |
| 185 | + optional bytes charset = 3; |
| 186 | + optional bytes content_encoding = 4; |
| 187 | + optional bytes vtag = 5; |
| 188 | + repeated RpbLink links = 6; // links to other resources |
| 189 | + optional uint32 last_mod = 7; |
| 190 | + optional uint32 last_mod_usecs = 8; |
| 191 | + repeated RpbPair usermeta = 9; // user metadata stored with the object |
| 192 | + repeated RpbPair indexes = 10; // user metadata stored with the object |
| 193 | + optional bool deleted = 11; |
| 194 | +} |
| 195 | + |
| 196 | +// Link metadata |
| 197 | +message RpbLink { |
| 198 | + optional bytes bucket = 1; |
| 199 | + optional bytes key = 2; |
| 200 | + optional bytes tag = 3; |
| 201 | +} |
| 202 | + |
| 203 | +// Bucket properties |
| 204 | +message RpbBucketProps { |
| 205 | + optional uint32 n_val = 1; |
| 206 | + optional bool allow_mult = 2; |
| 207 | +} |
| 208 | + |
| 209 | +message RpbSearchDoc { |
| 210 | + repeated RpbPair fields = 1; |
| 211 | +} |
| 212 | + |
| 213 | +message RpbSearchQueryReq { |
| 214 | + required bytes q = 1; // Query string |
| 215 | + required bytes index = 2; // Index |
| 216 | + optional uint32 rows = 3; // Limit rows |
| 217 | + optional uint32 start = 4; // Starting offset |
| 218 | + optional bytes sort = 5; // Sort order |
| 219 | + optional bytes filter = 6; // Inline fields filtering query |
| 220 | + optional bytes df = 7; // Default field |
| 221 | + optional bytes op = 8; // Default op |
| 222 | + repeated bytes fl = 9; // Return fields limit (for ids only, generally) |
| 223 | + optional bytes presort = 10; // Presort (key / score) |
| 224 | +} |
| 225 | + |
| 226 | +message RpbSearchQueryResp { |
| 227 | + repeated RpbSearchDoc docs = 1; // Result documents |
| 228 | + optional float max_score = 2; // Maximum score |
| 229 | + optional uint32 num_found = 3; // Number of results |
| 230 | +} |
0 commit comments