|
|
|
@ -162,6 +162,10 @@ class ChannelInit { |
|
|
|
|
// Add a predicate that ensures this filter does not appear in the minimal
|
|
|
|
|
// stack.
|
|
|
|
|
FilterRegistration& ExcludeFromMinimalStack(); |
|
|
|
|
FilterRegistration& SkipV3() { |
|
|
|
|
skip_v3_ = true; |
|
|
|
|
return *this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
friend class ChannelInit; |
|
|
|
@ -172,6 +176,7 @@ class ChannelInit { |
|
|
|
|
std::vector<InclusionPredicate> predicates_; |
|
|
|
|
bool terminal_ = false; |
|
|
|
|
bool before_all_ = false; |
|
|
|
|
bool skip_v3_ = false; |
|
|
|
|
SourceLocation registration_source_; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -195,6 +200,15 @@ class ChannelInit { |
|
|
|
|
registration_source); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Filter does not participate in v3
|
|
|
|
|
template <typename Filter> |
|
|
|
|
FilterRegistration& RegisterV2Filter( |
|
|
|
|
grpc_channel_stack_type type, SourceLocation registration_source = {}) { |
|
|
|
|
return RegisterFilter(type, &Filter::kFilter, nullptr, |
|
|
|
|
registration_source) |
|
|
|
|
.SkipV3(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Register a post processor for the builder.
|
|
|
|
|
// These run after the main graph has been placed into the builder.
|
|
|
|
|
// At most one filter per slot per channel stack type can be added.
|
|
|
|
@ -274,16 +288,18 @@ class ChannelInit { |
|
|
|
|
private: |
|
|
|
|
struct Filter { |
|
|
|
|
Filter(const grpc_channel_filter* filter, const ChannelFilterVtable* vtable, |
|
|
|
|
std::vector<InclusionPredicate> predicates, |
|
|
|
|
std::vector<InclusionPredicate> predicates, bool skip_v3, |
|
|
|
|
SourceLocation registration_source) |
|
|
|
|
: filter(filter), |
|
|
|
|
vtable(vtable), |
|
|
|
|
predicates(std::move(predicates)), |
|
|
|
|
registration_source(registration_source) {} |
|
|
|
|
registration_source(registration_source), |
|
|
|
|
skip_v3(skip_v3) {} |
|
|
|
|
const grpc_channel_filter* filter; |
|
|
|
|
const ChannelFilterVtable* vtable; |
|
|
|
|
std::vector<InclusionPredicate> predicates; |
|
|
|
|
SourceLocation registration_source; |
|
|
|
|
bool skip_v3 = false; |
|
|
|
|
bool CheckPredicates(const ChannelArgs& args) const; |
|
|
|
|
}; |
|
|
|
|
struct StackConfig { |
|
|
|
|