Claudiu
Claudiu

Reputation: 229561

Specify location to store stxxl::map/persist its data?

stxxl::vector has a constructor where you can provide a stxxl::file *. This ties the vector to that specific file:

typedef stxxl::VECTOR_GENERATOR<int>::result stxxl_vector_int;
{
    stxxl::syscall_file f("some_vec.bin", stxxl::file::RDWR | stxxl::file::CREAT);
    stxxl_vector_int vec = stxxl_vector_int(&f);
    vec.push_back(1);
}
{
    stxxl::syscall_file f("some_vec.bin", stxxl::file::RDWR | stxxl::file::CREAT);
    stxxl_vector_int vec = stxxl_vector_int(&f);
    std::cout << vec.size() << std::endl;
}

This outputs 1 on the first run, 2 on the second run (if the file wasn't deleted), etc.

How can I do the same for an stxxl::map? I don't see any functions in the docs which have anything to do with stxxl::files.

Specifically, I want to specify a location on disk where the map is stored, instead of wherever stxxl usually does it, so that I can destruct the instance, create a new one, and have it already contain the same data as the destructed instance (i.e. persist the stxxl::map's data using stxxl's already-existing disk storage mechanisms).

Upvotes: 1

Views: 263

Answers (0)

Related Questions