Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes
stxxl::wbtl_file Class Reference

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

#include <wbtl_file.h>

Inheritance diagram for stxxl::wbtl_file:
Inheritance graph
[legend]
Collaboration diagram for stxxl::wbtl_file:
Collaboration graph
[legend]

List of all members.

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
 ~wbtl_file ()
offset_type size ()
 Returns size of the file.
void set_size (offset_type newsize)
void lock ()
 Locks file for reading and writing (acquires a lock in the file system)
void serve (const request *req) throw (io_error)
void discard (offset_type offset, offset_type size)
const char * io_type () const
 Identifies the type of I/O implementation.

Protected Member Functions

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

Private Types

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

Private Member Functions

void _add_free_region (offset_type offset, offset_type size)

Private Attributes

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

Detailed Description

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

Definition at line 37 of file wbtl_file.h.


Member Typedef Documentation

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

Definition at line 39 of file wbtl_file.h.

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

Definition at line 41 of file wbtl_file.h.

typedef std::map<offset_type, offset_type> stxxl::wbtl_file::sortseq [private]

Definition at line 40 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

Parameters:
backend_filefile object used as storage backend, will be deleted in ~wbtl_file()
diskdisk(file) identifier

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 
)
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

Reimplemented from 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 ( const request req) throw (io_error) [virtual]

Implements stxxl::file.

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

Definition at line 50 of file wbtl_file.h.

Definition at line 67 of file wbtl_file.h.

Definition at line 64 of file wbtl_file.h.

Definition at line 62 of file wbtl_file.h.

int stxxl::wbtl_file::curbuf [private]

Definition at line 65 of file wbtl_file.h.

Definition at line 66 of file wbtl_file.h.

Definition at line 55 of file wbtl_file.h.

Definition at line 54 of file wbtl_file.h.

Definition at line 48 of file wbtl_file.h.

Definition at line 52 of file wbtl_file.h.

Definition at line 44 of file wbtl_file.h.

Definition at line 45 of file wbtl_file.h.

Definition at line 46 of file wbtl_file.h.

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

Definition at line 63 of file wbtl_file.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines