#include <Utilities/StorageFactory/interface/Storage.h>
Public Types | |
enum | Relative { SET, CURRENT, END } |
Public Member Functions | |
virtual void | close (void) |
virtual bool | eof (void) const |
virtual void | flush (void) |
virtual IOOffset | position (IOOffset offset, Relative whence=SET)=0 |
virtual IOOffset | position (void) const |
virtual bool | prefetch (const IOPosBuffer *what, IOSize n) |
IOSize | read (IOBuffer into, IOOffset pos) |
virtual IOSize | read (void *into, IOSize n, IOOffset pos) |
virtual IOSize | readv (IOPosBuffer *into, IOSize buffers) |
virtual void | resize (IOOffset size)=0 |
virtual void | rewind (void) |
virtual IOOffset | size (void) const |
Storage (void) | |
IOSize | write (IOBuffer from, IOOffset pos) |
virtual IOSize | write (const void *from, IOSize n, IOOffset pos) |
virtual IOSize | writev (const IOPosBuffer *from, IOSize buffers) |
virtual | ~Storage (void) |
Private Member Functions | |
Storage & | operator= (const Storage &) |
Storage (const Storage &) |
Definition at line 8 of file Storage.h.
enum Storage::Relative |
Storage::Storage | ( | void | ) |
Storage::~Storage | ( | void | ) | [virtual] |
Storage::Storage | ( | const Storage & | ) | [private] |
Reimplemented in DCacheFile, RFIOFile, File, LocalCacheFile, RemoteFile, StorageAccountProxy, and XrdFile.
Definition at line 128 of file Storage.cc.
Referenced by StorageAccountProxy::close(), LocalCacheFile::close(), TStorageFactoryFile::SysClose(), and TStorageFactoryFile::SysOpen().
Reimplemented in File, LocalCacheFile, and StorageAccountProxy.
Definition at line 124 of file Storage.cc.
Referenced by StorageAccountProxy::flush(), and TStorageFactoryFile::SysSync().
Implemented in DCacheFile, RFIOFile, File, LocalCacheFile, StorageAccountProxy, and XrdFile.
Definition at line 95 of file Storage.cc.
References CURRENT.
Referenced by eof(), StorageAccountProxy::position(), read(), readv(), RFIOFile::reopen(), rewind(), size(), TStorageFactoryFile::SysSeek(), write(), File::write(), and File::writev().
00096 { 00097 Storage *self = const_cast<Storage *> (this); 00098 return self->position (0, CURRENT); 00099 }
bool Storage::prefetch | ( | const IOPosBuffer * | what, | |
IOSize | n | |||
) | [virtual] |
Reimplemented in RFIOFile, File, LocalCacheFile, StorageAccountProxy, and XrdFile.
Definition at line 119 of file Storage.cc.
Referenced by StorageAccountProxy::prefetch(), TStorageFactoryFile::ReadBufferAsync(), and TStorageFactoryFile::ReadBuffers().
Definition at line 13 of file Storage.cc.
References IOBuffer::data(), IOInput::read(), and IOBuffer::size().
Reimplemented in File, LocalCacheFile, StorageAccountProxy, and XrdFile.
Definition at line 17 of file Storage.cc.
References position(), and IOInput::read().
Referenced by LocalCacheFile::cache(), mcdbGetInputFile(), PixelSLinkDataInputSource::PixelSLinkDataInputSource(), PixelSLinkDataInputSource::produce(), and StorageAccountProxy::read().
00018 { 00019 // FIXME: this is not thread safe! split into separate interface 00020 // that a particular storage can choose to support or not? make 00021 // sure that throw semantics are correct here! 00022 // FIXME: use saveposition object in case exceptions are thrown? 00023 IOOffset here = position (); 00024 position (pos); 00025 n = read (into, n); 00026 position (here); 00027 return n; 00028 }
IOSize Storage::readv | ( | IOPosBuffer * | into, | |
IOSize | buffers | |||
) | [virtual] |
Reimplemented in RFIOFile, LocalCacheFile, StorageAccountProxy, and XrdFile.
Definition at line 31 of file Storage.cc.
References data, i, offset, position(), IOInput::read(), and size().
Referenced by TStorageFactoryFile::ReadBuffers(), LocalCacheFile::readv(), StorageAccountProxy::readv(), and RFIOFile::readv().
00032 { 00033 IOOffset here = position(); 00034 IOSize total = 0; 00035 for (IOSize i = 0; i < n; ++i) 00036 { 00037 try 00038 { 00039 position(into[i].offset()); 00040 total += read(into[i].data(), into[i].size()); 00041 } 00042 catch (cms::Exception &) 00043 { 00044 if (! total) 00045 throw; 00046 break; 00047 } 00048 } 00049 position(here); 00050 return total; 00051 }
Implemented in DCacheFile, RFIOFile, File, LocalCacheFile, StorageAccountProxy, and XrdFile.
Referenced by StorageAccountProxy::resize().
Reimplemented in File.
Definition at line 102 of file Storage.cc.
References END, and position().
Referenced by eof(), StorageAccountProxy::prefetch(), LocalCacheFile::readv(), readv(), TStorageFactoryFile::SysStat(), and writev().
00103 { 00104 // FIXME: use saveposition object in case exceptions are thrown? 00105 Storage *self = const_cast<Storage *> (this); 00106 IOOffset here = position (); 00107 self->position (0, END); 00108 IOOffset size = position (); 00109 self->position (here); // FIXME: VERIFY()? 00110 return size; 00111 }
Definition at line 55 of file Storage.cc.
References IOBuffer::data(), IOBuffer::size(), and write().
Reimplemented in File, LocalCacheFile, StorageAccountProxy, and XrdFile.
Definition at line 59 of file Storage.cc.
References position().
Referenced by write(), StorageAccountProxy::write(), and writev().
00060 { 00061 // FIXME: this is not thread safe! split into separate interface 00062 // that a particular storage can choose to support or not? make 00063 // sure that throw semantics are correct here! 00064 00065 // FIXME: use saveposition object in case exceptions are thrown? 00066 IOOffset here = position (); 00067 position (pos); 00068 n = write (from, n); 00069 position (here); 00070 return n; 00071 }
IOSize Storage::writev | ( | const IOPosBuffer * | from, | |
IOSize | buffers | |||
) | [virtual] |
Reimplemented in LocalCacheFile, and StorageAccountProxy.
Definition at line 74 of file Storage.cc.
References data, i, offset, size(), and write().
Referenced by StorageAccountProxy::writev().
00075 { 00076 IOSize total = 0; 00077 for (IOSize i = 0; i < n; ++i) 00078 { 00079 try 00080 { 00081 total += write(from[i].data(), from[i].size(), from[i].offset()); 00082 } 00083 catch (cms::Exception &) 00084 { 00085 if (! total) 00086 throw; 00087 break; 00088 } 00089 } 00090 return total; 00091 }