libstore: make BinaryCacheStore::getFile abstract
all extant derived classes implement this method, making the default implementation not very useful. should it ever be needed again it'll be easy enough for derived classes to return an owning StringSource. Change-Id: I65e041e7a4e7b161f0f404f4287cea5440b5a749
This commit is contained in:
@@ -65,13 +65,6 @@ void BinaryCacheStore::upsertFile(const std::string & path,
|
||||
upsertFile(path, std::make_shared<std::stringstream>(std::move(data)), mimeType);
|
||||
}
|
||||
|
||||
box_ptr<Source> BinaryCacheStore::getFile(const std::string & path)
|
||||
{
|
||||
return make_box_ptr<GeneratorSource>([](std::string data) -> Generator<Bytes> {
|
||||
co_yield std::span{data.data(), data.size()};
|
||||
}(std::move(*getFileContents(path))));
|
||||
}
|
||||
|
||||
std::optional<std::string> BinaryCacheStore::getFileContents(const std::string & path)
|
||||
{
|
||||
StringSink sink;
|
||||
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
/**
|
||||
* Dump the contents of the specified file to a sink.
|
||||
*/
|
||||
virtual box_ptr<Source> getFile(const std::string & path);
|
||||
virtual box_ptr<Source> getFile(const std::string & path) = 0;
|
||||
|
||||
virtual std::optional<std::string> getFileContents(const std::string & path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user