summaryrefslogtreecommitdiffstats
path: root/src/rgw/driver/dbstore/config/store.cc
blob: 569a093b7d71ea8d432ee046d1fb61aa4045063f (plain)
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
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab ft=cpp

/*
 * Ceph - scalable distributed file system
 *
 * Copyright (C) 2022 Red Hat, Inc.
 *
 * This is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1, as published by the Free Software
 * Foundation. See file COPYING.
 *
 */

#include <stdexcept>

#include <fmt/format.h>

#include "store.h"
#ifdef SQLITE_ENABLED
#include "sqlite.h"
#endif

namespace rgw::dbstore {

auto create_config_store(const DoutPrefixProvider* dpp, const std::string& uri)
  -> std::unique_ptr<sal::ConfigStore>
{
#ifdef SQLITE_ENABLED
  if (uri.starts_with("file:")) {
    return config::create_sqlite_store(dpp, uri);
  }
#endif
  throw std::runtime_error(fmt::format("unrecognized URI {}", uri));
}

} // namespace rgw::dbstore