| 1969 | /// This generator will queue up to max_q blocks |
| 1970 | template <typename T> |
| 1971 | Result<AsyncGenerator<T>> MakeBackgroundGenerator( |
| 1972 | Iterator<T> iterator, internal::Executor* io_executor, |
| 1973 | int max_q = kDefaultBackgroundMaxQ, int q_restart = kDefaultBackgroundQRestart) { |
| 1974 | if (max_q < q_restart) { |
| 1975 | return Status::Invalid("max_q must be >= q_restart"); |
| 1976 | } |
| 1977 | return BackgroundGenerator<T>(std::move(iterator), io_executor, max_q, q_restart); |
| 1978 | } |
| 1979 | |
| 1980 | /// \brief Create an AsyncGenerator<T> by iterating over an Iterator<T> synchronously |
| 1981 | /// |