Skip to content

Commit 11c0d1d

Browse files
committed
rls: update rls proto
1 parent b846ae7 commit 11c0d1d

File tree

5 files changed

+57
-43
lines changed

5 files changed

+57
-43
lines changed

repositories.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def com_google_protobuf_javalite():
126126
def io_grpc_grpc_proto():
127127
http_archive(
128128
name = "io_grpc_grpc_proto",
129-
sha256 = "5848a4e034126bece0c37c16554fb80625615aedf1acad4e2a3cdbaaa76944eb",
130-
strip_prefix = "grpc-proto-cf828d0e1155e5ea58b46d7184ee5596e03ddcb8",
131-
urls = ["https://github.com/grpc/grpc-proto/archive/cf828d0e1155e5ea58b46d7184ee5596e03ddcb8.zip"],
129+
sha256 = "464e97a24d7d784d9c94c25fa537ba24127af5aae3edd381007b5b98705a0518",
130+
strip_prefix = "grpc-proto-08911e9d585cbda3a55eb1dcc4b99c89aebccff8",
131+
urls = ["https://github.com/grpc/grpc-proto/archive/08911e9d585cbda3a55eb1dcc4b99c89aebccff8.zip"],
132132
)

rls/src/main/java/io/grpc/rls/RlsProtoConverters.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ final class RlsProtoConverters {
4646
static final class RouteLookupRequestConverter
4747
extends Converter<RouteLookupRequest, RlsProtoData.RouteLookupRequest> {
4848

49+
@SuppressWarnings("deprecation")
4950
@Override
5051
protected RlsProtoData.RouteLookupRequest doForward(RouteLookupRequest routeLookupRequest) {
5152
return
@@ -56,6 +57,7 @@ protected RlsProtoData.RouteLookupRequest doForward(RouteLookupRequest routeLook
5657
routeLookupRequest.getKeyMapMap());
5758
}
5859

60+
@SuppressWarnings("deprecation")
5961
@Override
6062
protected RouteLookupRequest doBackward(RlsProtoData.RouteLookupRequest routeLookupRequest) {
6163
return

rls/src/main/proto/grpc/lookup/v1/rls.proto

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,39 @@ option java_outer_classname = "RlsProto";
2424
message RouteLookupRequest {
2525
// Full host name of the target server, e.g. firestore.googleapis.com.
2626
// Only set for gRPC requests; HTTP requests must use key_map explicitly.
27-
string server = 1;
27+
// Deprecated in favor of setting key_map keys with GrpcKeyBuilder.extra_keys.
28+
string server = 1 [deprecated = true];
2829
// Full path of the request, i.e. "/service/method".
2930
// Only set for gRPC requests; HTTP requests must use key_map explicitly.
30-
string path = 2;
31+
// Deprecated in favor of setting key_map keys with GrpcKeyBuilder.extra_keys.
32+
string path = 2 [deprecated = true];
3133
// Target type allows the client to specify what kind of target format it
3234
// would like from RLS to allow it to find the regional server, e.g. "grpc".
3335
string target_type = 3;
36+
// Possible reasons for making a request.
37+
enum Reason {
38+
REASON_UNKNOWN = 0; // Unused
39+
REASON_MISS = 1; // No data available in local cache
40+
REASON_STALE = 2; // Data in local cache is stale
41+
}
42+
// Reason for making this request.
43+
Reason reason = 5;
3444
// Map of key values extracted via key builders for the gRPC or HTTP request.
3545
map<string, string> key_map = 4;
3646
}
3747

3848
message RouteLookupResponse {
39-
// Actual addressable entity to use for routing decision, using syntax
40-
// requested by the request target_type.
41-
// This field is deprecated in favor of the new "targets" field, below.
42-
string target = 1 [deprecated=true];
4349
// Prioritized list (best one first) of addressable entities to use
4450
// for routing, using syntax requested by the request target_type.
4551
// The targets will be tried in order until a healthy one is found.
46-
// If present, it should be used by proxy/gRPC client code instead of
47-
// "target" (which is deprecated).
4852
repeated string targets = 3;
4953
// Optional header value to pass along to AFE in the X-Google-RLS-Data header.
5054
// Cached with "target" and sent with all requests that match the request key.
5155
// Allows the RLS to pass its work product to the eventual target.
5256
string header_data = 2;
57+
58+
reserved 1;
59+
reserved "target";
5360
}
5461

5562
service RouteLookupService {

rls/src/main/proto/grpc/lookup/v1/rls_config.proto

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ option java_outer_classname = "RlsConfigProto";
2929
// present for the keybuilder to match.
3030
message NameMatcher {
3131
// The name that will be used in the RLS key_map to refer to this value.
32+
// If required_match is true, you may omit this field or set it to an empty
33+
// string, in which case the matcher will require a match, but won't update
34+
// the key_map.
3235
string key = 1;
3336

3437
// Ordered list of names (headers or query parameter names) that can supply
@@ -52,10 +55,29 @@ message GrpcKeyBuilder {
5255
}
5356
repeated Name names = 1;
5457

58+
// If you wish to include the host, service, or method names as keys in the
59+
// generated RouteLookupRequest, specify key names to use in the extra_keys
60+
// submessage. If a key name is empty, no key will be set for that value.
61+
// If this submessage is specified, the normal host/path fields will be left
62+
// unset in the RouteLookupRequest. We are deprecating host/path in the
63+
// RouteLookupRequest, so services should migrate to the ExtraKeys approach.
64+
message ExtraKeys {
65+
string host = 1;
66+
string service = 2;
67+
string method = 3;
68+
}
69+
ExtraKeys extra_keys = 3;
70+
5571
// Extract keys from all listed headers.
5672
// For gRPC, it is an error to specify "required_match" on the NameMatcher
5773
// protos.
5874
repeated NameMatcher headers = 2;
75+
76+
// You can optionally set one or more specific key/value pairs to be added to
77+
// the key_map. This can be useful to identify which builder built the key,
78+
// for example if you are suppressing the actual method, but need to
79+
// separately cache and request all the matched methods.
80+
map<string, string> constant_keys = 4;
5981
}
6082

6183
// An HttpKeyBuilder applies to a given HTTP URL and headers.
@@ -131,6 +153,12 @@ message HttpKeyBuilder {
131153
// to match. If a given header appears multiple times in the request we will
132154
// report it as a comma-separated string, in standard HTTP fashion.
133155
repeated NameMatcher headers = 4;
156+
157+
// You can optionally set one or more specific key/value pairs to be added to
158+
// the key_map. This can be useful to identify which builder built the key,
159+
// for example if you are suppressing a lot of information from the URL, but
160+
// need to separately cache and request URLs with that content.
161+
map<string, string> constant_keys = 5;
134162
}
135163

136164
message RouteLookupConfig {
@@ -176,40 +204,15 @@ message RouteLookupConfig {
176204

177205
// This is a list of all the possible targets that can be returned by the
178206
// lookup service. If a target not on this list is returned, it will be
179-
// treated the same as an RPC error from the RLS.
207+
// treated the same as an unhealthy target.
180208
repeated string valid_targets = 8;
181209

182-
// This value provides a default target to use if needed. It will be used for
183-
// request processing strategy SYNC_LOOKUP_DEFAULT_TARGET_ON_ERROR if RLS
184-
// returns an error, or strategy ASYNC_LOOKUP_DEFAULT_TARGET_ON_MISS if RLS
185-
// returns an error or there is a cache miss in the client. It will also be
186-
// used if there are no healthy backends for an RLS target. Note that
187-
// requests can be routed only to a subdomain of the original target,
188-
// e.g. "us_east_1.cloudbigtable.googleapis.com".
210+
// This value provides a default target to use if needed. If set, it will be
211+
// used if RLS returns an error, times out, or returns an invalid response.
212+
// Note that requests can be routed only to a subdomain of the original
213+
// target, e.g. "us_east_1.cloudbigtable.googleapis.com".
189214
string default_target = 9;
190215

191-
// Specify how to process a request when not already in the cache.
192-
enum RequestProcessingStrategy {
193-
STRATEGY_UNSPECIFIED = 0;
194-
195-
// Query the RLS and process the request using target returned by the
196-
// lookup. The target will then be cached and used for processing
197-
// subsequent requests for the same key. Any errors during lookup service
198-
// processing will fall back to default target for request processing.
199-
SYNC_LOOKUP_DEFAULT_TARGET_ON_ERROR = 1;
200-
201-
// Query the RLS and process the request using target returned by the
202-
// lookup. The target will then be cached and used for processing
203-
// subsequent requests for the same key. Any errors during lookup service
204-
// processing will return an error back to the client. Services with
205-
// strict regional routing requirements should use this strategy.
206-
SYNC_LOOKUP_CLIENT_SEES_ERROR = 2;
207-
208-
// Query the RLS asynchronously but respond with the default target. The
209-
// target in the lookup response will then be cached and used for
210-
// subsequent requests. Services with strict latency requirements (but not
211-
// strict regional routing requirements) should use this strategy.
212-
ASYNC_LOOKUP_DEFAULT_TARGET_ON_MISS = 3;
213-
}
214-
RequestProcessingStrategy request_processing_strategy = 10;
216+
reserved 10;
217+
reserved "request_processing_strategy";
215218
}

rls/src/test/java/io/grpc/rls/RlsProtoConvertersTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
@RunWith(JUnit4.class)
4242
public class RlsProtoConvertersTest {
4343

44+
@SuppressWarnings("deprecation")
4445
@Test
4546
public void convert_toRequestProto() {
4647
Converter<RouteLookupRequest, RlsProtoData.RouteLookupRequest> converter =
@@ -60,6 +61,7 @@ public void convert_toRequestProto() {
6061
assertThat(object.getKeyMap()).containsExactly("key1", "val1");
6162
}
6263

64+
@SuppressWarnings("deprecation")
6365
@Test
6466
public void convert_toRequestObject() {
6567
Converter<RlsProtoData.RouteLookupRequest, RouteLookupRequest> converter =

0 commit comments

Comments
 (0)