Skip to content

Commit 192ece5

Browse files
authored
More API tweaks. (#135)
Turns out we need to also match on "doesn't exist" for caching to work properly. So add an "ABSENCE" match condition. Also, fold PREFIX into REGEX.
1 parent 6d69c4d commit 192ece5

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

mixer/v1/check.proto

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,9 @@ message CheckResponse {
7575
// attributes and its configuration.
7676
Attributes attributes = 4 [(gogoproto.nullable) = false];
7777

78-
// The subset of attributes that were used in producing the result.
79-
// This includes only the attributes that were sent to Mixer and
80-
// do not include any derived attributes Mixer generated itself.
81-
UsedRequestAttributes used_attributes = 5 [(gogoproto.nullable) = false];
78+
// The total set of attributes that were used in producing the result
79+
// along with matching conditions.
80+
ReferencedAttributes referenced_attributes = 5 [(gogoproto.nullable) = false];
8281
}
8382

8483
message QuotaResult {
@@ -89,10 +88,9 @@ message CheckResponse {
8988
// If `QuotaParams.best_effort` is false, this will be either 0 or >= `QuotaParams.amount`.
9089
int64 granted_amount = 2;
9190

92-
// The subset of attributes that were used in producing the result.
93-
// This includes only the attributes that were sent to Mixer and
94-
// do not include any derived attributes Mixer generated itself.
95-
UsedRequestAttributes used_attributes = 3 [(gogoproto.nullable) = false];
91+
// The total set of attributes that were used in producing the result
92+
// along with matching conditions.
93+
ReferencedAttributes referenced_attributes = 5 [(gogoproto.nullable) = false];
9694
}
9795

9896
// The precondition check results.
@@ -102,14 +100,14 @@ message CheckResponse {
102100
map<string, QuotaResult> quotas = 3 [(gogoproto.nullable) = false];
103101
}
104102

105-
// Describes the attributes that were used in order to determine the response.
103+
// Describes the attributes that were used to determine the response.
106104
// This can be used to construct a response cache.
107-
message UsedRequestAttributes {
105+
message ReferencedAttributes {
108106
// How an attribute's value was matched
109107
enum Condition {
110-
EXACT = 0;
111-
PREFIX = 1;
112-
REGEX = 2;
108+
ABSENCE = 0; // match when attribute doesn't exist
109+
EXACT = 1; // match when attribute value is an exact byte-for-byte match
110+
REGEX = 2; // match when attribute value matches the included regex
113111
}
114112

115113
message AttributeMatch {
@@ -129,5 +127,5 @@ message UsedRequestAttributes {
129127
repeated string words = 1;
130128

131129
// Describes a set of attributes.
132-
repeated AttributeMatch attribute_matches = 2;
130+
repeated AttributeMatch attribute_matches = 2 [(gogoproto.nullable) = false];
133131
}

0 commit comments

Comments
 (0)