|
| 1 | +--- |
| 2 | +title: "PBC Coverage Queries" |
| 3 | +description: "" |
| 4 | +project: "riak_kv" |
| 5 | +project_version: "2.1.4" |
| 6 | +menu: |
| 7 | + riak_kv-2.1.4: |
| 8 | + name: "Coverage Queries" |
| 9 | + identifier: "pbc_coverage_queries" |
| 10 | + weight: 108 |
| 11 | + parent: "apis_pbc" |
| 12 | +toc: true |
| 13 | +aliases: |
| 14 | + - /riak/2.1.4/dev/references/protocol-buffers/coverage-queries |
| 15 | + - /riak/kv/2.1.4/dev/references/protocol-buffers/coverage-queries |
| 16 | +canonical_link: "https://docs.basho.com/riak/kv/latest/developing/api/protocol-buffers/coverage-queries" |
| 17 | +--- |
| 18 | + |
| 19 | +Prepare for parallelizable |
| 20 | +[secondary index queries][../secondary-indexes/] by requesting a |
| 21 | +coverage plan. The response will be multiple slices of the cluster, as |
| 22 | +identified by a TCP endpoint and an opaque binary to be included with |
| 23 | +each 2i query. |
| 24 | + |
| 25 | +## Request |
| 26 | + |
| 27 | +```protobuf |
| 28 | +message RpbCoverageReq { |
| 29 | + optional bytes type = 1; |
| 30 | + required bytes bucket = 2; |
| 31 | + optional uint32 min_partitions = 3; |
| 32 | + optional bytes replace_cover = 4; |
| 33 | + repeated bytes unavailable_cover = 5; |
| 34 | +} |
| 35 | +``` |
| 36 | + |
| 37 | +#### Required Parameters |
| 38 | + |
| 39 | +Parameter | Description |
| 40 | +:---------|:----------- |
| 41 | +`bucket` | The name of the bucket in which the data is stored |
| 42 | + |
| 43 | +#### Optional Parameters |
| 44 | + |
| 45 | +Parameter | Description |
| 46 | +:---------|:----------- |
| 47 | +`type` | The name of the bucket type, if this bucket is not in the default (pre-2.0) bucket type. |
| 48 | +`min_partitions` | The minimum number of cluster slices. `undefined` results in a direct map of the internal coverage plan, which targets the minimum number of nodes necessary to retrieve all data. An integer will be rounded up to the nearest power of 2 greater than or equal to the ring size. |
| 49 | +`replace_cover` | If a client cannot reach the server designated by a previous coverage response, the opaque binary can be sent with a new coverage request via this parameter and a new plan component will be calculated and returned. |
| 50 | +`unavailable_cover` | List of opaque binaries representing other unreachable endpoints to help Riak determine what servers the client cannot currently use. |
| 51 | + |
| 52 | +## Response |
| 53 | + |
| 54 | +The results of a coverage query are returned as a list of endpoints |
| 55 | +with opaque binaries to be included with secondary index queries. |
| 56 | + |
| 57 | +```protobuf |
| 58 | +message RpbCoverageResp { |
| 59 | + repeated RpbCoverageEntry entries = 1; |
| 60 | +} |
| 61 | +
|
| 62 | +message RpbCoverageEntry { |
| 63 | + required bytes ip = 1; |
| 64 | + required uint32 port = 2; |
| 65 | + optional bytes keyspace_desc = 3; |
| 66 | + required bytes cover_context = 4; |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +#### Values |
| 71 | + |
| 72 | +Parameter | Description |
| 73 | +:---------|:----------- |
| 74 | +`ip` | The IP address of the server containing a subset of the data. Depending on the environment, this address may require local translation to deal with routing or firewall constraints. |
| 75 | +`port` | The port to contact on the server. |
| 76 | +`keyspace_desc` | A human-readable description of the keyspace. Not intended to be used programmatically except potentially for logging. |
| 77 | +`cover_context` | The opaque binary to be used in secondary index queries (and possibly future coverage queries to indicate that this server appears offline or otherwise non-functional to the client). |
0 commit comments