#include <TStorageFactoryFile.h>
|
| ClassDef (TStorageFactoryFile, 0) |
|
virtual Bool_t | ReadBuffer (char *buf, Int_t len) |
|
virtual Bool_t | ReadBuffer (char *buf, Long64_t pos, Int_t len) |
|
virtual Bool_t | ReadBufferAsync (Long64_t off, Int_t len) |
|
virtual Bool_t | ReadBuffers (char *buf, Long64_t *pos, Int_t *len, Int_t nbuf) |
|
void | ResetErrno (void) const |
|
| TStorageFactoryFile (const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1) |
|
virtual Bool_t | WriteBuffer (const char *buf, Int_t len) |
|
| ~TStorageFactoryFile (void) |
|
|
virtual Int_t | SysClose (Int_t fd) |
|
virtual Int_t | SysOpen (const char *pathname, Int_t flags, UInt_t mode) |
|
virtual Long64_t | SysSeek (Int_t fd, Long64_t offset, Int_t whence) |
|
virtual Int_t | SysStat (Int_t fd, Long_t *id, Long64_t *size, Long_t *flags, Long_t *modtime) |
|
virtual Int_t | SysSync (Int_t fd) |
|
TFile wrapper around StorageFactory and Storage.
Definition at line 11 of file TStorageFactoryFile.h.
TStorageFactoryFile::TStorageFactoryFile |
( |
const char * |
name, |
|
|
Option_t * |
option = "" , |
|
|
const char * |
ftitle = "" , |
|
|
Int_t |
compress = 1 |
|
) |
| |
Definition at line 97 of file TStorageFactoryFile.cc.
References SurfaceDeformationFactory::create(), edm::hlt::Exception, StorageFactory::get(), IOFlags::OpenCreate, IOFlags::OpenRead, IOFlags::OpenTruncate, IOFlags::OpenWrite, path(), SiPixelLorentzAngle_cfi::read, s_statsCtor, storage_, storageCounter(), StorageAccount::Stamp::tick(), and update.
101 : TFile(
path,
"NET", ftitle, compress),
110 if (fOption ==
"NEW")
113 Bool_t
create = (fOption ==
"CREATE");
114 Bool_t recreate = (fOption ==
"RECREATE");
115 Bool_t
update = (fOption ==
"UPDATE");
116 Bool_t
read = (fOption ==
"READ");
118 if (!create && !recreate && !update && !read)
126 if (!gSystem->AccessPathName(
path, kFileExists))
127 gSystem->Unlink(
path);
134 if (update && gSystem->AccessPathName(
path, kFileExists))
150 throw cms::Exception(
"TStorageFactoryFile::TStorageFactoryFile()")
151 <<
"Cannot open file '" <<
path <<
"'";
156 fWritable = read ? kFALSE : kTRUE;
static StorageFactory * get(void)
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label)
static StorageAccount::Counter * s_statsCtor
TStorageFactoryFile::~TStorageFactoryFile |
( |
void |
| ) |
|
TStorageFactoryFile::TStorageFactoryFile |
( |
void |
| ) |
|
|
private |
Bool_t TStorageFactoryFile::ReadBuffer |
( |
char * |
buf, |
|
|
Int_t |
len |
|
) |
| |
|
virtual |
Definition at line 183 of file TStorageFactoryFile.cc.
References trackerHits::c, n, s_statsCPrefetch, s_statsCRead, s_statsRead, s_statsXRead, storage_, storageCounter(), StorageAccount::Stamp::tick(), and IOInput::xread().
Referenced by ReadBuffer().
188 Error(
"ReadBuffer",
"Cannot read from a zombie file");
194 Error(
"ReadBuffer",
"Cannot read from a file that is not open");
211 if (TFileCacheRead *
c = GetCacheRead())
213 Long64_t here = GetRelOffset();
214 Bool_t async =
c->IsAsyncReading();
220 Int_t st = ReadBufferViaCache(async ? 0 : buf, len);
246 return n ? kFALSE : kTRUE;
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label)
static StorageAccount::Counter * s_statsRead
static StorageAccount::Counter * s_statsXRead
static StorageAccount::Counter * s_statsCPrefetch
static StorageAccount::Counter * s_statsCRead
Bool_t TStorageFactoryFile::ReadBuffer |
( |
char * |
buf, |
|
|
Long64_t |
pos, |
|
|
Int_t |
len |
|
) |
| |
|
virtual |
Bool_t TStorageFactoryFile::ReadBufferAsync |
( |
Long64_t |
off, |
|
|
Int_t |
len |
|
) |
| |
|
virtual |
Definition at line 250 of file TStorageFactoryFile.cc.
References StorageFactory::CACHE_HINT_APPLICATION, StorageFactory::CACHE_HINT_STORAGE, StorageFactory::cacheHint(), f, StorageFactory::get(), o2o::iov, Storage::prefetch(), s_statsARead, storage_, storageCounter(), and StorageAccount::Stamp::tick().
255 Error(
"ReadBufferAsync",
"Cannot read from a zombie file");
261 Error(
"ReadBufferAsync",
"Cannot read from a file that is not open");
CacheHint cacheHint(void) const
static StorageFactory * get(void)
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label)
static StorageAccount::Counter * s_statsARead
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
Bool_t TStorageFactoryFile::ReadBuffers |
( |
char * |
buf, |
|
|
Long64_t * |
pos, |
|
|
Int_t * |
len, |
|
|
Int_t |
nbuf |
|
) |
| |
|
virtual |
Definition at line 304 of file TStorageFactoryFile.cc.
References i, IOSized(), o2o::iov, j, gen::k, n, Storage::prefetch(), READ_COALESCE_SIZE, query::result, s_statsARead, s_statsXRead, storage_, storageCounter(), summarizeEdmComparisonLogfiles::success, StorageAccount::Stamp::tick(), pileupDistInMC::total, and IOInput::xread().
309 Error(
"ReadBuffers",
"Cannot read from a zombie file");
315 Error(
"ReadBuffers",
"Cannot read from a file that is not open");
330 TFileCacheRead *old = fCacheRead;
334 std::vector<char> buf2(0);
351 Bool_t bigRead = kTRUE;
364 if (bigRead || (i>=nbuf))
393 assert(len[i-1] >= 0);
394 assert(
pos[i-1] >= curbegin);
399 result = ( nahead ==
storage_->
xread(&buf2[0], nahead)) ? kFALSE : kTRUE;
407 for (Int_t
j=0;
j<
n;
j++) {
408 memcpy(&buf[k],&buf2[
pos[i-n+
j]-curbegin],len[i-n+
j]);
422 std::vector<IOPosBuffer>
iov;
424 for (Int_t i = 0; i < nbuf; ++
i)
426 iov.push_back(
IOPosBuffer(
pos[i], buf ? buf + total : 0, len[i]));
439 return success ? kFALSE : TFile::ReadBuffers(buf,
pos, len, nbuf);
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label)
static StorageAccount::Counter * s_statsARead
static StorageAccount::Counter * s_statsXRead
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
IOSize IOSized(IOOffset n)
#define READ_COALESCE_SIZE
void TStorageFactoryFile::ResetErrno |
( |
void |
| ) |
const |
Int_t TStorageFactoryFile::SysClose |
( |
Int_t |
fd | ) |
|
|
protectedvirtual |
Int_t TStorageFactoryFile::SysOpen |
( |
const char * |
pathname, |
|
|
Int_t |
flags, |
|
|
UInt_t |
mode |
|
) |
| |
|
protectedvirtual |
Definition at line 506 of file TStorageFactoryFile.cc.
References Storage::close(), edm::hlt::Exception, StorageFactory::get(), O_NONBLOCK, IOFlags::OpenAppend, IOFlags::OpenCreate, IOFlags::OpenExclusive, IOFlags::OpenNonBlock, IOFlags::OpenRead, IOFlags::OpenTruncate, IOFlags::OpenWrite, s_statsOpen, storage_, storageCounter(), and StorageAccount::Stamp::tick().
531 <<
"Cannot open file '" << pathname <<
"'";
std::vector< Variable::Flags > flags
static StorageFactory * get(void)
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label)
static StorageAccount::Counter * s_statsOpen
Long64_t TStorageFactoryFile::SysSeek |
( |
Int_t |
fd, |
|
|
Long64_t |
offset, |
|
|
Int_t |
whence |
|
) |
| |
|
protectedvirtual |
Int_t TStorageFactoryFile::SysStat |
( |
Int_t |
fd, |
|
|
Long_t * |
id, |
|
|
Long64_t * |
size, |
|
|
Long_t * |
flags, |
|
|
Long_t * |
modtime |
|
) |
| |
|
protectedvirtual |
Int_t TStorageFactoryFile::SysSync |
( |
Int_t |
fd | ) |
|
|
protectedvirtual |
Bool_t TStorageFactoryFile::WriteBuffer |
( |
const char * |
buf, |
|
|
Int_t |
len |
|
) |
| |
|
virtual |
Definition at line 443 of file TStorageFactoryFile.cc.
References n, s_statsCWrite, s_statsWrite, s_statsXWrite, storage_, storageCounter(), StorageAccount::Stamp::tick(), and IOOutput::xwrite().
448 Error(
"WriteBuffer",
"Cannot write to a zombie file");
454 Error(
"WriteBuffer",
"Cannot write to a file that is not open");
460 Error(
"WriteBuffer",
"File is not writable");
469 switch ((st = WriteBufferViaCache(buf, len)))
480 return n > 0 ? kFALSE : kTRUE;
490 Error(
"WriteBuffer",
"Error writing to cache");
IOSize xwrite(const void *from, IOSize n)
static StorageAccount::Counter * s_statsWrite
static StorageAccount::Counter * s_statsXWrite
static StorageAccount::Counter & storageCounter(StorageAccount::Counter *&c, const char *label)
static StorageAccount::Counter * s_statsCWrite
Storage* TStorageFactoryFile::storage_ |
|
private |
Definition at line 38 of file TStorageFactoryFile.h.
Referenced by ReadBuffer(), ReadBufferAsync(), ReadBuffers(), SysClose(), SysOpen(), SysSeek(), SysStat(), SysSync(), TStorageFactoryFile(), WriteBuffer(), and ~TStorageFactoryFile().