20#include "gflags/gflags.h"
24DEFINE_string(op,
"get",
"Operation to execute, should be put, get or del.");
30int main(int32_t argc,
char **argv) {
31 google::InitGoogleLogging(argv[0]);
32 google::ParseCommandLineFlags(&argc, &argv,
true);
34 if (FLAGS_key.empty()) {
35 AFATAL <<
"Please specify --key.";
38 if (FLAGS_op ==
"get") {
39 std::cout <<
KVDB::Get(FLAGS_key).value() << std::endl;
40 }
else if (FLAGS_op ==
"put") {
41 if (FLAGS_value.empty()) {
42 AFATAL <<
"Please specify --value.";
44 std::cout <<
KVDB::Put(FLAGS_key, FLAGS_value) << std::endl;
45 }
else if (FLAGS_op ==
"del") {
48 AFATAL <<
"Unknown op: " << FLAGS_op;
Lightweight key-value database to store system-wide parameters.
static std::optional< std::string > Get(std::string_view key)
Get value of a key.
static bool Put(std::string_view key, std::string_view value)
Store {key, value} to DB.
static bool Delete(std::string_view key)
Delete a key.