Metall  v0.28
A persistent memory allocator for data-centric analytics
datastore_description.cpp

This is an example of how to set and get datastore description.

// Copyright 2020 Lawrence Livermore National Security, LLC and other Metall
// Project Developers. See the top-level COPYRIGHT file for details.
//
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
#include <iostream>
#include <string>
#include <cassert>
int main() {
// ----- Non-static methods ----- //
{
metall::manager manager(metall::create_only, "/tmp/dir");
[[maybe_unused]] const auto ret = manager.get_description(&buf);
assert(!ret && buf.empty()); // 'ret' is false and 'buf' is empty since
// description has not been created yet.
manager.set_description("description example");
manager.get_description(&buf);
std::cout << buf << std::endl; // Shows "description example"
}
// ----- Static methods ----- //
{
metall::manager::set_description("/tmp/dir", "description example 2");
std::cout << buf << std::endl; // Shows "description example 2"
}
return 0;
}
A generalized Metall manager class.
Definition: basic_manager.hpp:40
bool set_description(const std::string &description) noexcept
Sets a description to a Metall data store. An existing description is overwritten (only one descripti...
Definition: basic_manager.hpp:1191
bool get_description(std::string *description) const noexcept
Gets a description. If there is no description, nothing to happen to the given description object.
Definition: basic_manager.hpp:1233
int main()
Definition: jgraph.cpp:24
basic_string< char > string
A string container that uses char as its character type and Metall as its default allocator.
Definition: string.hpp:23
basic_manager<> manager
Default Metall manager class which is an alias of basic_manager with the default template parameters.
Definition: metall.hpp:34