| 1863 | /// This generator will queue up to max_q blocks |
| 1864 | template <typename T> |
| 1865 | static Result<AsyncGenerator<T>> MakeBackgroundGenerator( |
| 1866 | Iterator<T> iterator, internal::Executor* io_executor, |
| 1867 | int max_q = kDefaultBackgroundMaxQ, int q_restart = kDefaultBackgroundQRestart) { |
| 1868 | if (max_q < q_restart) { |
| 1869 | return Status::Invalid("max_q must be >= q_restart"); |
| 1870 | } |
| 1871 | return BackgroundGenerator<T>(std::move(iterator), io_executor, max_q, q_restart); |
| 1872 | } |
| 1873 | |
| 1874 | /// \brief Create an AsyncGenerator<T> by iterating over an Iterator<T> synchronously |
| 1875 | /// |