13 #ifndef STXXL_FILEPERBLOCK_FILE_HEADER
14 #define STXXL_FILEPERBLOCK_FILE_HEADER
17 #include <stxxl/bits/io/disk_queued_file.h>
20 __STXXL_BEGIN_NAMESPACE
27 template <
class base_file_type>
31 std::string filename_prefix;
33 unsigned_type current_size;
34 bool lock_file_created;
35 base_file_type lock_file;
47 const std::string & filename_prefix,
49 int queue_id = DEFAULT_QUEUE,
50 int allocator_id = NO_ALLOCATOR);
54 virtual void serve(
const request * req)
throw (io_error);
58 virtual void set_size(offset_type new_size) { current_size = new_size; }
62 virtual offset_type
size() {
return current_size; }
68 virtual void discard(offset_type offset, offset_type length);
71 virtual void export_files(offset_type offset, offset_type length, std::string filename);
80 #endif // !STXXL_FILEPERBLOCK_FILE_HEADER
fileperblock_file(const std::string &filename_prefix, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR)
constructs file object
Definition: fileperblock_file.cpp:28
virtual void discard(offset_type offset, offset_type length)
Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted...
Definition: fileperblock_file.cpp:84
Request with basic properties like file and offset.
Definition: request.h:39
virtual void set_size(offset_type new_size)
Changes the size of the file.
Definition: fileperblock_file.h:58
std::string filename_for_block(unsigned_type offset)
Constructs a file name for a given block.
Definition: fileperblock_file.cpp:45
virtual offset_type size()
Returns size of the file.
Definition: fileperblock_file.h:62
virtual void export_files(offset_type offset, offset_type length, std::string filename)
Rename the file corresponding to the offset such that it is out of reach for deleting.
Definition: fileperblock_file.cpp:97
const char * io_type() const
Identifies the type of I/O implementation.
Definition: fileperblock_file.cpp:110
virtual void lock()
Locks file for reading and writing (acquires a lock in the file system)
Definition: fileperblock_file.cpp:67
Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.
Definition: fileperblock_file.h:28
Implementation of some file methods based on serving_request.
Definition: disk_queued_file.h:26