MPD
0.20.18
|
A Storage implementation that combines multiple other Storage instances in one virtual tree. More...
#include <CompositeStorage.hxx>
Public Member Functions | |
CompositeStorage () noexcept | |
virtual | ~CompositeStorage () |
gcc_pure gcc_nonnull_all Storage * | GetMount (const char *uri) noexcept |
Get the Storage at the specified mount point. More... | |
template<typename T > | |
void | VisitMounts (T t) const |
Call the given function for each mounted storage, including the root storage. More... | |
void | Mount (const char *uri, Storage *storage) |
bool | Unmount (const char *uri) |
StorageFileInfo | GetInfo (const char *uri, bool follow) override |
Throws #std::runtime_error on error. More... | |
StorageDirectoryReader * | OpenDirectory (const char *uri) override |
Throws #std::runtime_error on error. More... | |
std::string | MapUTF8 (const char *uri) const noexcept override |
Map the given relative URI to an absolute URI. More... | |
AllocatedPath | MapFS (const char *uri) const noexcept override |
Map the given relative URI to a local file path. More... | |
const char * | MapToRelativeUTF8 (const char *uri) const noexcept override |
Check if the given URI points inside this storage. More... | |
![]() | |
Storage ()=default | |
Storage (const Storage &)=delete | |
virtual | ~Storage () |
gcc_pure AllocatedPath | MapChildFS (const char *uri_utf8, const char *child_utf8) const noexcept |
A Storage implementation that combines multiple other Storage instances in one virtual tree.
It is used to "mount" new Storage instances into the storage tree.
This class is thread-safe: mounts may be added and removed at any time in any thread.
Definition at line 39 of file CompositeStorage.hxx.
|
noexcept |
|
virtual |
|
overridevirtual |
Throws #std::runtime_error on error.
Implements Storage.
|
noexcept |
Get the Storage at the specified mount point.
Returns nullptr if the given URI is not a mount point.
The returned pointer is unprotected. No other thread is allowed to unmount the given mount point while the return value is being used.
|
overridevirtualnoexcept |
Map the given relative URI to a local file path.
Returns AllocatedPath::Null() on error or if this storage does not support local files.
Reimplemented from Storage.
|
overridevirtualnoexcept |
Check if the given URI points inside this storage.
If yes, then it returns a relative URI (pointing inside the given string); if not, returns nullptr.
Implements Storage.
|
overridevirtualnoexcept |
Map the given relative URI to an absolute URI.
Implements Storage.
void CompositeStorage::Mount | ( | const char * | uri, |
Storage * | storage | ||
) |
|
overridevirtual |
Throws #std::runtime_error on error.
Implements Storage.
bool CompositeStorage::Unmount | ( | const char * | uri | ) |
|
inline |
Call the given function for each mounted storage, including the root storage.
Passes mount point URI and the a const Storage reference to the function.
Definition at line 112 of file CompositeStorage.hxx.