Verified Commit 8d6824a8 authored by Marc Vef's avatar Marc Vef
Browse files

Only load Boost when GuidedDistributor is used

parent 4df86257
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ gkfs:
      -DGKFS_BUILD_TESTS:BOOL=ON
      -DGKFS_INSTALL_TESTS:BOOL=ON
      -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH}
      -DGKFS_USE_GUIDED_DISTRIBUTION:BOOL=ON
      ${CI_PROJECT_DIR}
    - make -j$(nproc) install
    # reduce artifacts size
+12 −3
Original line number Diff line number Diff line
@@ -180,9 +180,11 @@ mark_as_advanced(CLIENT_LOG_MESSAGE_SIZE)
option(GKFS_USE_GUIDED_DISTRIBUTION "Use guided data distributor " OFF)
message(STATUS "[gekkofs] Guided data distributor: ${GKFS_USE_GUIDED_DISTRIBUTION}")

if(GKFS_USE_GUIDED_DISTRIBUTION)
    set(GKFS_USE_GUIDED_DISTRIBUTION_PATH "/tmp/guided.txt" CACHE STRING "File Path for guided distributor")
    set_property(CACHE GKFS_USE_GUIDED_DISTRIBUTION_PATH PROPERTY STRINGS)
    message(STATUS "[gekkofs] Guided data distributor input file path: ${GKFS_USE_GUIDED_DISTRIBUTION_PATH}")
endif()

configure_file(include/common/cmake_configure.hpp.in include/common/cmake_configure.hpp)

@@ -281,6 +283,13 @@ if (GKFS_BUILD_TESTS)
        set(GKFS_TESTS_FORWARDING "OFF" CACHE STRING "Enable I/O forwarding tests (default: OFF)")
    endif ()
    message(STATUS "[gekkofs] Forwarding tests: ${GKFS_TESTS_FORWARDING}")
    message(STATUS "[gekkofs] Check for guided distributor tests...")
    if (GKFS_USE_GUIDED_DISTRIBUTION)
        set(GKFS_TESTS_GUIDED_DISTRIBUTION "ON" CACHE STRING "Enable guided distributor tests (default: OFF)")
    else()
        set(GKFS_TESTS_GUIDED_DISTRIBUTION "OFF" CACHE STRING "Enable guided distributor tests (default: OFF)")
    endif()
    message(STATUS "[gekkofs] Guided distributor tests: ${GKFS_TESTS_GUIDED_DISTRIBUTION}")

    add_subdirectory(tests)
    add_subdirectory(examples/gfind)
+3 −1
Original line number Diff line number Diff line
@@ -184,13 +184,15 @@ Chunks are distributed randomly to the different GekkoFS servers.

### Guided Distributor

To use the Guided Distributor, Boost (specifically the Boost *Interval Container Library* (ICL) must be available). 

#### General

The guided distributor allows defining a specific distribution of data on a per directory or file basis. 
The distribution configurations are defined within a shared file (called `guided_config.txt` henceforth) with the following format:
`<path> <chunk_number> <host>`

To enable the distributor, the following compilation flags are required:
To enable the distributor, the following CMake compilation flags are required:
* `GKFS_USE_GUIDED_DISTRIBUTION` ON
* `GKFS_USE_GUIDED_DISTRIBUTION_PATH` `<path_guided_config.txt>`

+7 −6
Original line number Diff line number Diff line
@@ -35,11 +35,12 @@
#include <numeric>
#include <unordered_map>
#include <fstream>
#include <boost/icl/interval_map.hpp>

namespace gkfs {
#ifdef GKFS_USE_GUIDED_DISTRIBUTION
#include <boost/icl/interval_map.hpp>
#endif

namespace rpc {
namespace gkfs::rpc {

using chunkid_t = unsigned int;
using host_t = unsigned int;
@@ -139,7 +140,7 @@ public:
    std::vector<host_t>
    locate_directory_metadata(const std::string& path) const override;
};

#ifdef GKFS_USE_GUIDED_DISTRIBUTION
class GuidedDistributor : public Distributor {
private:
    host_t localhost_;
@@ -175,8 +176,8 @@ public:
    std::vector<host_t>
    locate_directory_metadata(const std::string& path) const override;
};
#endif

} // namespace rpc
} // namespace gkfs
} // namespace gkfs::rpc

#endif // GEKKOFS_RPC_LOCATOR_HPP
+5 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
add_subdirectory(arithmetic)

add_library(distributor STATIC)
include_directories(${Boost_INCLUDE_DIRS})
set_property(TARGET distributor PROPERTY POSITION_INDEPENDENT_CODE ON)
target_sources(distributor
    PUBLIC
@@ -37,6 +36,11 @@ target_sources(distributor
    PRIVATE
    ${CMAKE_CURRENT_LIST_DIR}/rpc/distributor.cpp
    )
if(GKFS_USE_GUIDED_DISTRIBUTION)
  find_package(Boost 1.53 REQUIRED)
  target_link_libraries(distributor PRIVATE Boost::boost)
#  target_include_directories(distributor PRIVATE ${BOOST_INCLUDE_DIRS})
endif()

if(GKFS_ENABLE_CODE_COVERAGE)
  target_code_coverage(distributor AUTO)
Loading