storage/Interface: add virtual method OpenFile()

This should replace most InputStream::Open() calls because it is a
chance to reuse existing resources (e.g. the NFS connection).  No such
optimization is implemented, currently (and the method is not yet used
by anybody).
This commit is contained in:
Max Kellermann
2014-10-02 10:06:34 +02:00
committed by Max Kellermann
parent 2576e66a55
commit f578a1cb2b
11 changed files with 199 additions and 2 deletions

View File

@@ -3,6 +3,9 @@
#pragma once
#include "input/Ptr.hxx"
#include "thread/Mutex.hxx"
#include <memory>
#include <string>
#include <string_view>
@@ -69,4 +72,12 @@ public:
*/
[[nodiscard]] [[gnu::pure]]
virtual std::string_view MapToRelativeUTF8(std::string_view uri_utf8) const noexcept = 0;
/**
* Open a file in this storage as an #InputStream.
*
* Throws on error
*/
[[nodiscard]]
virtual InputStreamPtr OpenFile(std::string_view uri_utf8, Mutex &mutex) = 0;
};