Metall  v0.28
A persistent memory allocator for data-centric analytics
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size > Class Template Reference

A generalized Metall manager class. More...

#include </home/runner/work/metall/metall/include/metall/basic_manager.hpp>

Public Types

using manager_kernel_type = kernel::manager_kernel< storage, segment_storage, chunk_no_type, k_chunk_size >
 Manager kernel type. More...
 
using void_pointer = typename manager_kernel_type::void_pointer
 Void pointer type. More...
 
using char_type = typename manager_kernel_type::char_type
 Char type. More...
 
using size_type = typename manager_kernel_type::size_type
 Size type. More...
 
using difference_type = typename manager_kernel_type::difference_type
 Difference type. More...
 
template<typename T >
using allocator_type = stl_allocator< T, manager_kernel_type >
 Allocator type. More...
 
template<typename OuterT , typename... InnerT>
using scoped_allocator_type = container::scoped_allocator_adaptor< allocator_type< OuterT >, allocator_type< InnerT >... >
 Allocator type wrapped by scoped_allocator_adaptor. More...
 
template<typename T >
using fallback_allocator = container::fallback_allocator_adaptor< allocator_type< T > >
 A STL compatible allocator which fallbacks to a heap allocator (e.g., malloc()) if no argument is provided to construct a allocator_type instance. More...
 
template<typename T >
using scoped_fallback_allocator_type = container::scoped_allocator_adaptor< fallback_allocator< T > >
 Fallback allocator type wrapped by scoped_allocator_adaptor. More...
 
template<typename T >
using construct_proxy = metall::mtlldetail::named_proxy< manager_kernel_type, T, false >
 Construct proxy. More...
 
template<typename T >
using construct_iter_proxy = metall::mtlldetail::named_proxy< manager_kernel_type, T, true >
 Construct iterator proxy. More...
 
using instance_kind = typename manager_kernel_type::instance_kind
 An value that describes the type of the instance constructed in memory. More...
 
using const_named_iterator = typename manager_kernel_type::const_named_iterator
 Const iterator for named objects. More...
 
using const_unique_iterator = typename manager_kernel_type::const_unique_iterator
 Const iterator for unique objects. More...
 
using const_anonymous_iterator = typename manager_kernel_type::const_anonymous_iterator
 Const iterator for anonymous objects. More...
 
using named_object_attribute_accessor_type = typename manager_kernel_type::named_object_attr_accessor_type
 Provides access to named object attribute. More...
 
using unique_object_attribute_accessor_type = typename manager_kernel_type::unique_object_attr_accessor_type
 Provides access to unique object attribute. More...
 
using anonymous_object_attribute_accessor_type = typename manager_kernel_type::anonymous_object_attr_accessor_type
 Provides access to anonymous object attribute. More...
 
using chunk_number_type = chunk_no_type
 Chunk number type (= chunk_no_type) More...
 
using path_type = typename manager_kernel_type::path_type
 Path type. More...
 

Public Member Functions

 basic_manager (open_only_t, const path_type &base_path) noexcept
 Opens an existing data store. More...
 
 basic_manager (open_read_only_t, const path_type &base_path) noexcept
 Opens an existing data store with the read only mode. Write accesses will cause segmentation fault. More...
 
 basic_manager (create_only_t, const path_type &base_path) noexcept
 Creates a new data store (an existing data store will be overwritten). More...
 
 basic_manager (create_only_t, const path_type &base_path, const size_type capacity) noexcept
 Creates a new data store (an existing data store will be overwritten). More...
 
 basic_manager ()=delete
 Deleted. More...
 
 ~basic_manager () noexcept=default
 Destructor. More...
 
 basic_manager (const basic_manager &)=delete
 Deleted. More...
 
 basic_manager (basic_manager &&) noexcept=default
 Move constructor. More...
 
basic_manageroperator= (const basic_manager &)=delete
 Deleted. More...
 
basic_manageroperator= (basic_manager &&) noexcept=default
 Move assignment operator. More...
 
template<typename T >
construct_proxy< T > construct (char_ptr_holder_type name)
 Allocates an object of type T. More...
 
template<typename T >
construct_proxy< T > find_or_construct (char_ptr_holder_type name)
 Tries to find an already constructed object. If not exist, constructs an object of type T. More...
 
template<typename T >
construct_iter_proxy< T > construct_it (char_ptr_holder_type name)
 Allocates an array of objects of type T, receiving arguments from iterators. More...
 
template<typename T >
construct_iter_proxy< T > find_or_construct_it (char_ptr_holder_type name)
 Tries to find an already constructed object. If not exist, constructs an array of objects of type T, receiving arguments from iterators. More...
 
