-
Notifications
You must be signed in to change notification settings - Fork 0
/
lmdbconfig.hpp
50 lines (42 loc) · 1.45 KB
/
lmdbconfig.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <vxldollar/lib/errors.hpp>
#include <thread>
namespace vxldollar
{
class tomlconfig;
/** Configuration options for LMDB */
class lmdb_config final
{
public:
/**
* Dictates how lmdb flushes to disk on commit.
* These options only apply to the ledger database; the wallet database
* always flush.
*/
enum sync_strategy
{
/** Always flush to disk on commit. This is default. */
always,
/** Do not flush meta data eagerly. This may cause loss of transactions, but maintains integrity. */
nosync_safe,
/**
* Let the OS decide when to flush to disk. On filesystems with write ordering, this has the same
* guarantees as nosync_safe, otherwise corruption may occur on system crash.
*/
nosync_unsafe,
/**
* Use a writeable memory map. Let the OS decide when to flush to disk, and make the request asynchronous.
* This may give better performance on systems where the database fits entirely in memory, otherwise is
* may be slower.
* @warning Do not use this option if external processes uses the database concurrently.
*/
nosync_unsafe_large_memory
};
vxldollar::error serialize_toml (vxldollar::tomlconfig & toml_a) const;
vxldollar::error deserialize_toml (vxldollar::tomlconfig & toml_a);
/** Sync strategy for the ledger database */
sync_strategy sync{ always };
uint32_t max_databases{ 128 };
size_t map_size{ 256ULL * 1024 * 1024 * 1024 };
};
}