LeviLamina
Loading...
Searching...
No Matches
KeyValueDB.h
1#pragma once
2
3#include <filesystem>
4#include <functional>
5#include <memory>
6#include <optional>
7#include <string>
8#include <string_view>
9#include <vector>
10
11#include "ll/api/base/Macro.h"
12#include "ll/api/coro/Generator.h"
13
14namespace ll::data {
16private:
17 class KeyValueDBImpl;
18
19 std::unique_ptr<KeyValueDBImpl> impl;
20
21public:
22 LLNDAPI explicit KeyValueDB(std::filesystem::path const& path);
23
24 LLNDAPI explicit KeyValueDB(
25 std::filesystem::path const& path,
26 bool createIfMiss,
27 bool fixIfError,
28 int bloomFilterBit
29 );
30
31 KeyValueDB(KeyValueDB const&) noexcept = delete;
32
33 KeyValueDB& operator=(KeyValueDB const&) noexcept = delete;
34
35 LLNDAPI KeyValueDB(KeyValueDB&&) noexcept;
36
37 LLAPI KeyValueDB& operator=(KeyValueDB&&) noexcept;
38
39 LLAPI ~KeyValueDB();
40
41 LLNDAPI std::optional<std::string> get(std::string_view key) const;
42
43 LLNDAPI bool has(std::string_view key) const;
44
45 LLNDAPI bool empty() const;
46
47 LLAPI bool set(std::string_view key, std::string_view val);
48
49 LLAPI bool del(std::string_view key);
50
52};
53
54} // namespace ll::data
Definition KeyValueDB.h:15
Definition Generator.h:13