Skip to content

Commit aea22d7

Browse files
authored
Remove c++14 support in proxy-wasm. (#38)
Signed-off-by: John Plevyak <[email protected]>
1 parent 5cec30b commit aea22d7

File tree

5 files changed

+161
-151
lines changed

5 files changed

+161
-151
lines changed

contrib/proxy_expr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
// Create an expression using a foreign function call.
19-
inline WasmResult createExpression(StringView expr, uint32_t *token) {
19+
inline WasmResult createExpression(std::string_view expr, uint32_t *token) {
2020
std::string function = "expr_create";
2121
char *out = nullptr;
2222
size_t out_size = 0;
@@ -30,7 +30,7 @@ inline WasmResult createExpression(StringView expr, uint32_t *token) {
3030
}
3131

3232
// Evaluate an expression using an expression token.
33-
inline Optional<WasmDataPtr> exprEvaluate(uint32_t token) {
33+
inline std::optional<WasmDataPtr> exprEvaluate(uint32_t token) {
3434
std::string function = "expr_evaluate";
3535
char *out = nullptr;
3636
size_t out_size = 0;

docs/wasm_filter.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ The following methods on context object are supported.
242242
### httpCall
243243

244244
``` {.sourceCode .cpp}
245-
void httpCall(StringView cluster,
245+
void httpCall(std::string_view cluster,
246246
const HeaderStringPairs& request_headers,
247-
StringView request_body,
247+
std::string_view request_body,
248248
const HeaderStringPairs& request_trailers,
249249
uint32_t timeout_milliseconds,
250250
HttpCallCallback callback)
@@ -270,13 +270,13 @@ called when the HTTP request finishes.
270270

271271
``` {.sourceCode .cpp}
272272
template<typename Response>
273-
void grpcSimpleCall(StringView service,
274-
StringView service_name,
275-
StringView method_name,
273+
void grpcSimpleCall(std::string_view service,
274+
std::string_view service_name,
275+
std::string_view method_name,
276276
const google::protobuf::MessageLite &request,
277277
uint32_t timeout_milliseconds,
278278
std::function<void(Response&& response)> success_callback,
279-
std::function<void(GrpcStatus status, StringView error_message)> failure_callback)
279+
std::function<void(GrpcStatus status, std::string_view error_message)> failure_callback)
280280
```
281281

282282
Makes a unary gRPC call to an upstream host.
@@ -304,9 +304,9 @@ invoked when gRPC call fails. *status* is the returned gRPC status code.
304304

305305
``` {.sourceCode .cpp}
306306
void grpcCallHandler(
307-
StringView service,
308-
StringView service_name,
309-
StringView method_name,
307+
std::string_view service,
308+
std::string_view service_name,
309+
std::string_view method_name,
310310
const google::protobuf::MessageLite &request,
311311
uint32_t timeout_milliseconds,
312312
std::unique_ptr<GrpcCallHandlerBase> handler)
@@ -323,9 +323,9 @@ target for callback and fine grained control on the call.
323323
### grpcStreamHandler
324324

325325
``` {.sourceCode .cpp}
326-
void grpcStreamHandler(StringView service,
327-
StringView service_name,
328-
StringView method_name,
326+
void grpcStreamHandler(std::string_view service,
327+
std::string_view service_name,
328+
std::string_view method_name,
329329
std::unique_ptr<GrpcStreamHandlerBase> handler)
330330
```
331331

@@ -367,7 +367,7 @@ Header API
367367
### addRequestHeader
368368

369369
``` {.sourceCode .cpp}
370-
void addRequestHeader(StringView key, StringView value)
370+
void addRequestHeader(std::string_view key, StringView value)
371371
```
372372

373373
Adds a new request header with the key and value if header does not
@@ -378,7 +378,7 @@ only when called in
378378
### replaceRequestHeader
379379

380380
``` {.sourceCode .cpp}
381-
void replaceRequestHeader(StringView key, StringView value)
381+
void replaceRequestHeader(std::string_view key, StringView value)
382382
```
383383

384384
Replaces the value of an existing request header with the given key, or
@@ -389,7 +389,7 @@ method is effective only when called in
389389
### removeRequestHeader
390390

391391
``` {.sourceCode .cpp}
392-
void removeRequestHeader(StringView key)
392+
void removeRequestHeader(std::string_view key)
393393
```
394394

395395
Removes request header with the given key. No-op if the request header
@@ -410,7 +410,7 @@ effective only when called in
410410
### getRequestHeader
411411

412412
``` {.sourceCode .cpp}
413-
WasmDataPtr getRequestHeader(StringView key)
413+
WasmDataPtr getRequestHeader(std::string_view key)
414414
```
415415

416416
Gets value of header with the given key. Returns empty string if header
@@ -437,7 +437,7 @@ contains header pairs data.
437437
### addResponseHeader
438438

439439
``` {.sourceCode .cpp}
440-
void addResponseHeader(StringView key, StringView value)
440+
void addResponseHeader(std::string_view key, StringView value)
441441
```
442442

443443
Adds a new response header with the key and value if header does not
@@ -448,7 +448,7 @@ only when called in
448448
### replaceResponseHeader
449449

450450
``` {.sourceCode .cpp}
451-
void replaceResponseHeader(StringView key, StringView value)
451+
void replaceResponseHeader(std::string_view key, StringView value)
452452
```
453453

454454
Replaces the value of an existing response header with the given key, or
@@ -459,7 +459,7 @@ This method is effective only when called in
459459
### removeResponseHeader
460460

461461
``` {.sourceCode .cpp}
462-
void removeResponseHeader(StringView key)
462+
void removeResponseHeader(std::string_view key)
463463
```
464464

465465
Removes response header with the given key. No-op if the response header
@@ -480,7 +480,7 @@ is effective only when called in
480480
### getResponseHeader
481481

482482
``` {.sourceCode .cpp}
483-
WasmDataPtr getResponseHeader(StringView key)
483+
WasmDataPtr getResponseHeader(std::string_view key)
484484
```
485485

486486
Gets value of header with the given key. Returns empty string if header
@@ -507,7 +507,7 @@ holds the header pairs.
507507
### addRequestTrailer
508508

509509
``` {.sourceCode .cpp}
510-
void addRequestTrailer(StringView key, StringView value)
510+
void addRequestTrailer(std::string_view key, StringView value)
511511
```
512512

513513
Adds a new request trailer with the key and value if trailer does not
@@ -518,7 +518,7 @@ only when called in
518518
### replaceRequestTrailer
519519

520520
``` {.sourceCode .cpp}
521-
void replaceRequestTrailer(StringView key, StringView value)
521+
void replaceRequestTrailer(std::string_view key, StringView value)
522522
```
523523

524524
Replaces the value of an existing request trailer with the given key, or
@@ -529,7 +529,7 @@ This method is effective only when called in
529529
### removeRequestTrailer
530530

531531
``` {.sourceCode .cpp}
532-
void removeRequestTrailer(StringView key)
532+
void removeRequestTrailer(std::string_view key)
533533
```
534534

535535
Removes request trailer with the given key. No-op if the request trailer
@@ -550,7 +550,7 @@ effective only when called in
550550
### getRequestTrailer
551551

552552
``` {.sourceCode .cpp}
553-
WasmDataPtr getRequestTrailer(StringView key)
553+
WasmDataPtr getRequestTrailer(std::string_view key)
554554
```
555555

556556
Gets value of trailer with the given key. Returns empty string if
@@ -575,7 +575,7 @@ holds the trailer pairs.
575575
### addResponseTrailer
576576

577577
``` {.sourceCode .cpp}
578-
void addResponseTrailer(StringView key, StringView value)
578+
void addResponseTrailer(std::string_view key, StringView value)
579579
```
580580

581581
Adds a new response trailer with the key and value if trailer does not
@@ -586,7 +586,7 @@ only when called in
586586
### replaceResponseTrailer
587587

588588
``` {.sourceCode .cpp}
589-
void replaceResponseTrailer(StringView key, StringView value)
589+
void replaceResponseTrailer(std::string_view key, StringView value)
590590
```
591591

592592
Replaces the value of an existing response trailer with the given key,
@@ -597,7 +597,7 @@ This method is effective only when called in
597597
### removeResponseTrailer
598598

599599
``` {.sourceCode .cpp}
600-
void removeResponseTrailer(StringView key)
600+
void removeResponseTrailer(std::string_view key)
601601
```
602602

603603
Removes response trailer with the given key. No-op if the response
@@ -618,7 +618,7 @@ method is effective only when called in
618618
### getResponseTrailer
619619

620620
``` {.sourceCode .cpp}
621-
WasmDataPtr getResponseTrailer(StringView key)
621+
WasmDataPtr getResponseTrailer(std::string_view key)
622622
```
623623

624624
Gets value of trailer with the given key. Returns empty string if
@@ -733,7 +733,7 @@ host stats sink.
733733
#### New
734734

735735
``` {.sourceCode .cpp}
736-
static Counter<Tags...>* New(StringView name, MetricTagDescriptor<Tags>... fieldnames)
736+
static Counter<Tags...>* New(std::string_view name, MetricTagDescriptor<Tags>... fieldnames)
737737
```
738738

739739
Create a new counter with the given metric name and tag names. Example
@@ -816,7 +816,7 @@ Returns current value of a counter.
816816
#### New
817817

818818
``` {.sourceCode .cpp}
819-
static Gauge<Tags...>* New(StringView name, MetricTagDescriptor<Tags>... fieldnames)
819+
static Gauge<Tags...>* New(std::string_view name, MetricTagDescriptor<Tags>... fieldnames)
820820
```
821821

822822
Create a new gauge with the given metric name and tag names. Example
@@ -900,7 +900,7 @@ Returns current value of a gauge.
900900
#### New
901901

902902
``` {.sourceCode .cpp}
903-
static Histogram<Tags...>* New(StringView name, MetricTagDescriptor<Tags>... fieldnames)
903+
static Histogram<Tags...>* New(std::string_view name, MetricTagDescriptor<Tags>... fieldnames)
904904
```
905905

906906
Create a new histogram object with the given metric name and tag names.
@@ -1138,7 +1138,7 @@ Returns the start pointer of the data.
11381138
#### view
11391139

11401140
``` {.sourceCode .cpp}
1141-
StringView view()
1141+
std::string_view view()
11421142
```
11431143

11441144
Returns data as a string view constructed with the start pointer and the
@@ -1155,7 +1155,7 @@ Returns data as a string by converting the string view to string.
11551155
#### pairs
11561156

11571157
``` {.sourceCode .cpp}
1158-
std::vector<std::pair<StringView, StringView>> pairs()
1158+
std::vector<std::pair<std::string_view, StringView>> pairs()
11591159
```
11601160

11611161
Returns a vector of string view pair parsed from the data.

0 commit comments

Comments
 (0)