Commit b32dba84 authored by Marc Vef's avatar Marc Vef
Browse files

ifs: coding in progress ...

parent e33defb0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,10 +43,13 @@ set(SOURCE_FILES main.cpp main.hpp configure.hpp
        src/db/db_util.cpp src/classes/fs_data.cpp src/classes/rpc_data.cpp

        include/db/db_util.hpp include/classes/fs_data.hpp include/classes/rpc_data.hpp
        include/classes/metadata.hpp src/classes/metadata.cpp
        src/daemon/adafs_daemon.cpp include/daemon/adafs_daemon.hpp

        include/rpc/rpc_defs.hpp include/rpc/rpc_types.hpp

        src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp)

        src/daemon/fs_operations.cpp src/daemon/fs_operations.cpp include/daemon/fs_operations.hpp src/adafs_ops/metadentry.cpp include/adafs_ops/metadentry.hpp src/db/db_ops.cpp src/db/db_ops.cpp include/db/db_ops.hpp)
add_executable(adafs_daemon ${SOURCE_FILES})
target_link_libraries(adafs_daemon ${ROCKSDB_LIBRARIES}
        # rocksdb libs
+14 −0
Original line number Diff line number Diff line
//
// Created by evie on 9/6/17.
//

#ifndef IFS_METADENTRY_HPP
#define IFS_METADENTRY_HPP

#include "../../main.hpp"

int create_node(const std::string& path, const uid_t uid, const gid_t gid, mode_t mode);

int create_metadentry(const std::string& path, mode_t mode);

#endif //IFS_METADENTRY_HPP
+78 −0
Original line number Diff line number Diff line

#ifndef FS_METADATA_H
#define FS_METADATA_H

#include "../../main.hpp"


class Metadata {

private:
    time_t atime_;             // access time. gets updated on file access unless mounted with noatime
    time_t mtime_;             // modify time. gets updated when file content is modified.
    time_t ctime_;             // change time. gets updated when the file attributes are changed AND when file content is modified.
    uid_t uid_;
    gid_t gid_;
    mode_t mode_;
    uint64_t inode_no_;
    nlink_t link_count_;       // number of names for this inode (hardlinks)
    off_t size_;               // size_ in bytes, might be computed instead of stored
    blkcnt_t blocks_;          // allocated file system blocks_


public:
    Metadata();

    Metadata(mode_t mode, uint32_t uid, uint32_t gid);

    Metadata(mode_t mode, uid_t uid, gid_t gid, uint64_t inode);

    void init_ACM_time();

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

    //Getter and Setter
    time_t atime() const;

    void atime(time_t atime_);

    time_t mtime() const;

    void mtime(time_t mtime_);

    time_t ctime() const;

    void ctime(time_t ctime_);

    uid_t uid() const;

    void uid(uid_t uid_);

    gid_t gid() const;

    void gid(gid_t gid_);

    mode_t mode() const;

    void mode(mode_t mode_);

    uint64_t inode_no() const;

    void inode_no(uint64_t inode_no_);

    nlink_t link_count() const;

    void link_count(nlink_t link_count_);

    off_t size() const;

    void size(off_t size_);

    blkcnt_t blocks() const;

    void blocks(blkcnt_t blocks_);

};


#endif //FS_METADATA_H
+20 −0
Original line number Diff line number Diff line
//
// Created by evie on 9/6/17.
//

#ifndef IFS_DB_OPS_HPP
#define IFS_DB_OPS_HPP

#include "../../main.hpp"

std::string db_get_metadentry(const std::string& key);

bool db_put_metadentry(const std::string& key, const std::string& val);

bool db_delete_metadentry(const std::string& key);

bool db_metadentry_exists(const std::string& key);

bool db_is_dir_entry(const std::string& dir_path);

#endif //IFS_DB_OPS_HPP
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ bool init_rocksdb();

void optimize_rocksdb(rocksdb::Options& options);

std::string
db_build_metadentry_value(); // TODO this would build a value based on the number of metadata fields that are used in the fs configuration

//std::string db_build_dentry_key(const fuse_ino_t inode, const std::string& name);
//
//std::string db_build_dentry_prefix(const fuse_ino_t inode);
Loading