pipe method
Implementation
Future<GtfsDataset> pipe({Directory? tempDir}) async {
final dataset = await getSource(tempDir: tempDir);
GtfsDataset currentDataset = this;
final pipingWatch = Stopwatch();
final totalWatch = Stopwatch();
pipingWatch.start();
totalWatch.start();
for (final parser in parsers) {
final files = <String, FileOpener>{};
for (final fileEntry in parser.listenedFiles.entries) {
if (dataset.any((element) => element.name == fileEntry.key) ||
fileEntry.value) {
files[fileEntry.key] = dataset.firstWhere(
(element) => element.name == fileEntry.key,
orElse: () => throw MissingFileException(fileEntry.key),
);
}
}
currentDataset = await parser.initializeDataStream(currentDataset, files);
_logger.info(
'Finished piping with ${parser.runtimeType} in ${pipingWatch.elapsedMilliseconds} ms',
);
pipingWatch.reset();
}
for (final binding in bindings) {
await binding.prepare();
}
totalWatch.stop();
_logger.info('Piping done in ${totalWatch.elapsedMilliseconds} ms');
return currentDataset;
}