extend region config

This commit is contained in:
Alexey Rybalchenko
2021-12-06 23:44:38 +01:00
committed by Dennis Klein
parent eef42d2dea
commit 80ed45df63
7 changed files with 156 additions and 90 deletions

View File

@@ -16,6 +16,7 @@
#include <functional> // std::function
#include <memory> // std::unique_ptr
#include <optional> // std::optional
#include <ostream>
#include <string>
#include <vector>
@@ -118,6 +119,13 @@ inline std::ostream& operator<<(std::ostream& os, const RegionEvent& event)
}
}
enum class RegionConstruction : int
{
open,
create,
open_or_create
};
struct RegionConfig
{
RegionConfig() = default;
@@ -129,9 +137,12 @@ struct RegionConfig
bool lock = false; /// mlock region after creation
bool zero = false; /// zero region content after creation
bool removeOnDestruction = true; /// remove the region on object destruction
RegionConstruction constructionMode = RegionConstruction::create; /// how to construct the region: create/open/open_or_create
int creationFlags = 0; /// flags passed to the underlying transport on region creation
int64_t userFlags = 0; /// custom flags that have no effect on the transport, but can be retrieved from the region by the user
std::string path = ""; /// file path, if the region is backed by a file
std::optional<uint16_t> id = std::nullopt; /// region id
uint32_t linger = 100; /// delay in ms before region destruction to collect outstanding events
};