Commit 0480b1f1 authored by Ramon Nou's avatar Ramon Nou
Browse files

Format new files

parent 3ab07f14
Loading
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -45,14 +45,12 @@ namespace gkfs::metadata {

class MetadataDB {
private:
    
    std::string path;
    std::shared_ptr<spdlog::logger> log_;
    std::unique_ptr<AbstractMetadataBackend> db;


public:
    
    explicit MetadataDB(const std::string& path);

    std::string
@@ -88,7 +86,6 @@ public:

    void
    iterate_all();

};

} // namespace gkfs::metadata
+5 −7
Original line number Diff line number Diff line
@@ -43,16 +43,15 @@ namespace gkfs::metadata {

class KreonBackend : public MetadataBackend<KreonBackend> {
private:

    klc_handle klc_db;
    klc_db_options klc_options;
    std::string klc_path;

    inline void str2klc(const std::string& value,
            struct klc_value & V) const;
    inline void
    str2klc(const std::string& value, struct klc_value& V) const;

    inline void str2klc(const std::string& key,
            struct klc_key &K) const;
    inline void
    str2klc(const std::string& key, struct klc_key& K) const;

public:
    explicit KreonBackend(const std::string& path);
@@ -94,7 +93,6 @@ public:

    void
    iterate_all() override;

};

} // namespace gkfs::metadata
+14 −18
Original line number Diff line number Diff line
@@ -72,19 +72,16 @@ class AbstractMetadataBackend {

    virtual void
    iterate_all() = 0;

};

template <typename T>
class MetadataBackend : public AbstractMetadataBackend {
private:
    
    std::string path;
    std::shared_ptr<spdlog::logger> log_;
    std::unique_ptr<T> db;

public:
    
    // explicit MetadataDB(const std::string& path);

    std::string
@@ -142,7 +139,6 @@ public:
    iterate_all() {
        static_cast<T&>(*this).iterate_all();
    }

};

} // namespace gkfs::metadata
+4 −6
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ namespace gkfs::metadata {

class RocksDBBackend : public MetadataBackend<RocksDBBackend> {
private:

    std::unique_ptr<rdb::DB> db;
    rdb::Options options;
    rdb::WriteOptions write_opts;
@@ -88,7 +87,6 @@ public:

    void
    iterate_all() override;

};

} // namespace gkfs::metadata
+12 −15
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@ extern "C" {
}



namespace gkfs::metadata {

/**
@@ -48,13 +47,13 @@ namespace gkfs::metadata {
 * @param path where KV store data is stored
 */
MetadataDB::MetadataDB(const std::string& path) : path(path) {
#ifdef KREON
   db.reset(new KreonBackend(path));
#endif

#ifdef ROCKSDB
    if(true)
        db.reset(new KreonBackend(path));
    else
        db.reset(new RocksDBBackend(path));
#endif


    /* Get logger instance and set it for data module and chunk storage */
    GKFS_METADATA_MOD->log(spdlog::get(GKFS_METADATA_MOD->LOGGER_NAME));
    assert(GKFS_METADATA_MOD->log());
@@ -114,7 +113,6 @@ void
MetadataDB::remove(const std::string& key) {

    db->remove(key);

}

/**
@@ -155,7 +153,6 @@ void
MetadataDB::increase_size(const std::string& key, size_t size, bool append) {

    db->increase_size(key, size, append);

}

/**
@@ -168,7 +165,7 @@ MetadataDB::increase_size(const std::string& key, size_t size, bool append) {
void
MetadataDB::decrease_size(const std::string& key, size_t size) {

   db->decrease_size(key, size);
    db.get()->decrease_size(key, size);
}

/**
Loading