16 #ifndef STXXL_WBTL_FILE_HEADER
17 #define STXXL_WBTL_FILE_HEADER
19 #ifndef STXXL_HAVE_WBTL_FILE
20 #define STXXL_HAVE_WBTL_FILE 1
23 #if STXXL_HAVE_WBTL_FILE
27 #include <stxxl/bits/io/disk_queued_file.h>
30 __STXXL_BEGIN_NAMESPACE
39 typedef std::pair<offset_type, offset_type> place;
40 typedef std::map<offset_type, offset_type> sortseq;
41 typedef std::map<offset_type, place> place_map;
46 size_type write_block_size;
50 sortseq address_mapping;
52 place_map reverse_mapping;
55 offset_type free_bytes;
63 char * write_buffer[2];
64 offset_type buffer_address[2];
69 struct FirstFit :
public std::binary_function<place, offset_type, bool>
73 const offset_type
size)
const
75 return (entry.second >= size);
85 size_type write_buffer_size,
86 int write_buffers = 2,
87 int queue_id = DEFAULT_QUEUE,
88 int allocator_id = NO_ALLOCATOR);
91 void set_size(offset_type newsize);
93 void serve(
const request * req)
throw (io_error);
94 void discard(offset_type offset, offset_type size);
98 void _add_free_region(offset_type offset, offset_type size);
101 void sread(
void * buffer, offset_type offset, size_type bytes);
102 void swrite(
void * buffer, offset_type offset, size_type bytes);
103 offset_type get_next_write_block();
104 void check_corruption(offset_type region_pos, offset_type region_size,
105 sortseq::iterator pred, sortseq::iterator succ);
110 __STXXL_END_NAMESPACE
112 #endif // #if STXXL_HAVE_WBTL_FILE
114 #endif // !STXXL_WBTL_FILE_HEADER
Defines interface of file.
Definition: file.h:90
void lock()
Locks file for reading and writing (acquires a lock in the file system)
Request with basic properties like file and offset.
Definition: request.h:39
offset_type size()
Returns size of the file.
wbtl_file(file *backend_file, size_type write_buffer_size, int write_buffers=2, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR)
constructs file object
Implemented as reference counting smart pointer.
Definition: request_ptr.h:34
Implementation of file based on buffered writes and block remapping via a translation layer...
Definition: wbtl_file.h:37
const char * io_type() const
Identifies the type of I/O implementation.
Implementation of some file methods based on serving_request.
Definition: disk_queued_file.h:26