Skip to content

Commit

Permalink
commit to newer metall versions
Browse files Browse the repository at this point in the history
  • Loading branch information
liss-h committed Dec 11, 2024
1 parent 8147e96 commit d14d613
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 54 deletions.
21 changes: 0 additions & 21 deletions src/dice/ffi/metall.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,12 @@

#include <stdbool.h>
#include <stddef.h>

#if __has_include(<metall/logger_interface.h>)
#include <metall/logger_interface.h>
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if !__has_include(<metall/logger_interface.h>)
/// \brief Log message level
typedef enum metall_log_level {
/// \brief Critical logger message
metall_critical = 5,
/// \brief Error logger message
metall_error = 4,
/// \brief Warning logger message
metall_warning = 3,
/// \brief Info logger message
metall_info = 2,
/// \brief Debug logger message
metall_debug = 1,
/// \brief Verbose (lowest priority) logger message
metall_verbose = 0,
} metall_log_level;
#endif


typedef struct metall_manager metall_manager;

Expand Down
35 changes: 2 additions & 33 deletions src/dice/ffi/metall_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,11 @@
#include <metall/metall.hpp>

namespace dice::metall_ffi::internal {
#if METALL_VERSION >= 2800
/**
* @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::manager;
#else

/**
* @brief The metall manager type used internally.
* This object type is whats actually behind the opaque ::metall_manager * in the interface.
* This is a wrapper that contains the read_only flag for older versions that do not support read_only() yet.
* This object type is whats actually behind the opaque ::metall_manager * in the interface
*/
struct metall_manager : metall::manager {
bool read_only_;

template<typename T>
using allocator_type = typename metall::manager::template allocator_type<T>;

metall_manager(metall::create_only_t op, char const *path) : metall::manager{op, path},
read_only_{false} {
}

metall_manager(metall::open_only_t op, char const *path) : metall::manager{op, path},
read_only_{false} {
}

metall_manager(metall::open_read_only_t op, char const *path) : metall::manager{op, path},
read_only_{true} {
}

[[nodiscard]] bool read_only() const noexcept {
return read_only_;
}
};
#endif
using metall_manager = metall::manager;
} // namespace

#endif//DICE_METALLFFI_METALLINTERNAL_HPP

0 comments on commit d14d613

Please sign in to comment.