Commit 0d93300d authored by Ramon Nou's avatar Ramon Nou
Browse files

chunking

parent 06001b71
Loading
Loading
Loading
Loading
+24 −8
Original line number Diff line number Diff line
@@ -2280,8 +2280,9 @@ struct get_dirents {
        hermes::detail::post_to_mercury(ExecutionContext*);

    public:
        input(const std::string& path, const hermes::exposed_memory& buffers)
            : m_path(path), m_buffers(buffers) {}
        input(const std::string& path, const hermes::exposed_memory& buffers,
              const std::string& start_key = "")
            : m_path(path), m_buffers(buffers), m_start_key(start_key) {}

        input(input&& rhs) = default;

@@ -2303,17 +2304,24 @@ struct get_dirents {
            return m_buffers;
        }

        std::string
        start_key() const {
            return m_start_key;
        }

        explicit input(const rpc_get_dirents_in_t& other)
            : m_path(other.path), m_buffers(other.bulk_handle) {}
            : m_path(other.path), m_buffers(other.bulk_handle),
              m_start_key(other.start_key) {}

        explicit
        operator rpc_get_dirents_in_t() {
            return {m_path.c_str(), hg_bulk_t(m_buffers)};
            return {m_path.c_str(), m_start_key.c_str(), hg_bulk_t(m_buffers)};
        }

    private:
        std::string m_path;
        hermes::exposed_memory m_buffers;
        std::string m_start_key;
    };

    class output {
@@ -2405,8 +2413,9 @@ struct get_dirents_extended {
        hermes::detail::post_to_mercury(ExecutionContext*);

    public:
        input(const std::string& path, const hermes::exposed_memory& buffers)
            : m_path(path), m_buffers(buffers) {}
        input(const std::string& path, const hermes::exposed_memory& buffers,
              const std::string& start_key = "")
            : m_path(path), m_buffers(buffers), m_start_key(start_key) {}

        input(input&& rhs) = default;

@@ -2429,17 +2438,24 @@ struct get_dirents_extended {
            return m_buffers;
        }

        std::string
        start_key() const {
            return m_start_key;
        }

        explicit input(const rpc_get_dirents_in_t& other)
            : m_path(other.path), m_buffers(other.bulk_handle) {}
            : m_path(other.path), m_buffers(other.bulk_handle),
              m_start_key(other.start_key) {}

        explicit
        operator rpc_get_dirents_in_t() {
            return {m_path.c_str(), hg_bulk_t(m_buffers)};
            return {m_path.c_str(), m_start_key.c_str(), hg_bulk_t(m_buffers)};
        }

    private:
        std::string m_path;
        hermes::exposed_memory m_buffers;
        std::string m_start_key;
    };

    class output {
+2 −1
Original line number Diff line number Diff line
@@ -133,7 +133,8 @@ MERCURY_GEN_PROC(
                (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)))
                 ((hg_const_string_t) (path))((hg_const_string_t) (start_key))(
                         (hg_bulk_t) (bulk_handle)))

MERCURY_GEN_PROC(rpc_get_dirents_out_t,
                 ((hg_int32_t) (err))((hg_size_t) (dirents_size)))
+6 −2
Original line number Diff line number Diff line
@@ -177,7 +177,9 @@ public:
     *         is true in the case the entry is a directory.
     */
    [[nodiscard]] std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_dirents_extended(const std::string& dir) const;
    get_dirents_extended(const std::string& dir,
                         const std::string& start_key = "",
                         size_t max_entries = 0) const;


    /**
@@ -189,7 +191,9 @@ public:
     *         is true in the case the entry is a directory.
     */
    [[nodiscard]] std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_all_dirents_extended(const std::string& dir) const;
    get_all_dirents_extended(const std::string& dir,
                             const std::string& start_key = "",
                             size_t max_entries = 0) const;

    /**
     * @brief Iterate over complete database, note ONLY used for debugging and
+16 −6
Original line number Diff line number Diff line
@@ -84,10 +84,14 @@ public:
    get_dirents(const std::string& dir) const = 0;

    virtual std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_dirents_extended(const std::string& dir) const = 0;
    get_dirents_extended(const std::string& dir,
                         const std::string& start_key = "",
                         size_t max_entries = 0) const = 0;

    virtual std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_all_dirents_extended(const std::string& dir) const = 0;
    get_all_dirents_extended(const std::string& dir,
                             const std::string& start_key = "",
                             size_t max_entries = 0) const = 0;

    virtual void*
    iterate_all() const = 0;
@@ -157,13 +161,19 @@ public:
    }

    std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_dirents_extended(const std::string& dir) const {
        return static_cast<T const&>(*this).get_dirents_extended_impl(dir);
    get_dirents_extended(const std::string& dir,
                         const std::string& start_key = "",
                         size_t max_entries = 0) const {
        return static_cast<T const&>(*this).get_dirents_extended_impl(
                dir, start_key, max_entries);
    }

    std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_all_dirents_extended(const std::string& dir) const {
        return static_cast<T const&>(*this).get_all_dirents_extended_impl(dir);
    get_all_dirents_extended(const std::string& dir,
                             const std::string& start_key = "",
                             size_t max_entries = 0) const {
        return static_cast<T const&>(*this).get_all_dirents_extended_impl(
                dir, start_key, max_entries);
    }

    void*
+6 −2
Original line number Diff line number Diff line
@@ -182,11 +182,15 @@ public:
     *         is true in the case the entry is a directory.
     */
    std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_dirents_extended_impl(const std::string& dir) const;
    get_dirents_extended_impl(const std::string& dir,
                              const std::string& start_key = "",
                              size_t max_entries = 0) const;


    std::vector<std::tuple<std::string, bool, size_t, time_t>>
    get_all_dirents_extended_impl(const std::string& root_path) const;
    get_all_dirents_extended_impl(const std::string& root_path,
                                  const std::string& start_key = "",
                                  size_t max_entries = 0) const;

    /**
     * Code example for iterating all entries in KV store. This is for
Loading