(&mut self)
| 342 | type Item = RecordBatch; |
| 343 | |
| 344 | fn next(&mut self) -> Option<Self::Item> { |
| 345 | if self.row_count == self.options.row_limit { |
| 346 | return None; |
| 347 | } |
| 348 | |
| 349 | let row_limit = self |
| 350 | .max_batch_size |
| 351 | .min(self.options.row_limit - self.row_count); |
| 352 | |
| 353 | let mut builder = BatchBuilder { |
| 354 | options: GeneratorOptions { |
| 355 | row_limit, |
| 356 | ..self.options.clone() |
| 357 | }, |
| 358 | ..Default::default() |
| 359 | }; |
| 360 | |
| 361 | let host = format!( |
| 362 | "i-{:016x}.ec2.internal", |
| 363 | self.host_idx * 0x7d87f8ed5c5 + 0x1ec3ca3151468928 |
| 364 | ); |
| 365 | self.host_idx += 1; |
| 366 | |
| 367 | for service in &["frontend", "backend", "database", "cache"] { |
| 368 | if self.rng.random_bool(0.5) { |
| 369 | continue; |
| 370 | } |
| 371 | if builder.is_finished() { |
| 372 | break; |
| 373 | } |
| 374 | builder.append(&mut self.rng, &host, service); |
| 375 | } |
| 376 | |
| 377 | let batch = builder.finish(Arc::clone(&self.schema)); |
| 378 | |
| 379 | self.row_count += batch.num_rows(); |
| 380 | Some(batch) |
| 381 | } |
| 382 | } |
nothing calls this directly
no test coverage detected