template<typename T >
std::pair< T *, size_typefind (char_ptr_holder_type name) const noexcept
 Tries to find a previously created object. More...
 
template<typename T >
bool destroy (const char *name)
 Destroys a previously created object. Calls the destructor and frees the memory. More...
 
template<typename T >
bool destroy (const metall::mtlldetail::unique_instance_t *const)
 Destroys a unique object of type T. Calls the destructor and frees the memory. More...
 
template<class T >
bool destroy_ptr (const T *ptr)
 Destroys a object (named, unique, or anonymous) by its address. Calls the destructor and frees the memory. Cannot destroy an object not allocated by construct/find_or_construct functions. More...
 
template<class T >
const char_typeget_instance_name (const T *ptr) const noexcept
 Returns the name of an object created with construct/find_or_construct functions. More...
 
template<class T >
instance_kind get_instance_kind (const T *ptr) const noexcept
 Returns the kind of an object created with construct/find_or_construct functions. More...
 
template<class T >
size_type get_instance_length (const T *ptr) const noexcept
 Returns the length of an object created with construct/find_or_construct functions (1 if is a single element, >=1 if it's an array). More...
 
template<class T >
bool is_instance_type (const void *const ptr) const noexcept
 Checks if the type of an object, which was created with construct/find_or_construct functions, is T. More...
 
template<class T >
bool get_instance_description (const T *ptr, std::string *description) const noexcept
 Gets the description of an object created with construct/find_or_construct. More...
 
template<class T >
bool set_instance_description (const T *ptr, const std::string &description) noexcept
 Sets a description to an object created with construct/find_or_construct. More...
 
size_type get_num_named_objects () const noexcept
 Returns Returns the number of named objects stored in the managed segment. More...
 
size_type get_num_unique_objects () const noexcept
 Returns Returns the number of unique objects stored in the managed segment. More...
 
size_type get_num_anonymous_objects () const noexcept
 Returns Returns the number of anonymous objects (objects constructed with metall::anonymous_instance) stored in the managed segment. More...
 
const_named_iterator named_begin () const noexcept
 Returns a constant iterator to the index storing the named objects. More...
 
const_named_iterator named_end () const noexcept
 Returns a constant iterator to the end of the index storing the named allocations. More...
 
const_unique_iterator unique_begin () const noexcept
 Returns a constant iterator to the index storing the unique objects. More...
 
const_unique_iterator unique_end () const noexcept
 Returns a constant iterator to the end of the index storing the unique allocations. More...
 
const_anonymous_iterator anonymous_begin () const noexcept
 Returns a constant iterator to the index storing the anonymous objects. More...
 
const_anonymous_iterator anonymous_end () const noexcept
 Returns a constant iterator to the end of the index storing the anonymous allocations. More...
 
void * allocate (size_type nbytes) noexcept
 Allocates nbytes bytes. More...
 
void * allocate_aligned (size_type nbytes, size_type alignment) noexcept
 Allocates nbytes bytes. The address of the allocated memory will be a multiple of alignment. More...
 
void deallocate (void *addr) noexcept
 Deallocates the allocated memory. More...
 
bool all_memory_deallocated () const noexcept
 Check if all allocated memory has been deallocated. More...
 
void flush (const bool synchronous=true) noexcept
 Flush data to persistent memory. More...
 
bool snapshot (const path_type &destination_path, const bool clone=true, const int num_max_copy_threads=0) noexcept
 Takes a snapshot of the current data. The snapshot has a new UUID. More...
 
std::string get_uuid () const noexcept
 Returns a UUID of the data store. More...
 
version_type get_version () const noexcept
 Gets the version of the Metall that created the backing data store. More...
 
bool set_description (const std::string &description) noexcept
 Sets a description to a Metall data store. An existing description is overwritten (only one description per data store). More...
 
bool get_description (std::string *description) const noexcept
 Gets a description. If there is no description, nothing to happen to the given description object. More...
 
template<typename T = std::byte>
allocator_type< T > get_allocator () const noexcept
 Returns a STL compatible allocator object. More...
 
const void * get_address () const noexcept
 Returns the address of the application data segment. More...
 
size_type get_size () const noexcept
 Returns the size (i.e., the maximum total allocation size) of the application data segment. This is a theoretical value. The actual total allocation size Metall can handle will be less than that. More...
 
bool read_only () const noexcept
 Returns if this manager was opened as read-only. More...
 
bool check_sanity () const noexcept
 Checks the sanity. More...
 

Static Public Member Functions

static bool copy (const path_type &source_path, const path_type &destination_path, const bool clone=true, const int num_max_copy_threads=0) noexcept
 Copies data store synchronously. The behavior of copying a data store that is open without the read-only mode is undefined. More...
 
static auto copy_async (const path_type source_path, const path_type destination_path, const bool clone=true, const int num_max_copy_threads=0) noexcept
 Copies data store asynchronously. The behavior of copying a data store that is open without the read-only mode is undefined. More...
 
static bool remove (const path_type &path) noexcept
 Removes data store synchronously. More...
 
static std::future< bool > remove_async (const path_type &path) noexcept
 Remove data store asynchronously. More...
 
static bool consistent (const path_type &path) noexcept
 Check if a data store exists and is consistent (i.e., it was closed properly in the previous run). More...
 
static std::string get_uuid (const path_type &path) noexcept
 Returns a UUID of the data store. More...
 
static version_type get_version (const path_type &path) noexcept
 Gets the version of the Metall that created the backing data store. More...
 
static bool set_description (const path_type &path, const std::string &description) noexcept
 Sets a description to a Metall data store. An existing description is overwritten (only one description per data store). More...
 
static bool get_description (const path_type &path, std::string *description) noexcept
 Gets a description. If there is no description, nothing to happen to the given description object. More...
 
static named_object_attribute_accessor_type access_named_object_attribute (const path_type &path) noexcept
 Returns an instance that provides access to the attribute of named objects. More...
 
static unique_object_attribute_accessor_type access_unique_object_attribute (const path_type &path) noexcept
 Returns an instance that provides access to the attribute of unique object. More...
 
static anonymous_object_attribute_accessor_type access_anonymous_object_attribute (const path_type &path) noexcept
 Returns an instance that provides access to the attribute of anonymous object. More...
 
static constexpr size_type chunk_size () noexcept
 Returns the internal chunk size. More...
 

Detailed Description

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
class metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >

A generalized Metall manager class.

Template Parameters
storageStorage manager.
segment_storageSegment storage manager.
chunk_no_typeType of chunk number.
k_chunk_sizeSize of single chunk in byte.
Examples
adjacency_list_graph.cpp, allocator_aware_type.cpp, complex_map.cpp, concurrent_map.cpp, csr_graph.cpp, datastore_description.cpp, fallback_allocator.cpp, jgraph.cpp, json_create.cpp, json_open.cpp, logger.cpp, multilevel_containers.cpp, object_attribute.cpp, object_attribute_api_list.cpp, offset_pointer.cpp, simple.cpp, snapshot.cpp, string.cpp, string_map.cpp, and vector_of_vectors.cpp.

Member Typedef Documentation

◆ manager_kernel_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::manager_kernel_type = kernel::manager_kernel<storage, segment_storage, chunk_no_type, k_chunk_size>

Manager kernel type.

◆ void_pointer

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::void_pointer = typename manager_kernel_type::void_pointer

Void pointer type.

◆ char_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::char_type = typename manager_kernel_type::char_type

Char type.

◆ size_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::size_type = typename manager_kernel_type::size_type

Size type.

◆ difference_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::difference_type = typename manager_kernel_type::difference_type

Difference type.

◆ allocator_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::allocator_type = stl_allocator<T, manager_kernel_type>

Allocator type.

◆ scoped_allocator_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename OuterT , typename... InnerT>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::scoped_allocator_type = container::scoped_allocator_adaptor<allocator_type<OuterT>, allocator_type<InnerT>...>

Allocator type wrapped by scoped_allocator_adaptor.

◆ fallback_allocator

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::fallback_allocator = container::fallback_allocator_adaptor<allocator_type<T> >

A STL compatible allocator which fallbacks to a heap allocator (e.g., malloc()) if no argument is provided to construct a allocator_type instance.

Template Parameters
TThe type of the object to allocate

This allocator enables the following code.

{
using alloc = fallback_allocator<int>;
// Allocate a vector object in a heap.
vector<int, alloc> vec;
// Allocate a vector object in a Metall space.
vector<int, alloc> vec2(manager.get_allocator());
}
basic_manager<> manager
Default Metall manager class which is an alias of basic_manager with the default template parameters.
Definition: metall.hpp:34
Attention
One of the primary purposes of this allocator is to provide a way to temporarily allocate data structures that use Metall’s STL-allocator in a heap in addition to in Metall memory space. It is advised to use this allocator with caution as two memory spaces are used transparently by this allocator.

◆ scoped_fallback_allocator_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::scoped_fallback_allocator_type = container::scoped_allocator_adaptor<fallback_allocator<T> >

Fallback allocator type wrapped by scoped_allocator_adaptor.

◆ construct_proxy

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::construct_proxy = metall::mtlldetail::named_proxy<manager_kernel_type, T, false>

Construct proxy.

◆ construct_iter_proxy

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::construct_iter_proxy = metall::mtlldetail::named_proxy<manager_kernel_type, T, true>

Construct iterator proxy.

◆ instance_kind

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::instance_kind = typename manager_kernel_type::instance_kind

An value that describes the type of the instance constructed in memory.

◆ const_named_iterator

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::const_named_iterator = typename manager_kernel_type::const_named_iterator

Const iterator for named objects.

Examples
object_attribute_api_list.cpp.

◆ const_unique_iterator

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::const_unique_iterator = typename manager_kernel_type::const_unique_iterator

Const iterator for unique objects.

◆ const_anonymous_iterator

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::const_anonymous_iterator = typename manager_kernel_type::const_anonymous_iterator

Const iterator for anonymous objects.

◆ named_object_attribute_accessor_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::named_object_attribute_accessor_type = typename manager_kernel_type::named_object_attr_accessor_type

Provides access to named object attribute.

◆ unique_object_attribute_accessor_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::unique_object_attribute_accessor_type = typename manager_kernel_type::unique_object_attr_accessor_type

Provides access to unique object attribute.

◆ anonymous_object_attribute_accessor_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::anonymous_object_attribute_accessor_type = typename manager_kernel_type::anonymous_object_attr_accessor_type

Provides access to anonymous object attribute.

◆ chunk_number_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::chunk_number_type = chunk_no_type

Chunk number type (= chunk_no_type)

◆ path_type

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
using metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::path_type = typename manager_kernel_type::path_type

Path type.

Constructor & Destructor Documentation

◆ basic_manager() [1/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( open_only_t  ,
const path_type base_path 
)
inlinenoexcept

Opens an existing data store.

Parameters
base_pathPath to a data store.

◆ basic_manager() [2/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( open_read_only_t  ,
const path_type base_path 
)
inlinenoexcept

Opens an existing data store with the read only mode. Write accesses will cause segmentation fault.

Parameters
base_pathPath to a data store.

◆ basic_manager() [3/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( create_only_t  ,
const path_type base_path 
)
inlinenoexcept

Creates a new data store (an existing data store will be overwritten).

Parameters
base_pathPath to create a data store.

◆ basic_manager() [4/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( create_only_t  ,
const path_type base_path,
const size_type  capacity 
)
inlinenoexcept

Creates a new data store (an existing data store will be overwritten).

Parameters
base_pathPath to create a data store.
capacityTotal allocation size. Metall uses this value as a hint.

◆ basic_manager() [5/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( )
delete

Deleted.

◆ ~basic_manager()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::~basic_manager ( )
defaultnoexcept

Destructor.

◆ basic_manager() [6/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( const basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size > &  )
delete

Deleted.

◆ basic_manager() [7/7]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::basic_manager ( basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size > &&  )
defaultnoexcept

Move constructor.

Member Function Documentation

◆ operator=() [1/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
basic_manager& metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::operator= ( const basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size > &  )
delete

Deleted.

Returns
N/A.

◆ operator=() [2/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
basic_manager& metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::operator= ( basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size > &&  )
defaultnoexcept

Move assignment operator.

Returns
An reference to the object.

◆ construct()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
construct_proxy<T> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::construct ( char_ptr_holder_type  name)
inline

Allocates an object of type T.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

If T's constructor throws, the function throws that exception. Memory is freed automatically if T's constructor throws and if an array was being constructed, destructors of created objects are called before freeing the memory.

Example:

T *ptr = basic_manager.construct<T>("Name")(arg1, arg2...);
T *ptr = basic_manager.construct<T>("Name")[count](arg1, arg2...);
basic_manager()=delete
Deleted.

Where, 'arg1, arg2...' are the arguments passed to T's constructor via a proxy object. One can also construct an array using '[ ]' operator. When an array is constructed, each object receives the same arguments.

Template Parameters
TThe type of the object.
Parameters
nameA unique name of the object.
Returns
A proxy object that constructs the object on the allocated space. Returns nullptr if the name was used or it failed to allocate memory.

◆ find_or_construct()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
construct_proxy<T> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::find_or_construct ( char_ptr_holder_type  name)
inline

Tries to find an already constructed object. If not exist, constructs an object of type T.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

If T's constructor throws, the function throws that exception. Memory is freed automatically if T's constructor throws and if an array was being constructed, destructors of created objects are called before freeing the memory.

Example:

T *ptr = basic_manager.find_or_construct<T>("Name")(arg1, arg2...);
T *ptr = basic_manager.find_or_construct<T>("Name")[count](arg1, arg2...);

Where, 'arg1, arg2...' are the arguments passed to T's constructor via a proxy object. One can also construct an array using '[ ]' operator. When an array is constructed, each object receives the same arguments.

Template Parameters
TThe type of the object.
Parameters
nameThe name of the object.
Returns
A proxy object that holds a pointer of an already constructed object or an object newly constructed.

◆ construct_it()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
construct_iter_proxy<T> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::construct_it ( char_ptr_holder_type  name)
inline

Allocates an array of objects of type T, receiving arguments from iterators.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

If T's constructor throws, the function throws that exception. Memory is freed automatically if T's constructor throws and if an array was being constructed, destructors of created objects are called before freeing the memory.

Example:

T *ptr = basic_manager.construct_it<T>("Name")[count](it1, it2...);

Each object receives parameters returned with the expression (*it1++, *it2++,... ).

Template Parameters
TThe type of the object.
Parameters
nameA unique name of the object.
Returns
A proxy object to construct an array of objects.

◆ find_or_construct_it()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
construct_iter_proxy<T> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::find_or_construct_it ( char_ptr_holder_type  name)
inline

Tries to find an already constructed object. If not exist, constructs an array of objects of type T, receiving arguments from iterators.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

If T's constructor throws, the function throws that exception. Memory is freed automatically if T's constructor throws and if an array was being constructed, destructors of created objects are called before freeing the memory.

Example:

T *ptr = basic_manager.find_or_construct_it<T>("Name")[count](it1,
it2...);

Each object receives parameters returned with the expression (*it1++, *it2++,... ).

Template Parameters
TThe type of the object.
Parameters
nameA unique name of the object.
Returns
A proxy object that holds a pointer to the already constructed object or constructs an array of objects or just holds an pointer.

◆ find()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
std::pair<T *, size_type> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::find ( char_ptr_holder_type  name) const
inlinenoexcept

Tries to find a previously created object.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

std::pair<T *, std::size_t> ret = basic_manager.find<T>("Name");
Template Parameters
TThe type of the object.
Parameters
nameThe name of the object.
Returns
Returns a pointer to the object and the count (if it is not an array, returns 1). If not present, nullptr is returned.

◆ destroy() [1/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::destroy ( const char *  name)
inline

Destroys a previously created object. Calls the destructor and frees the memory.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

Note
If T's destructor throws: 1) the exception will be thrown (propagated); 2) the memory will won't be freed; 3) the object entry will be still removed from the attributed object directory. Therefore, it is not recommended to throw exception in a destructor.

Example:

bool destroyed = basic_manager.destroy<T>("Name");
Template Parameters
TThe type of the object.
Parameters
nameThe name of the object.
Returns
Returns false if the object was not destroyed.

◆ destroy() [2/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T >
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::destroy ( const metall::mtlldetail::unique_instance_t * const  )
inline

Destroys a unique object of type T. Calls the destructor and frees the memory.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

Note
If T's destructor throws: 1) the exception will be thrown (propagated); 2) the memory will won't be freed; 3) the object entry will be still removed from the attributed object directory. Therefore, it is not recommended to throw exception in a destructor.

Example:

bool destroyed = basic_manager.destroy<T>(metall::unique_instance);
Template Parameters
TThe type of the object.
Returns
Returns false if the object was not destroyed.

◆ destroy_ptr()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::destroy_ptr ( const T *  ptr)
inline

Destroys a object (named, unique, or anonymous) by its address. Calls the destructor and frees the memory. Cannot destroy an object not allocated by construct/find_or_construct functions.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

Note
If T's destructor throws: 1) the exception will be thrown (propagated); 2) the memory will won't be freed; 3) the object entry will be still removed from the attributed object directory. Therefore, it is not recommended to throw exception in a destructor.

Example:

bool destroyed = basic_manager.destroy_ptr<T>(ptr);
Template Parameters
TThe type of the object.
Parameters
ptrA pointer to the object.
Returns
Returns false if the object was not destroyed. Note that the original API developed by Boost.Interprocess library does not return value.

◆ get_instance_name()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
const char_type* metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_instance_name ( const T *  ptr) const
inlinenoexcept

Returns the name of an object created with construct/find_or_construct functions.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

const char_type name = basic_manager.get_instance_name<T>(ptr);
typename manager_kernel_type::char_type char_type
Char type.
Definition: basic_manager.hpp:55
Template Parameters
TThe type of the object.
Parameters
ptrA pointer to the object.
Returns
The name of the object. If ptr points to an unique instance, typeid(T).name() is returned. If ptr points to an anonymous instance or memory not allocated by construct/find_or_construct functions, nullptr is returned.

◆ get_instance_kind()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
instance_kind metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_instance_kind ( const T *  ptr) const
inlinenoexcept

Returns the kind of an object created with construct/find_or_construct functions.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

const instance_kind t = basic_manager.get_instance_kind<T>(ptr);
typename manager_kernel_type::instance_kind instance_kind
An value that describes the type of the instance constructed in memory.
Definition: basic_manager.hpp:117
Template Parameters
TThe type of the object.
Parameters
ptrA pointer to the object.
Returns
The type of the object.

◆ get_instance_length()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
size_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_instance_length ( const T *  ptr) const
inlinenoexcept

Returns the length of an object created with construct/find_or_construct functions (1 if is a single element, >=1 if it's an array).

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

const size_type length = basic_manager.get_instance_length<T>(ptr);
typename manager_kernel_type::size_type size_type
Size type.
Definition: basic_manager.hpp:58
Template Parameters
TThe type of the object.
Parameters
ptrA pointer to the object.
Returns
The type of the object.

◆ is_instance_type()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::is_instance_type ( const void *const  ptr) const
inlinenoexcept

Checks if the type of an object, which was created with construct/find_or_construct functions, is T.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

const bool correct_type = basic_manager.type<T>(ptr);
Template Parameters
TA expected type of the object.
Parameters
ptrA pointer to the object.
Returns
Returns true if T is correct; otherwise false.

◆ get_instance_description()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_instance_description ( const T *  ptr,
std::string *  description 
) const
inlinenoexcept

Gets the description of an object created with construct/find_or_construct.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

std::string description;
basic_manager.get_instance_description<T>(ptr, &description);
basic_string< char > string
A string container that uses char as its character type and Metall as its default allocator.
Definition: string.hpp:23
Template Parameters
TThe type of the object.
Parameters
ptrA pointer to the object.
descriptionA pointer to a string buffer.
Returns
Returns false on error.

◆ set_instance_description()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<class T >
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::set_instance_description ( const T *  ptr,
const std::string &  description 
)
inlinenoexcept

Sets a description to an object created with construct/find_or_construct.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Example:

std::string description;
basic_manager.set_instance_description<T>(ptr, description);
Template Parameters
TThe type of the object.
Parameters
ptrA pointer to the object.
descriptionA description to set.
Returns
Returns false on error.

◆ get_num_named_objects()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
size_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_num_named_objects ( ) const
inlinenoexcept

Returns Returns the number of named objects stored in the managed segment.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Returns
The number of named objects stored in the managed segment.

◆ get_num_unique_objects()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
size_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_num_unique_objects ( ) const
inlinenoexcept

Returns Returns the number of unique objects stored in the managed segment.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
The number of unique objects stored in the managed segment.

◆ get_num_anonymous_objects()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
size_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_num_anonymous_objects ( ) const
inlinenoexcept

Returns Returns the number of anonymous objects (objects constructed with metall::anonymous_instance) stored in the managed segment.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
The number of anonymous objects stored in the managed segment.

◆ named_begin()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const_named_iterator metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::named_begin ( ) const
inlinenoexcept

Returns a constant iterator to the index storing the named objects.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
A constant iterator to the index storing the named objects.

◆ named_end()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const_named_iterator metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::named_end ( ) const
inlinenoexcept

Returns a constant iterator to the end of the index storing the named allocations.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
A constant iterator.

◆ unique_begin()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const_unique_iterator metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::unique_begin ( ) const
inlinenoexcept

Returns a constant iterator to the index storing the unique objects.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
A constant iterator to the index storing the unique objects.

◆ unique_end()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const_unique_iterator metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::unique_end ( ) const
inlinenoexcept

Returns a constant iterator to the end of the index storing the unique allocations.

Attributed object construction family API developed by Boost.Interprocess (see details).

A named object must be associated with non-empty name. The name of an unique object is typeid(T).name(). An anonymous object has no name.

Warning
Constructing or destroying attributed objects breaks attributed object iterators.
Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
A constant iterator.

◆ anonymous_begin()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const_anonymous_iterator metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::anonymous_begin ( ) const
inlinenoexcept

Returns a constant iterator to the index storing the anonymous objects.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
A constant iterator to the index storing the anonymous objects.

◆ anonymous_end()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const_anonymous_iterator metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::anonymous_end ( ) const
inlinenoexcept

Returns a constant iterator to the end of the index storing the anonymous allocations.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Returns
A constant iterator.

◆ allocate()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
void* metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::allocate ( size_type  nbytes)
inlinenoexcept

Allocates nbytes bytes.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

Parameters
nbytesNumber of bytes to allocate.
Returns
Returns a pointer to the allocated memory.

◆ allocate_aligned()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
void* metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::allocate_aligned ( size_type  nbytes,
size_type  alignment 
)
inlinenoexcept

Allocates nbytes bytes. The address of the allocated memory will be a multiple of alignment.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

Parameters
nbytesNumber of bytes to allocate. Must be a multiple alignment.
alignmentAlignment size. Alignment must be a power of two and satisfy [min allocation size, chunk size].
Returns
Returns a pointer to the allocated memory.

◆ deallocate()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
void metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::deallocate ( void *  addr)
inlinenoexcept

Deallocates the allocated memory.

This function is thread-safe. Other threads can also call the attributed object construction functions and allocate functions simultaneously.

Parameters
addrA pointer to the allocated memory to be deallocated.

◆ all_memory_deallocated()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::all_memory_deallocated ( ) const
inlinenoexcept

Check if all allocated memory has been deallocated.

Note
This function is thread-safe as long as no other threads allocate or deallocates memory at the same time.

This function is not cheap if many objects has not been deallocated.

Returns
Returns true if all allocated memory has been deallocated; otherwise, false.

◆ flush()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
void metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::flush ( const bool  synchronous = true)
inlinenoexcept

Flush data to persistent memory.

Warning
This function is not thread-safe and must be called by a single thread at a time.
Parameters
synchronousIf true, performs synchronous operation; otherwise, performs asynchronous operation.

◆ snapshot()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::snapshot ( const path_type destination_path,
const bool  clone = true,
const int  num_max_copy_threads = 0 
)
inlinenoexcept

Takes a snapshot of the current data. The snapshot has a new UUID.

Warning
This function is not thread-safe and must be called by a single thread at a time.
Parameters
destination_pathPath to store a snapshot.
cloneUse the file clone mechanism (reflink) instead of normal copy if it is available.
num_max_copy_threadsThe maximum number of copy threads to use. If <= 0 is given, the value is automatically determined.
Returns
Returns true on success; other false.

◆ copy()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::copy ( const path_type source_path,
const path_type destination_path,
const bool  clone = true,
const int  num_max_copy_threads = 0 
)
inlinestaticnoexcept

Copies data store synchronously. The behavior of copying a data store that is open without the read-only mode is undefined.

This function is thread-safe.

Copying to the same path simultaneously is prohibited.

Parameters
source_pathSource data store path.
destination_pathDestination data store path.
cloneUse the file clone mechanism (reflink) instead of normal copy if it is available.
num_max_copy_threadsThe maximum number of copy threads to use. If <= 0 is given, the value is automatically determined.
Returns
If succeeded, returns true; other false.

◆ copy_async()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static auto metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::copy_async ( const path_type  source_path,
const path_type  destination_path,
const bool  clone = true,
const int  num_max_copy_threads = 0 
)
inlinestaticnoexcept

Copies data store asynchronously. The behavior of copying a data store that is open without the read-only mode is undefined.

This function is thread-safe.

Copying to the same path simultaneously is prohibited.

Parameters
source_pathSource data store path.
destination_pathDestination data store path.
cloneUse the file clone mechanism (reflink) instead of normal copy if it is available.
num_max_copy_threadsThe maximum number of copy threads to use. If <= 0 is given, the value is automatically determined.
Returns
Returns an object of std::future. If succeeded, its get() returns true; other false.

◆ remove()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::remove ( const path_type path)
inlinestaticnoexcept

Removes data store synchronously.

This function is thread-safe.

Must not remove the same data store simultaneously.

Parameters
pathPath to a data store to remove.
Returns
If succeeded, returns true; other false.

◆ remove_async()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static std::future<bool> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::remove_async ( const path_type path)
inlinestaticnoexcept

Remove data store asynchronously.

This function is thread-safe.

Must not remove the same data store simultaneously.

Parameters
pathPath to the data store to remove.
Returns
Returns an object of std::future. If succeeded, its get() returns true; other false

◆ consistent()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::consistent ( const path_type path)
inlinestaticnoexcept

Check if a data store exists and is consistent (i.e., it was closed properly in the previous run).

This function is thread-safe.

Calling this function against a data store that is open without the read-only mode is undefined. If the data store is not consistent, it is recommended to remove the data store and create a new one.

Parameters
pathPath to a data store.
Returns
Returns true if it exists and is consistent; otherwise, returns false.
Examples
simple.cpp, and snapshot.cpp.

◆ get_uuid() [1/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
std::string metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_uuid ( ) const
inlinenoexcept

Returns a UUID of the data store.

This function is thread-safe.

Returns
UUID in the std::string format; returns an empty string on error.

◆ get_uuid() [2/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static std::string metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_uuid ( const path_type path)
inlinestaticnoexcept

Returns a UUID of the data store.

This function is thread-safe.

Parameters
pathPath to a data store.
Returns
UUID in the std::string format; returns an empty string on error.

◆ get_version() [1/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
version_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_version ( ) const
inlinenoexcept

Gets the version of the Metall that created the backing data store.

This function is thread-safe.

Returns
Returns a version number; returns 0 on error.

◆ get_version() [2/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static version_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_version ( const path_type path)
inlinestaticnoexcept

Gets the version of the Metall that created the backing data store.

This function is thread-safe.

Parameters
pathPath to a data store.
Returns
Returns a version number; returns 0 on error.

◆ set_description() [1/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::set_description ( const std::string &  description)
inlinenoexcept

Sets a description to a Metall data store. An existing description is overwritten (only one description per data store).

Warning
This function is not thread-safe and must be called by a single thread at a time.
This function is not thread-safe and must be called by a single thread at a time.
Parameters
descriptionAn std::string object that holds a description.
Returns
Returns true on success; otherwise, false.
Examples
datastore_description.cpp.

◆ set_description() [2/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::set_description ( const path_type path,
const std::string &  description 
)
inlinestaticnoexcept

Sets a description to a Metall data store. An existing description is overwritten (only one description per data store).

Note
This function is thread-safe as long as no other threads modify the same datastore simultaneously.
Parameters
pathPath to a data store.
descriptionAn std::string object that holds a description.
Returns
Returns true on success; otherwise, false.

◆ get_description() [1/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_description ( std::string *  description) const
inlinenoexcept

Gets a description. If there is no description, nothing to happen to the given description object.

Note
This function is thread-safe as long as no other threads modify the same datastore simultaneously.
Parameters
descriptionA pointer to an std::string object to store a description if it exists.
Returns
Returns true on success; returns false on error. Trying to get a non-existent description is not considered as an error.
Examples
datastore_description.cpp.

◆ get_description() [2/2]

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_description ( const path_type path,
std::string *  description 
)
inlinestaticnoexcept

Gets a description. If there is no description, nothing to happen to the given description object.

Note
This function is thread-safe as long as no other threads modify the same datastore simultaneously.
Parameters
pathPath to a data store.
descriptionA pointer to an std::string object to store a description if it exists.
Returns
Returns true on success; returns false on error. Trying to get a non-existent description is not considered as an error.

◆ access_named_object_attribute()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static named_object_attribute_accessor_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::access_named_object_attribute ( const path_type path)
inlinestaticnoexcept

Returns an instance that provides access to the attribute of named objects.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Parameters
pathPath to a data store.
Returns
Returns an instance of named_object_attribute_accessor_type.
Examples
object_attribute.cpp, and object_attribute_api_list.cpp.

◆ access_unique_object_attribute()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static unique_object_attribute_accessor_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::access_unique_object_attribute ( const path_type path)
inlinestaticnoexcept

Returns an instance that provides access to the attribute of unique object.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Parameters
pathPath to a data store.
Returns
Returns an instance of unique_object_attribute_accessor_type.
Examples
object_attribute_api_list.cpp.

◆ access_anonymous_object_attribute()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static anonymous_object_attribute_accessor_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::access_anonymous_object_attribute ( const path_type path)
inlinestaticnoexcept

Returns an instance that provides access to the attribute of anonymous object.

Note
This function is thread-safe as long as no other threads call non-const attributed object construction functions simultaneously.
Parameters
pathPath to a data store.
Returns
Returns an instance of anonymous_object_attribute_accessor_type.
Examples
object_attribute_api_list.cpp.

◆ get_allocator()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
template<typename T = std::byte>
allocator_type<T> metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_allocator ( ) const
inlinenoexcept

Returns a STL compatible allocator object.

This function is thread-safe.

Template Parameters
TType of the object.
Returns
Returns a STL compatible allocator object.

◆ chunk_size()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
static constexpr size_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::chunk_size ( )
inlinestaticconstexprnoexcept

Returns the internal chunk size.

This function is thread-safe.

Returns
The size of internal chunk size.

◆ get_address()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
const void* metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_address ( ) const
inlinenoexcept

Returns the address of the application data segment.

This function is thread-safe.

Returns
The address of the application data segment.

◆ get_size()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
size_type metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::get_size ( ) const
inlinenoexcept

Returns the size (i.e., the maximum total allocation size) of the application data segment. This is a theoretical value. The actual total allocation size Metall can handle will be less than that.

This function is thread-safe.

Returns
The size of the application data segment.

◆ read_only()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::read_only ( ) const
inlinenoexcept

Returns if this manager was opened as read-only.

This function is thread-safe.

Returns
whether or not this manager was opened as read-only

◆ check_sanity()

template<typename storage = kernel::storage, typename segment_storage = kernel::segment_storage, typename chunk_no_type = uint32_t, std::size_t k_chunk_size = (1ULL << 21ULL)>
bool metall::basic_manager< storage, segment_storage, chunk_no_type, k_chunk_size >::check_sanity ( ) const
inlinenoexcept

Checks the sanity.

This function is thread-safe.

Returns
Returns true if there is no issue; otherwise, returns false.

The documentation for this class was generated from the following file: