Commit 00b7d31c authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'fix_update_size' into 'master'

Fix update size

See merge request zdvresearch_bsc/adafs!57
parents 716334ce ed28e182
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -31,9 +31,7 @@ public:

    void update_ACM_time(bool a, bool c, bool m);

    std::string to_KVentry() const;

    void serialize(std::string& s) const;
    std::string serialize() const;

    //Getter and Setter
    time_t atime() const;
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ int create_metadentry(const std::string& path, mode_t mode) {
    if (ADAFS_DATA->inode_no_state())
        md.inode_no(generate_inode_no());

    return db_put_metadentry(path, md.to_KVentry()) ? 0 : -1;
    return db_put_metadentry(path, md.serialize()) ? 0 : -1;
}

int get_metadentry(const std::string& path, std::string& val) {
@@ -132,7 +132,7 @@ int update_metadentry_size(const string& path, size_t io_size, off64_t offset, b
}

int update_metadentry(const string& path, Metadata& md) {
    return db_update_metadentry(path, md.path(), md.to_KVentry()) ? 0 : -1;
    return db_update_metadentry(path, md.path(), md.serialize()) ? 0 : -1;
}

/**
+4 −9
Original line number Diff line number Diff line
@@ -123,16 +123,10 @@ void Metadata::update_ACM_time(bool a, bool c, bool m) {
}

/**
 * Creates a key value metadentry string that is used as a value in the KV store
 * @return
 * Returns the string rapresentation of metadata
 */
std::string Metadata::to_KVentry() const {
    std::string val;
    this->serialize(val);
    return val;
}

void Metadata::serialize(std::string& s) const {
std::string Metadata::serialize() const {
    std::string s;
    // The order is important. don't change.
    s += fmt::FormatInt(mode_).c_str(); // add mandatory mode
    s += dentry_val_delim + fmt::FormatInt(size_).c_str(); // add mandatory size
@@ -160,6 +154,7 @@ void Metadata::serialize(std::string& s) const {
    if (ADAFS_DATA->blocks_state()) {
        s += dentry_val_delim + fmt::FormatInt(blocks_).c_str();
    }
    return s;
}

//-------------------------------------------- GETTER/SETTER
+1 −1
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ bool MetadataMergeOperator::FullMergeV2(
    }

    md.size(fsize);
    md.serialize(merge_out->new_value);
    merge_out->new_value = md.serialize();
    return true;
}