|
|
Go to the documentation of this file.
16 ex <<
"Cannot change file but operation '" << why <<
"' was called";
17 ex.
addContext(
"LocalCacheFile::" + why +
"()");
32 if (
char *
p = std::getenv(
"TMPDIR"))
36 pattern +=
"/cmssw-shadow-XXXXXX";
39 int fd = mkstemp(&
temp[0]);
42 ex <<
"Cannot create temporary file '" <<
pattern <<
"': " << strerror(errno) <<
" (error " << errno <<
")";
43 ex.
addContext(
"LocalCacheFile::LocalCacheFile");
47 file_ = std::make_unique<File>(
fd);
63 void *
window = mmap(
nullptr, len, PROT_READ | PROT_WRITE, MAP_SHARED,
file_->fd(),
start);
64 if (
window == MAP_FAILED) {
66 ex <<
"Unable to map a window of local cache file: " << strerror(errno) <<
" (error " << errno <<
")";
75 std::ostringstream ost;
76 ost <<
"Unable to cache " << len <<
" byte file segment at " <<
start <<
": ";
86 ex <<
"Unable to cache " << len <<
" byte file segment at " <<
start <<
": got only " << nread <<
" bytes back";
108 return file_->read(into,
n);
123 return file_->readv(into,
n);
176 return file_->prefetch(what,
n);
virtual IOOffset size(void) const
void addContext(std::string const &context)
~LocalCacheFile(void) override
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
std::vector< char > present_
static const IOOffset CHUNK_SIZE
void close(void) override
IOSize readv(IOBuffer *into, IOSize n) override
void resize(IOOffset size) override
edm::propagate_const< std::unique_ptr< File > > file_
edm::propagate_const< std::unique_ptr< Storage > > storage_
void flush(void) override
IOSize write(const void *from, IOSize n) override
IOSize writev(const IOBuffer *from, IOSize n) override
IOOffset offset(void) const
virtual IOOffset position(void) const
bool prefetch(const IOPosBuffer *what, IOSize n) override
void cache(IOOffset start, IOOffset end)
LocalCacheFile(std::unique_ptr< Storage > base, const std::string &tmpdir="")
static void nowrite(const std::string &why)