STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::wbtl_file Class Reference

Detailed Description

Implementation of file based on buffered writes and block remapping via a translation layer.

Definition at line 36 of file wbtl_file.h.

+ Inheritance diagram for stxxl::wbtl_file:
+ Collaboration diagram for stxxl::wbtl_file:

Classes

struct  FirstFit
 

Public Member Functions

 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. param backend_file file object used as storage backend, will be deleted in ~wbtl_file() More...
 
 ~wbtl_file ()
 
void discard (offset_type offset, offset_type size)
 
const char * io_type () const
 Identifies the type of I/O implementation. More...
 
void lock ()
 Locks file for reading and writing (acquires a lock in the file system). More...
 
void serve (void *buffer, offset_type offset, size_type bytes, request::request_type type)
 
void set_size (offset_type newsize)
 
offset_type size ()
 Returns size of the file. More...
 
- Public Member Functions inherited from stxxl::disk_queued_file
 disk_queued_file (int queue_id, int allocator_id)
 
request_ptr aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())
 
request_ptr awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())
 
virtual int get_allocator_id () const
 Returns the file's disk allocator number. More...
 
virtual int get_queue_id () const
 Returns the identifier of the file's queue number. More...
 
- Public Member Functions inherited from stxxl::file
 file (unsigned int device_id=DEFAULT_DEVICE_ID)
 Construct a new file, usually called by a subclass. More...
 
virtual ~file () noexcept(false)
 
void add_request_ref ()
 increment referenced requests More...
 
virtual request_ptr aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())=0
 Schedules an asynchronous read request to the file. More...
 
virtual request_ptr awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl=completion_handler())=0
 Schedules an asynchronous write request to the file. More...
 
virtual void close_remove ()
 close and remove file More...
 
void delete_request_ref ()
 decrement referenced requests More...
 
virtual void discard (offset_type offset, offset_type size)
 Discard a region of the file (mark it unused). Some specialized file types may need to know freed regions. More...
 
virtual void export_files (offset_type offset, offset_type length, std::string prefix)
 
unsigned int get_device_id () const
 Returns the file's physical device id. More...
 
unsigned_type get_request_nref ()
 return number of referenced requests More...
 
virtual void serve (void *buffer, offset_type offset, size_type bytes, request::request_type type)=0
 
virtual void set_size (offset_type newsize)=0
 Changes the size of the file. More...
 

Protected Member Functions

void check_corruption (offset_type region_pos, offset_type region_size, sortseq::iterator pred, sortseq::iterator succ)
 
offset_type get_next_write_block ()
 
void sread (void *buffer, offset_type offset, size_type bytes)
 
void swrite (void *buffer, offset_type offset, size_type bytes)
 

Private Types

typedef std::pair< offset_type,
offset_type
place
 
typedef std::map< offset_type,
place
place_map
 
typedef std::map< offset_type,
offset_type
sortseq
 

Private Member Functions

void _add_free_region (offset_type offset, offset_type size)
 

Private Attributes

sortseq address_mapping
 
request_ptr backend_request
 
offset_type buffer_address [2]
 
mutex buffer_mutex
 
int curbuf
 
size_type curpos
 
offset_type free_bytes
 
sortseq free_space
 
mutex mapping_mutex
 
place_map reverse_mapping
 
filestorage
 
offset_type sz
 
size_type write_block_size
 
char * write_buffer [2]
 

Additional Inherited Members

- Public Types inherited from stxxl::file
typedef request::offset_type offset_type
 the offset of a request, also the size of the file More...
 
enum  open_mode {
  RDONLY = 1, WRONLY = 2, RDWR = 4, CREAT = 8,
  DIRECT = 16, TRUNC = 32, SYNC = 64, NO_LOCK = 128,
  REQUIRE_DIRECT = 256
}
 Definition of acceptable file open modes. More...
 
typedef request::size_type size_type
 the size of a request More...
 
- Static Public Member Functions inherited from stxxl::file
static int unlink (const char *path)
 unlink path from filesystem More...
 
static int truncate (const char *path, external_size_type length)
 truncate a path to given length. Use this only if you dont have a fileio-specific object, which provides truncate(). More...
 
