More config machinery: the reader now reads (but can't put the resulting image

anywhere).
This commit is contained in:
David Given
2021-05-12 00:26:42 +02:00
parent cf9cef6f87
commit df0a9bac96
15 changed files with 194 additions and 48 deletions

View File

@@ -2,6 +2,7 @@
#include "flags.h"
#include "dataspec.h"
#include "fluxsource/fluxsource.h"
#include "lib/config.pb.h"
static bool ends_with(const std::string& value, const std::string& ending)
{
@@ -24,3 +25,15 @@ std::unique_ptr<FluxSource> FluxSource::create(const FluxSpec& spec)
Error() << "unrecognised flux filename extension";
return std::unique_ptr<FluxSource>();
}
std::unique_ptr<FluxSource> FluxSource::create(const Config_InputDisk& config)
{
if (config.has_fluxfile())
return createSqliteFluxSource(config.fluxfile());
else
return createHardwareFluxSource(config.drive());
Error() << "bad input disk configuration";
return std::unique_ptr<FluxSource>();
}