Verified Commit 33865a14 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

Add support for basic directories calls

Support for the following calls has been added:
 - opendir
 - readdir
 - closedir

The readdir call use the new RPC get_dirents that ask to all the
nodes (broadcast) about all the existing first-level entries
of a specific directory.
parent 97f26a22
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -26,4 +26,6 @@ void update_metadentry(const std::string& path, Metadata& md);

int check_access_mask(const std::string& path, int mask);

std::vector<std::pair<std::string, bool>> get_dirents(const std::string& dir);

#endif //IFS_METADENTRY_HPP
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ DECLARE_MARGO_RPC_HANDLER(rpc_srv_get_metadentry_size)

DECLARE_MARGO_RPC_HANDLER(rpc_srv_update_metadentry_size)

DECLARE_MARGO_RPC_HANDLER(rpc_srv_get_dirents)

// data
DECLARE_MARGO_RPC_HANDLER(rpc_srv_read_data)

+3 −0
Original line number Diff line number Diff line
@@ -68,6 +68,9 @@
// sets the threshold in milliseconds when a log entry should be created
#define MARGO_FORWARD_TIMER_THRESHOLD 1000

//size of preallocated buffer to hold directory entries in rpc call
#define RPC_DIRENTS_BUFF_SIZE (8 * 1024 * 1024) // 8 mega

// Debug configurations
//#define RPC_TEST //unused

+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ namespace hg_tag {
    constexpr auto update_metadentry = "rpc_srv_update_metadentry";
    constexpr auto get_metadentry_size = "rpc_srv_get_metadentry_size";
    constexpr auto update_metadentry_size = "rpc_srv_update_metadentry_size";
    constexpr auto get_dirents = "rpc_srv_get_dirents";
    constexpr auto write_data = "rpc_srv_write_data";
    constexpr auto read_data = "rpc_srv_read_data";
}
+10 −0
Original line number Diff line number Diff line
@@ -88,4 +88,14 @@ MERCURY_GEN_PROC(rpc_write_data_in_t,
((hg_uint64_t) (total_chunk_size))\
((hg_bulk_t) (bulk_handle)))

MERCURY_GEN_PROC(rpc_get_dirents_in_t,
    ((hg_const_string_t) (path))
    ((hg_bulk_t) (bulk_handle))
)

MERCURY_GEN_PROC(rpc_get_dirents_out_t,
        ((hg_int32_t) (err))
        ((hg_size_t) (dirents_size))
)

#endif //LFS_RPC_TYPES_HPP
Loading