basic_seq.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
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 #ifndef GRPC_CORE_LIB_PROMISE_DETAIL_BASIC_SEQ_H
16 #define GRPC_CORE_LIB_PROMISE_DETAIL_BASIC_SEQ_H
17 
19 
20 #include <array>
21 #include <cassert>
22 #include <new>
23 #include <tuple>
24 #include <type_traits>
25 #include <utility>
26 
27 #include "absl/meta/type_traits.h"
28 #include "absl/types/variant.h"
29 #include "absl/utility/utility.h"
30 
36 
37 namespace grpc_core {
38 namespace promise_detail {
39 
40 // Helper for SeqState to evaluate some common types to all partial
41 // specializations.
42 template <template <typename> class Traits, typename FPromise, typename FNext>
43 struct SeqStateTypes {
44  // Our current promise.
45  using Promise = FPromise;
46  // The result of our current promise.
47  using PromiseResult = typename Promise::Result;
48  // Traits around the result of our promise.
49  using PromiseResultTraits = Traits<PromiseResult>;
50  // Wrap the factory callable in our factory wrapper to deal with common edge
51  // cases. We use the 'unwrapped type' from the traits, so for instance, TrySeq
52  // can pass back a T from a StatusOr<T>.
54  typename PromiseResultTraits::UnwrappedType, FNext>;
55 };
56 
57 // One state in a sequence.
58 // A state contains the current promise, and the promise factory to turn the
59 // result of the current promise into the next state's promise. We play a shell
60 // game such that the prior state and our current promise are kept in a union,
61 // and the next promise factory is kept alongside in the state struct.
62 // Recursively this guarantees that the next functions get initialized once, and
63 // destroyed once, and don't need to be moved around in between, which avoids a
64 // potential O(n**2) loop of next factory moves had we used a variant of states
65 // here. The very first state does not have a prior state, and so that state has
66 // a partial specialization below. The final state does not have a next state;
67 // that state is inlined in BasicSeq since that was simpler to type.
68 template <template <typename> class Traits, char I, typename... Fs>
69 struct SeqState {
70  // The state evaluated before this state.
71  using PriorState = SeqState<Traits, I - 1, Fs...>;
72  // Initialization from callables.
73  explicit SeqState(std::tuple<Fs*...> fs)
74  : next_factory(std::move(*std::get<I + 1>(fs))) {
75  new (&prior) PriorState(fs);
76  }
77  // Move constructor - assumes we're in the initial state (move prior) as it's
78  // illegal to move a promise after polling it.
79  SeqState(SeqState&& other) noexcept
80  : next_factory(std::move(other.next_factory)) {
81  new (&prior) PriorState(std::move(other.prior));
82  }
83  // Copy constructor - assumes we're in the initial state (move prior) as it's
84  // illegal to move a promise after polling it.
85  SeqState(const SeqState& other) : next_factory(other.next_factory) {
86  new (&prior) PriorState(std::move(other.prior));
87  }
88  // Empty destructor - we instead destruct the innards in BasicSeq manually
89  // depending on state.
90  ~SeqState() {}
91  // Evaluate the current promise, next promise factory types for this state.
92  // The current promise is the next promise from the prior state.
93  // The next factory callable is from the callables passed in:
94  // Fs[0] is the initial promise, Fs[1] is the state 0 next factory, Fs[2] is
95  // the state 1 next factory, etc...
96  using Types = SeqStateTypes<
97  Traits, typename PriorState::Types::Next::Promise,
98  typename std::tuple_element<I + 1, std::tuple<Fs...>>::type>;
99  // Storage for either the current promise or the prior state.
100  union {
101  // If we're in the prior state.
103  // The callables representing our promise.
105  };
106  // Storage for the next promise factory.
108 };
109 
110 // Partial specialization of SeqState above for the first state - it has no
111 // prior state, so we take the first callable from the template arg list and use
112 // it as a promise.
113 template <template <typename> class Traits, typename... Fs>
114 struct SeqState<Traits, 0, Fs...> {
115  // Initialization from callables.
116  explicit SeqState(std::tuple<Fs*...> args)
117  : current_promise(std::move(*std::get<0>(args))),
118  next_factory(std::move(*std::get<1>(args))) {}
119  // Move constructor - it's assumed we're in this state (see above).
120  SeqState(SeqState&& other) noexcept
121  : current_promise(std::move(other.current_promise)),
122  next_factory(std::move(other.next_factory)) {}
123  // Copy constructor - it's assumed we're in this state (see above).
124  SeqState(const SeqState& other)
126  next_factory(other.next_factory) {}
127  // Empty destructor - we instead destruct the innards in BasicSeq manually
128  // depending on state.
130  // Evaluate the current promise, next promise factory types for this state.
131  // Our callable is the first element of Fs, wrapped in PromiseLike to handle
132  // some common edge cases. The next factory is the second element.
133  using Types = SeqStateTypes<
134  Traits,
135  PromiseLike<typename std::tuple_element<0, std::tuple<Fs...>>::type>,
136  typename std::tuple_element<1, std::tuple<Fs...>>::type>;
139 };
140 
141 // Helper to get a specific state index.
142 // Calls the prior state, unless it's this state, in which case it returns
143 // that.
144 template <char I, template <typename> class Traits, char J, typename... Fs>
146  static SeqState<Traits, I, Fs...>* f(SeqState<Traits, J, Fs...>* p) {
148  }
149 };
150 
151 template <char I, template <typename> class Traits, typename... Fs>
152 struct GetSeqStateInner<I, Traits, I, Fs...> {
153  static SeqState<Traits, I, Fs...>* f(SeqState<Traits, I, Fs...>* p) {
154  return p;
155  }
156 };
157 
158 template <char I, template <typename> class Traits, char J, typename... Fs>
159 absl::enable_if_t<I <= J, SeqState<Traits, I, Fs...>*> GetSeqState(
160  SeqState<Traits, J, Fs...>* p) {
162 }
163 
164 template <template <typename> class Traits, char I, typename... Fs, typename T>
165 auto CallNext(SeqState<Traits, I, Fs...>* state, T&& arg)
167  CallFactory(&state->next_factory, std::forward<T>(arg))) {
168  return SeqState<Traits, I, Fs...>::Types::PromiseResultTraits::CallFactory(
169  &state->next_factory, std::forward<T>(arg));
170 }
171 
172 // A sequence under stome traits for some set of callables Fs.
173 // Fs[0] should be a promise-like object that yields a value.
174 // Fs[1..] should be promise-factory-like objects that take the value from the
175 // previous step and yield a promise. Note that most of the machinery in
176 // PromiseFactory exists to make it possible for those promise-factory-like
177 // objects to be anything that's convenient. Traits defines how we move from one
178 // step to the next. Traits sets up the wrapping and escape handling for the
179 // sequence. Promises return wrapped values that the trait can inspect and
180 // unwrap before passing them to the next element of the sequence. The trait can
181 // also interpret a wrapped value as an escape value, which terminates
182 // evaluation of the sequence immediately yielding a result. Traits for type T
183 // have the members:
184 // * type UnwrappedType - the type after removing wrapping from T (i.e. for
185 // TrySeq, T=StatusOr<U> yields UnwrappedType=U).
186 // * type WrappedType - the type after adding wrapping if it doesn't already
187 // exist (i.e. for TrySeq if T is not Status/StatusOr/void, then
188 // WrappedType=StatusOr<T>; if T is Status then WrappedType=Status (it's
189 // already wrapped!))
190 // * template <typename Next> void CallFactory(Next* next_factory, T&& value) -
191 // call promise factory next_factory with the result of unwrapping value, and
192 // return the resulting promise.
193 // * template <typename Result, typename RunNext> Poll<Result>
194 // CheckResultAndRunNext(T prior, RunNext run_next) - examine the value of
195 // prior, and decide to escape or continue. If escaping, return the final
196 // sequence value of type Poll<Result>. If continuing, return the value of
197 // run_next(std::move(prior)).
198 template <template <typename> class Traits, typename... Fs>
199 class BasicSeq {
200  private:
201  // Number of states in the sequence - we'll refer to this some!
202  static constexpr char N = sizeof...(Fs);
203 
204  // Current state.
205  static_assert(N < 128, "Long sequence... please revisit BasicSeq");
206  char state_ = 0;
207  // The penultimate state contains all the preceding states too.
208  using PenultimateState = SeqState<Traits, N - 2, Fs...>;
209  // The final state is simply the final promise, which is the next promise from
210  // the penultimate state.
212  union {
215  };
217  using Result = typename Traits<FinalPromiseResult>::WrappedType;
218 
219  // Get a state by index.
220  template <char I>
221  absl::enable_if_t < I<N - 2, SeqState<Traits, I, Fs...>*> state() {
222  return GetSeqState<I>(&penultimate_state_);
223  }
224 
225  template <char I>
227  return &penultimate_state_;
228  }
229 
230  // Get the next state's promise.
231  template <char I>
233  I != N - 2,
234  decltype(&GetSeqState<I + 1>(static_cast<PenultimateState*>(nullptr))
236  return &GetSeqState<I + 1>(&penultimate_state_)->current_promise;
237  }
238 
239  template <char I>
241  return &final_promise_;
242  }
243 
244  // Callable to advance the state to the next one after I given the result from
245  // state I.
246  template <char I>
247  struct RunNext {
249  template <typename T>
251  auto* prior = s->state<I>();
252  using StateType = absl::remove_reference_t<decltype(*prior)>;
253  // Destroy the promise that just completed.
254  Destruct(&prior->current_promise);
255  // Construct the next promise by calling the next promise factory.
256  // We need to ask the traits to do this to deal with value
257  // wrapping/unwrapping.
258  auto n = StateType::Types::PromiseResultTraits::CallFactory(
259  &prior->next_factory, std::forward<T>(value));
260  // Now we also no longer need the factory, so we can destroy that.
261  Destruct(&prior->next_factory);
262  // Constructing the promise for the new state will use the memory
263  // previously occupied by the promise & next factory of the old state.
265  // Store the state counter.
266  s->state_ = I + 1;
267  // Recursively poll the new current state.
268  return s->RunState<I + 1>();
269  }
270  };
271 
272  // Poll the current state, advance it if necessary.
273  template <char I>
275  // Get a pointer to the state object.
276  auto* s = state<I>();
277  // Poll the current promise in this state.
278  auto r = s->current_promise();
279  // If we are still pending, say so by returning.
280  if (absl::holds_alternative<Pending>(r)) {
281  return Pending();
282  }
283  // Current promise is ready, as the traits to do the next thing.
284  // That may be returning - eg if TrySeq sees an error.
285  // Or it may be by calling the callable we hand down - RunNext - which
286  // will advance the state and call the next promise.
287  return Traits<
288  typename absl::remove_reference_t<decltype(*s)>::Types::PromiseResult>::
289  template CheckResultAndRunNext<Result>(
290  std::move(absl::get<kPollReadyIdx>(std::move(r))),
291  RunNext<I>{this});
292  }
293 
294  // Specialization of RunState to run the final state.
295  template <char I>
297  // Poll the final promise.
298  auto r = final_promise_();
299  // If we are still pending, say so by returning.
300  if (absl::holds_alternative<Pending>(r)) {
301  return Pending();
302  }
303  // We are complete, return the (wrapped) result.
304  return Result(std::move(absl::get<kPollReadyIdx>(std::move(r))));
305  }
306 
307  // For state numbered I, destruct the current promise and the next promise
308  // factory, and recursively destruct the next promise factories for future
309  // states (since they also still exist).
310  template <char I>
311  absl::enable_if_t<I != N - 1, void>
313  Destruct(&GetSeqState<I>(&penultimate_state_)->current_promise);
314  DestructSubsequentFactories<I>();
315  }
316 
317  template <char I>
318  absl::enable_if_t<I == N - 1, void>
321  }
322 
323  // For state I, destruct the next promise factory, and recursively the next
324  // promise factories after.
325  template <char I>
327  Destruct(&GetSeqState<I>(&penultimate_state_)->next_factory);
328  DestructSubsequentFactories<I + 1>();
329  }
330 
331  template <char I>
333 
334  // Placate older compilers by wrapping RunState in a struct so that their
335  // parameter unpacking can work.
336  template <char I>
337  struct RunStateStruct {
339  Poll<Result> operator()() { return s->RunState<I>(); }
340  };
341 
342  // Similarly placate those compilers for
343  // DestructCurrentPromiseAndSubsequentFactories
344  template <char I>
347  void operator()() {
349  }
350  };
351 
352  // Run the current state (and possibly later states if that one finishes).
353  // Single argument is a type that encodes the integer sequence 0, 1, 2, ...,
354  // N-1 as a type, but which uses no memory. This is used to expand out
355  // RunState instances using a template unpack to pass to Switch, which encodes
356  // a switch statement over the various cases. This ultimately gives us a
357  // Duff's device like mechanic for evaluating sequences.
358  template <char... I>
360  return Switch<Poll<Result>>(state_, RunStateStruct<I>{this}...);
361  }
362 
363  // Run the appropriate destructors for a given state.
364  // Single argument is a type that encodes the integer sequence 0, 1, 2, ...,
365  // N-1 as a type, but which uses no memory. This is used to expand out
366  // DestructCurrentPromiseAndSubsequentFactories instances to pass to Switch,
367  // which can choose the correct instance at runtime to destroy everything.
368  template <char... I>
370  Switch<void>(
372  }
373 
374  public:
375  // Construct a sequence given the callables that will control it.
376  explicit BasicSeq(Fs... fs) : penultimate_state_(std::make_tuple(&fs...)) {}
377  // No assignment... we don't need it (but if we ever find a good case, then
378  // it's ok to implement).
379  BasicSeq& operator=(const BasicSeq&) = delete;
380  // Copy construction - only for state 0.
381  // It's illegal to copy a Promise after polling it - if we are in state>0 we
382  // *must* have been polled.
383  BasicSeq(const BasicSeq& other) {
384  assert(other.state_ == 0);
386  }
387  // Move construction - only for state 0.
388  // It's illegal to copy a Promise after polling it - if we are in state>0 we
389  // *must* have been polled.
390  BasicSeq(BasicSeq&& other) noexcept {
391  assert(other.state_ == 0);
392  new (&penultimate_state_)
393  PenultimateState(std::move(other.penultimate_state_));
394  }
395  // Destruct based on current state.
397 
398  // Poll the sequence once.
401  }
402 };
403 
404 // As above, but models a sequence of unknown size
405 // At each element, the accumulator A and the current value V is passed to some
406 // function of type F as f(V, A); f is expected to return a promise that
407 // resolves to Traits::WrappedType.
408 template <template <typename Wrapped> class Traits, typename F, typename Arg,
409  typename Iter>
411  private:
412  using IterValue = decltype(*std::declval<Iter>());
413  using StateCreated = decltype(std::declval<F>()(std::declval<IterValue>(),
414  std::declval<Arg>()));
416  using Wrapped = typename State::Result;
417 
418  public:
420  : cur_(begin), end_(end), f_(std::move(f)) {
421  if (cur_ == end_) {
423  } else {
425  }
426  }
427 
429  if (cur_ == end_) {
430  Destruct(&result_);
431  } else {
432  Destruct(&state_);
433  }
434  }
435 
436  BasicSeqIter(const BasicSeqIter& other) = delete;
437  BasicSeqIter& operator=(const BasicSeqIter&) = delete;
438 
439  BasicSeqIter(BasicSeqIter&& other) noexcept
440  : cur_(other.cur_), end_(other.end_), f_(std::move(other.f_)) {
441  if (cur_ == end_) {
442  Construct(&result_, std::move(other.result_));
443  } else {
444  Construct(&state_, std::move(other.state_));
445  }
446  }
447  BasicSeqIter& operator=(BasicSeqIter&& other) noexcept {
448  cur_ = other.cur_;
449  end_ = other.end_;
450  if (cur_ == end_) {
451  Construct(&result_, std::move(other.result_));
452  } else {
453  Construct(&state_, std::move(other.state_));
454  }
455  return *this;
456  }
457 
459  if (cur_ == end_) {
460  return std::move(result_);
461  }
462  return PollNonEmpty();
463  }
464 
465  private:
467  Poll<Wrapped> r = state_();
468  if (absl::holds_alternative<Pending>(r)) return r;
469  return Traits<Wrapped>::template CheckResultAndRunNext<Wrapped>(
470  std::move(absl::get<Wrapped>(r)), [this](Wrapped arg) -> Poll<Wrapped> {
471  auto next = cur_;
472  ++next;
473  if (next == end_) {
474  return std::move(arg);
475  }
476  cur_ = next;
477  state_.~State();
478  Construct(&state_,
479  Traits<Wrapped>::CallSeqFactory(f_, *cur_, std::move(arg)));
480  return PollNonEmpty();
481  });
482  }
483 
485  const Iter end_;
487  union {
490  };
491 };
492 
493 } // namespace promise_detail
494 } // namespace grpc_core
495 
496 #endif // GRPC_CORE_LIB_PROMISE_DETAIL_BASIC_SEQ_H
grpc_core::promise_detail::SeqStateTypes::PromiseResultTraits
Traits< PromiseResult > PromiseResultTraits
Definition: basic_seq.h:49
grpc_core::promise_detail::BasicSeqIter::BasicSeqIter
BasicSeqIter(Iter begin, Iter end, F f, Arg arg)
Definition: basic_seq.h:419
grpc_core::promise_detail::SeqState< Traits, 0, Fs... >::SeqState
SeqState(const SeqState &other)
Definition: basic_seq.h:124
grpc_core::promise_detail::BasicSeqIter
Definition: basic_seq.h:410
grpc_core::promise_detail::SeqStateTypes
Definition: basic_seq.h:43
get
absl::string_view get(const Cont &c)
Definition: abseil-cpp/absl/strings/str_replace_test.cc:185
grpc_core::promise_detail::SeqState::prior
GPR_NO_UNIQUE_ADDRESS PriorState prior
Definition: basic_seq.h:102
begin
char * begin
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1007
std::tr1::make_tuple
tuple make_tuple()
Definition: cares/cares/test/gmock-1.8.0/gtest/gtest.h:1619
grpc_core::promise_detail::BasicSeq::RunState
absl::enable_if_t< I !=N - 1, Poll< Result > > RunState()
Definition: basic_seq.h:274
grpc_core::promise_detail::SeqStateTypes::PromiseResult
typename Promise::Result PromiseResult
Definition: basic_seq.h:47
grpc_core
Definition: call_metric_recorder.h:31
grpc_core::promise_detail::BasicSeq::RunDestruct
void RunDestruct(absl::integer_sequence< char, I... >)
Definition: basic_seq.h:369
grpc_core::promise_detail::GetSeqStateInner
Definition: basic_seq.h:145
grpc_core::promise_detail::BasicSeq::DestructCurrentPromiseAndSubsequentFactoriesStruct::s
BasicSeq * s
Definition: basic_seq.h:346
grpc_core::promise_detail::SeqState< Traits, 0, Fs... >::current_promise
GPR_NO_UNIQUE_ADDRESS Types::Promise current_promise
Definition: basic_seq.h:137
grpc_core::promise_detail::BasicSeqIter::BasicSeqIter
BasicSeqIter(BasicSeqIter &&other) noexcept
Definition: basic_seq.h:439
grpc_core::promise_detail::BasicSeq::~BasicSeq
~BasicSeq()
Definition: basic_seq.h:396
grpc_core::promise_detail::BasicSeq::BasicSeq
BasicSeq(Fs... fs)
Definition: basic_seq.h:376
absl::enable_if_t
typename std::enable_if< B, T >::type enable_if_t
Definition: abseil-cpp/absl/meta/type_traits.h:631
grpc_core::promise_detail::GetSeqStateInner::f
static SeqState< Traits, I, Fs... > * f(SeqState< Traits, J, Fs... > *p)
Definition: basic_seq.h:146
grpc_core::promise_detail::BasicSeq::RunStateStruct
Definition: basic_seq.h:337
grpc_core::promise_detail::BasicSeq::N
static constexpr char N
Definition: basic_seq.h:202
Arg
Arg(64) -> Arg(128) ->Arg(256) ->Arg(512) ->Arg(1024) ->Arg(1536) ->Arg(2048) ->Arg(3072) ->Arg(4096) ->Arg(5120) ->Arg(6144) ->Arg(7168)
grpc_core::promise_detail::BasicSeqIter::result_
GPR_NO_UNIQUE_ADDRESS Arg result_
Definition: basic_seq.h:489
grpc_core::promise_detail::BasicSeq::penultimate_state_
GPR_NO_UNIQUE_ADDRESS PenultimateState penultimate_state_
Definition: basic_seq.h:213
grpc_core::promise_detail::BasicSeq::RunState
absl::enable_if_t< I==N - 1, Poll< Result > > RunState()
Definition: basic_seq.h:296
T
#define T(upbtypeconst, upbtype, ctype, default_value)
grpc_core::promise_detail::BasicSeq::operator=
BasicSeq & operator=(const BasicSeq &)=delete
grpc_core::promise_detail::BasicSeq::RunStateStruct::operator()
Poll< Result > operator()()
Definition: basic_seq.h:339
grpc_core::promise_detail::SeqState::next_factory
GPR_NO_UNIQUE_ADDRESS Types::Next next_factory
Definition: basic_seq.h:107
grpc_core::promise_detail::BasicSeq::RunNext::s
BasicSeq * s
Definition: basic_seq.h:248
promise_factory.h
grpc_core::promise_detail::BasicSeqIter::end_
const Iter end_
Definition: basic_seq.h:485
gen_gtest_pred_impl.Iter
def Iter(n, format, sep='')
Definition: bloaty/third_party/googletest/googletest/scripts/gen_gtest_pred_impl.py:188
grpc_core::Pending
Definition: poll.h:29
grpc_core::promise_detail::BasicSeq::final_promise_
GPR_NO_UNIQUE_ADDRESS FinalPromise final_promise_
Definition: basic_seq.h:214
grpc_core::promise_detail::BasicSeq::RunNext
Definition: basic_seq.h:247
absl::make_integer_sequence
typename utility_internal::Gen< T, N >::type make_integer_sequence
Definition: abseil-cpp/absl/utility/utility.h:142
grpc_core::promise_detail::BasicSeq::FinalPromise
typename PenultimateState::Types::Next::Promise FinalPromise
Definition: basic_seq.h:211
grpc_core::promise_detail::SeqStateTypes::Promise
FPromise Promise
Definition: basic_seq.h:45
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc_core::promise_detail::SeqState::SeqState
SeqState(const SeqState &other)
Definition: basic_seq.h:85
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
re2::Result
TestInstance::Result Result
Definition: bloaty/third_party/re2/re2/testing/tester.cc:96
grpc_core::promise_detail::SeqState< Traits, 0, Fs... >::SeqState
SeqState(SeqState &&other) noexcept
Definition: basic_seq.h:120
grpc_core::promise_detail::BasicSeq::FinalPromiseResult
typename FinalPromise::Result FinalPromiseResult
Definition: basic_seq.h:216
absl::integer_sequence
Definition: abseil-cpp/absl/utility/utility.h:76
grpc_core::promise_detail::BasicSeq::DestructCurrentPromiseAndSubsequentFactories
absl::enable_if_t< I !=N - 1, void > DestructCurrentPromiseAndSubsequentFactories()
Definition: basic_seq.h:312
grpc_core::promise_detail::BasicSeq::operator()
Poll< Result > operator()()
Definition: basic_seq.h:399
grpc_core::promise_detail::BasicSeqIter::~BasicSeqIter
~BasicSeqIter()
Definition: basic_seq.h:428
grpc_core::promise_detail::BasicSeqIter::IterValue
decltype(*std::declval< Iter >()) IterValue
Definition: basic_seq.h:412
arg
Definition: cmdline.cc:40
grpc_core::promise_detail::BasicSeq::state_
char state_
Definition: basic_seq.h:206
grpc_core::promise_detail::SeqState::current_promise
GPR_NO_UNIQUE_ADDRESS Types::Promise current_promise
Definition: basic_seq.h:104
grpc_core::promise_detail::SeqState< Traits, 0, Fs... >::~SeqState
~SeqState()
Definition: basic_seq.h:129
grpc_core::promise_detail::BasicSeq::RunStateStruct::s
BasicSeq * s
Definition: basic_seq.h:338
grpc_core::promise_detail::BasicSeqIter::Wrapped
typename State::Result Wrapped
Definition: basic_seq.h:416
grpc_core::promise_detail::BasicSeqIter::operator()
Poll< Wrapped > operator()()
Definition: basic_seq.h:458
grpc_core::promise_detail::BasicSeqIter::state_
GPR_NO_UNIQUE_ADDRESS State state_
Definition: basic_seq.h:488
GPR_NO_UNIQUE_ADDRESS
#define GPR_NO_UNIQUE_ADDRESS
Definition: impl/codegen/port_platform.h:692
grpc_core::promise_detail::BasicSeq::PenultimateState
SeqState< Traits, N - 2, Fs... > PenultimateState
Definition: basic_seq.h:208
switch.h
grpc_core::promise_detail::BasicSeqIter::cur_
Iter cur_
Definition: basic_seq.h:484
grpc_core::promise_detail::BasicSeq::Result
typename Traits< FinalPromiseResult >::WrappedType Result
Definition: basic_seq.h:217
F
#define F(b, c, d)
Definition: md4.c:112
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
grpc_core::promise_detail::BasicSeq::DestructSubsequentFactories
absl::enable_if_t< I !=N - 1, void > DestructSubsequentFactories()
Definition: basic_seq.h:326
grpc_core::promise_detail::SeqState::~SeqState
~SeqState()
Definition: basic_seq.h:90
grpc_core::promise_detail::SeqState< Traits, 0, Fs... >::next_factory
GPR_NO_UNIQUE_ADDRESS Types::Next next_factory
Definition: basic_seq.h:138
grpc_core::promise_detail::PromiseLike::Result
typename PollTraits< decltype(WrapInPoll(f_()))>::Type Result
Definition: promise_like.h:75
grpc_core::Construct
void Construct(T *p, Args &&... args)
Definition: construct_destruct.h:34
value
const char * value
Definition: hpack_parser_table.cc:165
grpc_core::promise_detail::BasicSeqIter::operator=
BasicSeqIter & operator=(BasicSeqIter &&other) noexcept
Definition: basic_seq.h:447
grpc_core::Destruct
void Destruct(T *p)
Definition: construct_destruct.h:27
grpc_core::promise_detail::BasicSeqIter::operator=
BasicSeqIter & operator=(const BasicSeqIter &)=delete
grpc_core::promise_detail::GetSeqStateInner< I, Traits, I, Fs... >::f
static SeqState< Traits, I, Fs... > * f(SeqState< Traits, I, Fs... > *p)
Definition: basic_seq.h:153
I
#define I(b, c, d)
Definition: md5.c:120
grpc_core::promise_detail::BasicSeqIter::f_
GPR_NO_UNIQUE_ADDRESS F f_
Definition: basic_seq.h:486
promise_like.h
grpc_core::promise_detail::PromiseFactory
Definition: promise_factory.h:149
poll.h
grpc_core::Promise
std::function< Poll< T >()> Promise
Definition: promise/promise.h:37
grpc_core::promise_detail::SeqState< Traits, 0, Fs... >::SeqState
SeqState(std::tuple< Fs *... > args)
Definition: basic_seq.h:116
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
grpc_core::promise_detail::SeqState
Definition: basic_seq.h:69
fix_build_deps.r
r
Definition: fix_build_deps.py:491
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
grpc_core::promise_detail::BasicSeq::DestructCurrentPromiseAndSubsequentFactories
absl::enable_if_t< I==N - 1, void > DestructCurrentPromiseAndSubsequentFactories()
Definition: basic_seq.h:319
grpc_core::promise_detail::BasicSeq::next_promise
absl::enable_if_t< I==N - 2, FinalPromise * > next_promise()
Definition: basic_seq.h:240
grpc_core::promise_detail::BasicSeq
Definition: basic_seq.h:199
grpc_core::promise_detail::BasicSeq::BasicSeq
BasicSeq(BasicSeq &&other) noexcept
Definition: basic_seq.h:390
grpc_core::promise_detail::BasicSeq::BasicSeq
BasicSeq(const BasicSeq &other)
Definition: basic_seq.h:383
grpc_core::promise_detail::BasicSeqIter::StateCreated
decltype(std::declval< F >()(std::declval< IterValue >(), std::declval< Arg >())) StateCreated
Definition: basic_seq.h:414
grpc_core::promise_detail::SeqState::SeqState
SeqState(SeqState &&other) noexcept
Definition: basic_seq.h:79
grpc_core::promise_detail::BasicSeq::RunNext::operator()
Poll< Result > operator()(T &&value)
Definition: basic_seq.h:250
grpc_core::promise_detail::SeqState::SeqState
SeqState(std::tuple< Fs *... > fs)
Definition: basic_seq.h:73
grpc_core::promise_detail::BasicSeq::Run
Poll< Result > Run(absl::integer_sequence< char, I... >)
Definition: basic_seq.h:359
grpc_core::promise_detail::BasicSeqIter::PollNonEmpty
Poll< Wrapped > PollNonEmpty()
Definition: basic_seq.h:466
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
grpc_core::promise_detail::BasicSeq::DestructCurrentPromiseAndSubsequentFactoriesStruct
Definition: basic_seq.h:345
setup.template
template
Definition: setup.py:47
grpc_core::promise_detail::BasicSeq::DestructCurrentPromiseAndSubsequentFactoriesStruct::operator()
void operator()()
Definition: basic_seq.h:347
absl::variant
Definition: abseil-cpp/absl/types/internal/variant.h:46
grpc_core::promise_detail::PromiseLike
Definition: promise_like.h:67
absl::remove_reference_t
typename std::remove_reference< T >::type remove_reference_t
Definition: abseil-cpp/absl/meta/type_traits.h:597
construct_destruct.h
grpc_core::promise_detail::BasicSeq::current_promise
absl::enable_if_t< I< N - 2, SeqState< Traits, I, Fs... > * > state() { return GetSeqState< I > &penultimate_state_);} template< char I > absl::enable_if_t< I==N - 2, PenultimateState * > state() { return &penultimate_state_;} template< char I > auto next_promise() -> absl::enable_if_t< I !=N - 2, decltype(&GetSeqState< I+1 >static_cast< PenultimateState * >nullptr)) -> current_promise
Definition: basic_seq.h:235
state
static struct rpc_state state
Definition: bad_server_response_test.cc:87
grpc_core::promise_detail::SeqState::Types
SeqStateTypes< Traits, typename PriorState::Types::Next::Promise, typename std::tuple_element< I+1, std::tuple< Fs... > >::type > Types
Definition: basic_seq.h:98
grpc_core::promise_detail::SeqState::PriorState
SeqState< Traits, I - 1, Fs... > PriorState
Definition: basic_seq.h:71
port_platform.h
grpc_core::promise_detail::BasicSeq::DestructSubsequentFactories
absl::enable_if_t< I==N - 1, void > DestructSubsequentFactories()
Definition: basic_seq.h:332


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:36