|
| 1 | +// Copyright 2016 Google Inc. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package istio.mixer.v1; |
| 18 | + |
| 19 | +import "google/protobuf/timestamp.proto"; |
| 20 | + |
| 21 | +// An instance of this is delivered to the mixer with every |
| 22 | +// API call. |
| 23 | +// |
| 24 | +// The general idea is to leverage the stateful gRPC streams from the |
| 25 | +// proxy to the mixer to keep to a minimum the 'attribute chatter'. |
| 26 | +// Only delta attributes are sent over, multiple concurrent attribute |
| 27 | +// contexts can be used to avoid thrashing, and attribute indices are used to |
| 28 | +// keep the wire protocol maximally efficient. |
| 29 | +// |
| 30 | +// Producing this message is the responsibility of the mixer's client |
| 31 | +// library which is linked into different proxy implementations. |
| 32 | +// |
| 33 | +// The processing order for this state in the mixer is: |
| 34 | +// |
| 35 | +// * Any new dictionary is applied |
| 36 | +// |
| 37 | +// * The requested attribute context is looked up. If no such context has been defined, a |
| 38 | +// new context is automatically created and initialized to the empty state. When a gRPC |
| 39 | +// stream is first created, there are no attribute contexts for the stream. |
| 40 | +// |
| 41 | +// * If reset_context is true, then the attribute context is reset to the |
| 42 | +// empty state. |
| 43 | +// |
| 44 | +// * All attribute changes are applied to the attribute context. |
| 45 | +// |
| 46 | +// * All deleted attributes are removed from the attribute context. |
| 47 | +// |
| 48 | +message Attributes { |
| 49 | + // A dictionary that provides a mapping of shorthand index values to |
| 50 | + // attribute names. |
| 51 | + // |
| 52 | + // This is intended to leverage the stateful gRPC stream from the |
| 53 | + // proxy to the mixer. This dictionary is sent over only when a |
| 54 | + // stream to the mixer is first established and when the proxy's |
| 55 | + // config changes and different attributes may be produced. |
| 56 | + // |
| 57 | + // Once a dictionary has been sent over, it stays in effect until |
| 58 | + // a new dictionary is sent to replace it. The first request sent on a |
| 59 | + // stream must include a dictionary, otherwise the mixer can't process |
| 60 | + // any attribute updates. |
| 61 | + // |
| 62 | + // Dictionaries are independent of the attribute context and are thus global |
| 63 | + // for the current gRPC stream. |
| 64 | + map<int32, string> dictionary = 1; |
| 65 | + |
| 66 | + // The attribute context against which to operate. |
| 67 | + // |
| 68 | + // The mixer keeps different contexts live for any proxy gRPC stream. This |
| 69 | + // allows the proxy to maintain multiple concurrent 'bags of attributes' |
| 70 | + // within the mixer. |
| 71 | + // |
| 72 | + // If the proxy doesn't want to leverage multiple contexts, it just passes |
| 73 | + // 0 here for every request. |
| 74 | + // |
| 75 | + // The proxy is configured to use a maximum number of attribute contexts in order |
| 76 | + // to prevent an explosion of contexts in the mixer's memory space. |
| 77 | + // |
| 78 | + // TODO: Consider removing support for this feature. The proxy can achieve |
| 79 | + // the same thing using multiple gRPC streams. The benefit of using streams |
| 80 | + // would be that the mixer would be in control of the maximum number of streams |
| 81 | + // it allows, whereas with the current model the proxy could overwhelm the |
| 82 | + // mixer by creating too many contexts. |
| 83 | + int32 attribute_context = 2; |
| 84 | + |
| 85 | + // When true, resets the current attribute context to the empty state before |
| 86 | + // applying any incoming attributes. |
| 87 | + // |
| 88 | + // Resetting contexts is useful to constrain the amount of resources used by |
| 89 | + // the mixer. The proxy needs to intelligently manage a pool of contexts. |
| 90 | + // It may be useful to reset a context when certain big events happen, such |
| 91 | + // as when an HTTP2 connection into the proxy terminates. |
| 92 | + bool reset_context = 3; |
| 93 | + |
| 94 | + // Attributes being updated within the specified attribute context. These maps |
| 95 | + // add and/or overwrite the context's current set of attributes. |
| 96 | + map<int32, string> string_attributes = 4; |
| 97 | + map<int32, int64> int64_attributes = 5; |
| 98 | + map<int32, double> double_attributes = 6; |
| 99 | + map<int32, bool> bool_attributes = 7; |
| 100 | + map<int32, google.protobuf.Timestamp> timestamp_attributes = 8; |
| 101 | + map<int32, bytes> bytes_attributes = 9; |
| 102 | + |
| 103 | + // Attributes that should be removed from the specified attribute context. Deleting |
| 104 | + // attributes which aren't currently in the attribute context is not considered an error. |
| 105 | + repeated int32 deleted_attributes = 10; |
| 106 | +} |
0 commit comments