- Static Public Attributes inherited from stxxl::file
static const unsigned int DEFAULT_DEVICE_ID = (unsigned int)(-1)
 
static const int DEFAULT_LINUXAIO_QUEUE = -2
 
static const int DEFAULT_QUEUE = -1
 
static const int NO_ALLOCATOR = -1
 
- Protected Attributes inherited from stxxl::file
unsigned int m_device_id
 The file's physical device id (e.g. used for prefetching sequence calculation) More...
 
atomic_counted_object m_request_ref
 count the number of requests referencing this file More...
 

Member Typedef Documentation

typedef std::pair<offset_type, offset_type> stxxl::wbtl_file::place
private

Definition at line 38 of file wbtl_file.h.

typedef std::map<offset_type, place> stxxl::wbtl_file::place_map
private

Definition at line 40 of file wbtl_file.h.

Definition at line 39 of file wbtl_file.h.

Constructor & Destructor Documentation

stxxl::wbtl_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. param backend_file file object used as storage backend, will be deleted in ~wbtl_file()

stxxl::wbtl_file::~wbtl_file ( )

Member Function Documentation

void stxxl::wbtl_file::_add_free_region ( offset_type  offset,
offset_type  size 
)
private
void stxxl::wbtl_file::check_corruption ( offset_type  region_pos,
offset_type  region_size,
sortseq::iterator  pred,
sortseq::iterator  succ 
)
protected
void stxxl::wbtl_file::discard ( offset_type  offset,
offset_type  size 
)
offset_type stxxl::wbtl_file::get_next_write_block ( )
protected
const char* stxxl::wbtl_file::io_type ( ) const
virtual

Identifies the type of I/O implementation.

Returns
pointer to null terminated string of characters, containing the name of I/O implementation

Implements stxxl::file.

void stxxl::wbtl_file::lock ( )
virtual

Locks file for reading and writing (acquires a lock in the file system).

Implements stxxl::file.

Referenced by stxxl::create_file().

void stxxl::wbtl_file::serve ( void *  buffer,
offset_type  offset,
size_type  bytes,
request::request_type  type 
)
void stxxl::wbtl_file::set_size ( offset_type  newsize)
offset_type stxxl::wbtl_file::size ( )
virtual

Returns size of the file.

Returns
file size in bytes

Implements stxxl::file.

void stxxl::wbtl_file::sread ( void *  buffer,
offset_type  offset,
size_type  bytes 
)
protected
void stxxl::wbtl_file::swrite ( void *  buffer,
offset_type  offset,
size_type  bytes 
)
protected

Member Data Documentation

sortseq stxxl::wbtl_file::address_mapping
private

Definition at line 49 of file wbtl_file.h.

request_ptr stxxl::wbtl_file::backend_request
private

Definition at line 66 of file wbtl_file.h.

offset_type stxxl::wbtl_file::buffer_address[2]
private

Definition at line 63 of file wbtl_file.h.

mutex stxxl::wbtl_file::buffer_mutex
private

Definition at line 61 of file wbtl_file.h.

int stxxl::wbtl_file::curbuf
private

Definition at line 64 of file wbtl_file.h.

size_type stxxl::wbtl_file::curpos
private

Definition at line 65 of file wbtl_file.h.

offset_type stxxl::wbtl_file::free_bytes
private

Definition at line 54 of file wbtl_file.h.

sortseq stxxl::wbtl_file::free_space
private

Definition at line 53 of file wbtl_file.h.

mutex stxxl::wbtl_file::mapping_mutex
private

Definition at line 47 of file wbtl_file.h.

place_map stxxl::wbtl_file::reverse_mapping
private

Definition at line 51 of file wbtl_file.h.

file* stxxl::wbtl_file::storage
private

Definition at line 43 of file wbtl_file.h.

offset_type stxxl::wbtl_file::sz
private

Definition at line 44 of file wbtl_file.h.

size_type stxxl::wbtl_file::write_block_size
private

Definition at line 45 of file wbtl_file.h.

char* stxxl::wbtl_file::write_buffer[2]
private

Definition at line 62 of file wbtl_file.h.


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