db/simple: mount points
A SimpleDatabase instance can now "mount" other Database instances at certain locations. This is used to use a new SimpleDatabase instance for each storage mount (issued with the "mount" protocol command). Each such instance has its own database file, stored in the directory that is specified with the "cache_directory" option.
This commit is contained in:
@@ -57,6 +57,7 @@ struct Song;
|
||||
struct db_visitor;
|
||||
class SongFilter;
|
||||
class Error;
|
||||
class Database;
|
||||
|
||||
struct Directory {
|
||||
/**
|
||||
@@ -94,6 +95,12 @@ struct Directory {
|
||||
|
||||
std::string path;
|
||||
|
||||
/**
|
||||
* If this is not nullptr, then this directory does not really
|
||||
* exist, but is a mount point for another #Database.
|
||||
*/
|
||||
Database *mounted_database;
|
||||
|
||||
public:
|
||||
Directory(std::string &&_path_utf8, Directory *_parent);
|
||||
~Directory();
|
||||
@@ -106,6 +113,10 @@ public:
|
||||
return new Directory(std::string(), nullptr);
|
||||
}
|
||||
|
||||
bool IsMount() const {
|
||||
return mounted_database != nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove this #Directory object from its parent and free it. This
|
||||
* must not be called with the root Directory.
|
||||
|
Reference in New Issue
Block a user