Verified Commit 32f16414 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Add tests for gkfs::staging::put()

parent 1631ade6
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ integration tests:
          --build-dir ${BUILD_PATH}
          --exclusions "${CI_PROJECT_DIR}/scripts/ci/.coverage-exclusions"
  artifacts:
    when: always
    #    when: on_failure
    paths:
      #      - "${INTEGRATION_TESTS_RUN_PATH}"
@@ -127,7 +128,7 @@ unit:
          --build-dir ${BUILD_PATH}
          --exclusions "${CI_PROJECT_DIR}/scripts/ci/.coverage-exclusions"
  artifacts:
    #    when: on_failure
    when: always
    paths:
      - ${BUILD_PATH}
        #      - Testing
+2 −2
Original line number Diff line number Diff line
@@ -48,9 +48,9 @@ public:
    connection&
    operator=(const connection& rhs) = delete;

    void
    std::size_t
    put(const void* buffer, size_t size,
        const std::filesystem::path& gkfs_filename);
        const std::filesystem::path& gkfs_filename, off_t start_offset) const;

private:
    class impl;
+4 −4
Original line number Diff line number Diff line
@@ -91,9 +91,9 @@ public:
    operator=(impl&& rhs) noexcept;
    ~impl();

    void
    std::size_t
    put(const void* buffer, size_t size,
        const std::filesystem::path& gkfs_filename) const;
        const std::filesystem::path& gkfs_filename, off_t start_offset) const;

    std::string
    stat(const std::string& path) const;
@@ -123,8 +123,8 @@ private:

    std::tuple<int, ssize_t>
    forward_write_rpc(const std::string& gkfs_filename, const void* buffer,
                      off_t offset, size_t write_size, size_t updated_metadentry_size,
                      bool is_append) const;
                      off_t offset, size_t write_size,
                      size_t updated_metadentry_size, bool is_append) const;

private:
    ////////////////////////////////////////////////////////////////////////////
+4 −2
Original line number Diff line number Diff line
@@ -40,11 +40,13 @@ namespace gkfs::env {
[[maybe_unused]] static constexpr auto LOG = ADD_PREFIX("LOG");

#ifdef GKFS_DEBUG_BUILD
[[maybe_unused]] static constexpr auto LOG_DEBUG_VERBOSITY = ADD_PREFIX("LOG_DEBUG_VERBOSITY");
[[maybe_unused]] static constexpr auto LOG_DEBUG_VERBOSITY =
        ADD_PREFIX("LOG_DEBUG_VERBOSITY");
#endif

[[maybe_unused]] static constexpr auto LOG_OUTPUT = ADD_PREFIX("LOG_OUTPUT");
[[maybe_unused]] static constexpr auto LOG_OUTPUT_TRUNC = ADD_PREFIX("LOG_OUTPUT_TRUNC");
[[maybe_unused]] static constexpr auto LOG_OUTPUT_TRUNC =
        ADD_PREFIX("LOG_OUTPUT_TRUNC");
[[maybe_unused]] static constexpr auto CWD = ADD_PREFIX("CWD");
static constexpr auto HOSTS_FILE = ADD_PREFIX("HOSTS_FILE");
#ifdef GKFS_ENABLE_FORWARDING
+11 −27
Original line number Diff line number Diff line
@@ -44,11 +44,13 @@ namespace gkfs::api::staging {
 * @param buffer The buffer with the data contents
 * @param size The amount of data to transfer
 * @param gkfs_pathname The target filename inside GekkoFS
 * @param offset The offset in the file where the data will be placed.
 * @param start_offset The offset at which data will be written
 * @returns The number of bytes written
 * @throws std::runtime_error An error occurred
 */
void
put(const void* buffer, size_t size,
    const std::filesystem::path& gkfs_filename, off_t offset);
std::size_t
put(const void* buffer, size_t size, const std::filesystem::path& gkfs_filename,
    off_t start_offset);

/**
 * Transfer data into a GekkoFS file.
@@ -64,31 +66,13 @@ put(const void* buffer, size_t size,
 * @param buffer The buffer with the data contents
 * @param size The amount of data to transfer
 * @param gkfs_pathname The target filename inside GekkoFS
 * @param start_offset The offset at which data should be written
 * @returns The number of bytes written
 * @throws std::runtime_error An error occurred
 */
void
std::size_t
put(const gkfs::api::fs::connection& conn, const void* buffer, size_t size,
    const std::filesystem::path& gkfs_filename);

/**
 * Transfer data into a GekkoFS file.
 *
 * This function creates an internal connection to a running GekkoFS
 * filesystem and transfers data from the provided buffer into a target
 * file.
 *
 * @param buffer The buffer with the data contents
 * @param size The amount of data to write
 * @param gkfs_pathname The target filename inside GekkoFS
 * @param offset
 */
void
put(const void* buffer, size_t size, const std::filesystem::path& gkfs_filename,
    off_t offset);

void
put(const gkfs::api::fs::connection& conn,
    const std::filesystem::path& pathname, const void* buf, size_t count,
    off_t offset);
    const std::filesystem::path& gkfs_filename, off_t start_offset);

} // namespace gkfs::api::staging

Loading