Verified Commit 9002ef47 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Create new GKFS_METADATA_MOD for MetadataDB

parent b09a9be1
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#define GEKKOFS_METADATA_DB_HPP

#include <memory>
#include <spdlog/spdlog.h>
#include <rocksdb/db.h>
#include <daemon/backend/exceptions.hpp>
#include <tuple>
@@ -44,6 +45,7 @@ private:
    rdb::Options options;
    rdb::WriteOptions write_opts;
    std::string path;
    std::shared_ptr<spdlog::logger> log_;

    static void
    optimize_rocksdb_options(rdb::Options& options);
+70 −0
Original line number Diff line number Diff line
/*
  Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain
  Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany

  This software was partially supported by the
  EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).

  This software was partially supported by the
  ADA-FS project under the SPPEXA project funded by the DFG.

  This file is part of GekkoFS.

  GekkoFS is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  GekkoFS is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.

  SPDX-License-Identifier: GPL-3.0-or-later
*/

#ifndef GEKKOFS_DAEMON_METADATA_LOGGING_HPP
#define GEKKOFS_DAEMON_METADATA_LOGGING_HPP

#include <spdlog/spdlog.h>

namespace gkfs::data {

class MetadataModule {

private:
    MetadataModule() = default;

    std::shared_ptr<spdlog::logger> log_;

public:
    static constexpr const char* LOGGER_NAME = "MetadataModule";

    static MetadataModule*
    getInstance() {
        static MetadataModule instance;
        return &instance;
    }

    MetadataModule(MetadataModule const&) = delete;

    void
    operator=(MetadataModule const&) = delete;

    const std::shared_ptr<spdlog::logger>&
    log() const;

    void
    log(const std::shared_ptr<spdlog::logger>& log);
};

#define GKFS_METADATA_MOD                                                      \
    (static_cast<gkfs::data::MetadataModule*>(                                 \
            gkfs::data::MetadataModule::getInstance()))

} // namespace gkfs::data

#endif // GEKKOFS_DAEMON_METADATA_LOGGING_HPP
+1 −2
Original line number Diff line number Diff line
@@ -26,8 +26,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

add_subdirectory(backend/metadata)
add_subdirectory(backend/data)
add_subdirectory(backend)

set(DAEMON_SRC
    ../common/rpc/rpc_util.cpp
+30 −0
Original line number Diff line number Diff line
################################################################################
# Copyright 2018-2021, Barcelona Supercomputing Center (BSC), Spain            #
# Copyright 2015-2021, Johannes Gutenberg Universitaet Mainz, Germany          #
#                                                                              #
# This software was partially supported by the                                 #
# EC H2020 funded project NEXTGenIO (Project ID: 671951, www.nextgenio.eu).    #
#                                                                              #
# This software was partially supported by the                                 #
# ADA-FS project under the SPPEXA project funded by the DFG.                   #
#                                                                              #
# This file is part of GekkoFS.                                                #
#                                                                              #
# GekkoFS is free software: you can redistribute it and/or modify              #
# it under the terms of the GNU General Public License as published by         #
# the Free Software Foundation, either version 3 of the License, or            #
# (at your option) any later version.                                          #
#                                                                              #
# GekkoFS is distributed in the hope that it will be useful,                   #
# but WITHOUT ANY WARRANTY; without even the implied warranty of               #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                #
# GNU General Public License for more details.                                 #
#                                                                              #
# You should have received a copy of the GNU General Public License            #
# along with GekkoFS.  If not, see <https://www.gnu.org/licenses/>.            #
#                                                                              #
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

add_subdirectory(metadata)
add_subdirectory(data)
+17 −0
Original line number Diff line number Diff line
@@ -26,6 +26,22 @@
# SPDX-License-Identifier: GPL-3.0-or-later                                    #
################################################################################

add_library(data_module
  STATIC
)

target_sources(data_module
  PUBLIC
    ${INCLUDE_DIR}/daemon/backend/data/data_module.hpp
  PRIVATE
    ${CMAKE_CURRENT_LIST_DIR}/data_module.cpp
)

target_link_libraries(data_module
  PUBLIC
    spdlog
)

add_library(storage STATIC)

target_sources(storage
@@ -43,6 +59,7 @@ target_sources(storage
target_link_libraries(storage
    PRIVATE
    spdlog
    data_module
    # open issue for std::filesystem https://gitlab.kitware.com/cmake/cmake/-/issues/17834
    stdc++fs
    -ldl
Loading