diff options
Diffstat (limited to 'src/db/plugins/simple/SimpleDatabasePlugin.hxx')
-rw-r--r-- | src/db/plugins/simple/SimpleDatabasePlugin.hxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.hxx b/src/db/plugins/simple/SimpleDatabasePlugin.hxx index 9836a6bcf..a03969f92 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.hxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.hxx @@ -32,16 +32,28 @@ struct Directory; struct DatabasePlugin; class EventLoop; class DatabaseListener; +class PrefixedLightSong; class SimpleDatabase : public Database { AllocatedPath path; std::string path_utf8; + /** + * The path where cache files for Mount() are located. + */ + AllocatedPath cache_path; + Directory *root; time_t mtime; /** + * A buffer for GetSong() when prefixing the #LightSong + * instance from a mounted #Database. + */ + mutable PrefixedLightSong *prefixed_light_song; + + /** * A buffer for GetSong(). */ mutable LightSong light_song; @@ -52,6 +64,8 @@ class SimpleDatabase : public Database { SimpleDatabase(); + SimpleDatabase(AllocatedPath &&_path); + public: static Database *Create(EventLoop &loop, DatabaseListener &listener, const config_param ¶m, @@ -73,6 +87,20 @@ public: return mtime > 0; } + /** + * @param db the #Database to be mounted; must be "open"; on + * success, this object gains ownership of the given #Database + */ + gcc_nonnull_all + bool Mount(const char *uri, Database *db, Error &error); + + gcc_nonnull_all + bool Mount(const char *local_uri, const char *storage_uri, + Error &error); + + gcc_nonnull_all + bool Unmount(const char *uri); + /* virtual methods from class Database */ virtual bool Open(Error &error) override; virtual void Close() override; @@ -107,6 +135,8 @@ private: bool Check(Error &error) const; bool Load(Error &error); + + Database *LockUmountSteal(const char *uri); }; extern const DatabasePlugin simple_db_plugin; |