-
Notifications
You must be signed in to change notification settings - Fork 73
Expand file tree
/
Copy pathruntime_options.h
More file actions
125 lines (102 loc) · 4.51 KB
/
Copy pathruntime_options.h
File metadata and controls
125 lines (102 loc) · 4.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef THIRD_PARTY_CEL_CPP_RUNTIME_RUNTIME_OPTIONS_H_
#define THIRD_PARTY_CEL_CPP_RUNTIME_RUNTIME_OPTIONS_H_
namespace cel {
// Options for unknown processing.
enum class UnknownProcessingOptions {
// No unknown processing.
kDisabled,
// Only attributes supported.
kAttributeOnly,
// Attributes and functions supported. Function results are dependent on the
// logic for handling unknown_attributes, so clients must opt in to both.
kAttributeAndFunction
};
// Options for handling unset wrapper types on field access.
enum class ProtoWrapperTypeOptions {
// Default: legacy behavior following proto semantics (unset behaves as though
// it is set to default value).
kUnsetProtoDefault,
// CEL spec behavior, unset wrapper is treated as a null value when accessed.
kUnsetNull,
};
// LINT.IfChange
// Interpreter options for controlling evaluation and builtin functions.
//
// Members should provide simple parameters for configuring core features and
// built-ins.
//
// Optimizations or features that have a heavy footprint should be added via an
// extension API.
struct RuntimeOptions {
// Level of unknown support enabled.
UnknownProcessingOptions unknown_processing =
UnknownProcessingOptions::kDisabled;
bool enable_missing_attribute_errors = false;
// Enable timestamp duration overflow checks.
//
// The CEL-Spec indicates that overflow should occur outside the range of
// string-representable timestamps, and at the limit of durations which can be
// expressed with a single int64_t value.
bool enable_timestamp_duration_overflow_errors = false;
// Enable short-circuiting of the logical operator evaluation. If enabled,
// AND, OR, and TERNARY do not evaluate the entire expression once the the
// resulting value is known from the left-hand side.
bool short_circuiting = true;
// Enable comprehension expressions (e.g. exists, all)
bool enable_comprehension = true;
// Set maximum number of iterations in the comprehension expressions if
// comprehensions are enabled. The limit applies globally per an evaluation,
// including the nested loops as well. Use value 0 to disable the upper bound.
int comprehension_max_iterations = 10000;
// Enable list append within comprehensions. Note, this option is not safe
// with hand-rolled ASTs.
bool enable_comprehension_list_append = false;
// Enable RE2 match() overload.
bool enable_regex = true;
// Set maximum program size for RE2 regex if regex overload is enabled.
// Evaluates to an error if a regex exceeds it. Use value 0 to disable the
// upper bound.
int regex_max_program_size = 0;
// Enable string() overloads.
bool enable_string_conversion = true;
// Enable string concatenation overload.
bool enable_string_concat = true;
// Enable list concatenation overload.
bool enable_list_concat = true;
// Enable list membership overload.
bool enable_list_contains = true;
// Treat builder warnings as fatal errors.
bool fail_on_warnings = true;
// Enable the resolution of qualified type identifiers as type values instead
// of field selections.
//
// This toggle may cause certain identifiers which overlap with CEL built-in
// type or with protobuf message types linked into the binary to be resolved
// as static type values rather than as per-eval variables.
bool enable_qualified_type_identifiers = false;
// Enable heterogeneous comparisons (e.g. support for cross-type comparisons).
bool enable_heterogeneous_equality = true;
// Enables unwrapping proto wrapper types to null if unset. e.g. if an
// expression access a field of type google.protobuf.Int64Value that is unset,
// that will result in a Null cel value, as opposed to returning the
// cel representation of the proto defined default int64_t: 0.
bool enable_empty_wrapper_null_unboxing = false;
};
// LINT.ThenChange(//depot/google3/eval/public/cel_options.h)
} // namespace cel
#endif // THIRD_PARTY_CEL_CPP_RUNTIME_RUNTIME_OPTIONS_H_