Skip to content

Commit

Permalink
switch to dice-metall
Browse files Browse the repository at this point in the history
  • Loading branch information
Clueliss committed Nov 10, 2023
1 parent e74b9c0 commit 6dc2808
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.17)
cmake_minimum_required(VERSION 3.22)
project(metall-ffi VERSION 0.2.1)

include(cmake/boilerplate_init.cmake)
Expand All @@ -16,7 +16,7 @@ if (IS_TOP_LEVEL AND USE_CONAN)
install_packages_via_conan("${CMAKE_SOURCE_DIR}/conanfile.py" "${CONAN_OPTIONS};boost:header_only=True")
endif ()

find_package(Metall REQUIRED)
find_package(metall REQUIRED)

add_library(metall-ffi
src/dice/ffi/metall.cpp
Expand All @@ -32,7 +32,7 @@ target_include_directories(

target_link_libraries(metall-ffi
PUBLIC
Metall::Metall
metall::metall
)

set_target_properties(metall-ffi PROPERTIES
Expand Down
9 changes: 6 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ class Recipe(ConanFile):

# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False], "with_test_deps": [True, False]}
default_options = {"shared": False, "fPIC": True, "with_test_deps": False}
options = {"shared": [True, False], "fPIC": [True, False], "with_test_deps": [True, False], "with_default_logger": [True, False]}
default_options = {"shared": False, "fPIC": True, "with_test_deps": False, "with_default_logger": True}
exports = "LICENSE",
exports_sources = "src/*", "CMakeLists.txt", "cmake/*"
generators = "CMakeDeps", "CMakeToolchain"

def requirements(self):
self.requires("metall/0.26", transitive_headers=True)
self.requires("metall/0.26.0@dice-group/improvement-logging", transitive_headers=True)

if self.options.with_test_deps:
self.requires("doctest/2.4.11")

def configure(self):
self.options["metall"].with_default_logger = self.options.with_default_logger

def set_version(self):
if not hasattr(self, 'version') or self.version is None:
cmake_file = load(self, os.path.join(self.recipe_folder, "CMakeLists.txt"))
Expand Down
10 changes: 5 additions & 5 deletions src/dice/ffi/metall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using metall_manager_t = dice::metall_ffi::internal::metall_manager;

template<auto open_mode>
metall_manager *open_impl(char const *path) {
if (!metall::manager::consistent(path)) {
if (!dice::metall::manager::consistent(path)) {
// prevents opening the same datastore twice
// (because opening removes the properly_closed_mark and this checks for it)
errno = ENOTRECOVERABLE;
Expand All @@ -23,11 +23,11 @@ metall_manager *open_impl(char const *path) {
}

metall_manager *metall_open(char const *path) {
return open_impl<metall::open_only>(path);
return open_impl<dice::metall::open_only>(path);
}

metall_manager *metall_open_read_only(char const *path) {
return open_impl<metall::open_read_only>(path);
return open_impl<dice::metall::open_read_only>(path);
}

metall_manager *metall_create(char const *path) {
Expand All @@ -37,7 +37,7 @@ metall_manager *metall_create(char const *path) {
return nullptr;
}

auto *manager = new metall_manager_t{metall::create_only, path};
auto *manager = new metall_manager_t{dice::metall::create_only, path};
if (!manager->check_sanity()) {
delete manager;
errno = ENOTRECOVERABLE;
Expand All @@ -56,7 +56,7 @@ void metall_close(metall_manager *manager) {
}

bool metall_remove(char const *path) {
return metall::manager::remove(path);
return dice::metall::manager::remove(path);
}

void *metall_malloc(metall_manager *manager, char const *name, size_t size) {
Expand Down
4 changes: 2 additions & 2 deletions src/dice/ffi/metall_internal.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef DICE_METALLFFI_METALLINTERNAL_HPP
#define DICE_METALLFFI_METALLINTERNAL_HPP

#include <metall/metall.hpp>
#include <dice/metall/metall.hpp>

namespace dice::metall_ffi::internal {
/**
* @brief The metall manager type used internally.
* This object type is whats actually behind the opaque ::metall_manager * in the interface
*/
using metall_manager = metall::basic_manager<uint32_t, (1ULL << 28ULL)>;
using metall_manager = dice::metall::basic_manager<uint32_t, (1ULL << 28ULL)>;
} // namespace

#endif//DICE_METALLFFI_METALLINTERNAL_HPP

0 comments on commit 6dc2808

Please sign in to comment.