store: support reinit
Support reinitializing, based on some current store. This is useful for upgrading. Note that this is only the backend implementation + tests.
This commit is contained in:
@ -45,15 +45,11 @@ public:
|
||||
|
||||
/**
|
||||
* Configuration options.
|
||||
*
|
||||
* @param path
|
||||
* @param readonly
|
||||
*/
|
||||
enum struct Options {
|
||||
None = 0, /**< No specific options */
|
||||
Writable = 1 << 0, /**< Open in writable mode */
|
||||
AutoUpgrade = 1 << 1, /**< automatically re-initialize
|
||||
* versions do not match */
|
||||
None = 0, /**< No specific options */
|
||||
Writable = 1 << 0, /**< Open in writable mode */
|
||||
ReInit = 1 << 1, /**< Re-initialize based on existing */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -62,7 +58,7 @@ public:
|
||||
* @param path path to the database
|
||||
* @param options startup options
|
||||
*
|
||||
* A store or an error.
|
||||
* @return A store or an error.
|
||||
*/
|
||||
static Result<Store> make(const std::string& path,
|
||||
Options opts=Options::None) noexcept try {
|
||||
@ -93,6 +89,8 @@ public:
|
||||
* @param personal_addresses addresses that should be recognized as
|
||||
* 'personal' for identifying personal messages.
|
||||
* @param config a configuration object
|
||||
*
|
||||
* @return a store or an error
|
||||
*/
|
||||
static Result<Store> make_new(const std::string& path,
|
||||
const std::string& maildir,
|
||||
@ -448,6 +446,7 @@ private:
|
||||
*/
|
||||
Store(const std::string& path, Options opts=Options::None);
|
||||
|
||||
|
||||
/**
|
||||
* Construct a store for a not-yet-existing document database
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user