18 ex <<
"Cannot change file but operation '" << why <<
"' was called";
19 ex.
addContext(
"LocalCacheFile::" + why +
"()");
25 : image_(base->
size()),
36 if (
char *
p = getenv(
"TMPDIR"))
40 pattern +=
"/cmssw-shadow-XXXXXX";
42 std::vector<char>
temp(pattern.c_str(), pattern.c_str()+pattern.size()+1);
43 int fd = mkstemp(&
temp[0]);
47 ex <<
"Cannot create temporary file '" << pattern <<
"': "
48 << strerror(errno) <<
" (error " << errno <<
")";
49 ex.
addContext(
"LocalCacheFile::LocalCacheFile");
78 if (window == MAP_FAILED)
81 ex <<
"Unable to map a window of local cache file: "
82 << strerror(errno) <<
" (error " << errno <<
")";
94 std::ostringstream ost;
95 ost <<
"Unable to cache " << len <<
" byte file segment at " << start <<
": ";
106 ex <<
"Unable to cache " << len <<
" byte file segment at " << start
107 <<
": got only " << nread <<
" bytes back";
130 cache(here, here + n);
148 end += into[
i].
size();
169 {
nowrite(
"write");
return 0; }
173 {
nowrite(
"write");
return 0; }
177 {
nowrite(
"writev");
return 0; }
181 {
nowrite(
"writev");
return 0; }
virtual IOSize readv(IOBuffer *into, IOSize length)
tuple start
Check for commandline option errors.
void cache(IOOffset start, IOOffset end)
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
virtual IOSize read(void *into, IOSize n, IOOffset pos)
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
virtual IOSize read(void *into, IOSize n)
virtual IOOffset position(void) const
virtual IOSize writev(const IOBuffer *from, IOSize n)
LocalCacheFile(Storage *base, const std::string &tmpdir="")
static const IOOffset CHUNK_SIZE
std::vector< char > present_
IOOffset offset(void) const
virtual IOOffset position(IOOffset offset, Relative whence=SET)
virtual IOSize write(const void *from, IOSize n)
virtual IOOffset size(void) const
void addContext(std::string const &context)
virtual IOSize readv(IOBuffer *into, IOSize n)
virtual void resize(IOOffset size)
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
virtual void resize(IOOffset size)
volatile std::atomic< bool > shutdown_flag false
virtual IOFD fd(void) const
tuple size
Write out results.
static void nowrite(const std::string &why)