CMS 3D CMS Logo

LocalCacheFile.h
Go to the documentation of this file.
1 #ifndef STORAGE_FACTORY_LOCAL_CACHE_FILE_H
2 #define STORAGE_FACTORY_LOCAL_CACHE_FILE_H
3 
7 #include <vector>
8 #include <string>
9 #include <memory>
10 
11 namespace edm::storage {
13  class LocalCacheFile : public Storage {
14  public:
15  LocalCacheFile(std::unique_ptr<Storage> base, const std::string &tmpdir = "");
16  ~LocalCacheFile(void) override;
17 
18  using Storage::read;
19  using Storage::write;
20 
21  bool prefetch(const IOPosBuffer *what, IOSize n) override;
22  IOSize read(void *into, IOSize n) override;
23  IOSize read(void *into, IOSize n, IOOffset pos) override;
24  IOSize readv(IOBuffer *into, IOSize n) override;
25  IOSize readv(IOPosBuffer *into, IOSize n) override;
26  IOSize write(const void *from, IOSize n) override;
27  IOSize write(const void *from, IOSize n, IOOffset pos) override;
28  IOSize writev(const IOBuffer *from, IOSize n) override;
29  IOSize writev(const IOPosBuffer *from, IOSize n) override;
30 
31  IOOffset position(IOOffset offset, Relative whence = SET) override;
32  void resize(IOOffset size) override;
33  void flush(void) override;
34  void close(void) override;
35 
36  private:
37  void cache(IOOffset start, IOOffset end);
38 
40  std::vector<char> present_;
44  unsigned int cacheCount_;
45  unsigned int cacheTotal_;
46  };
47 } // namespace edm::storage
48 #endif // STORAGE_FACTORY_LOCAL_CACHE_FILE_H
Definition: start.py:1
int64_t IOOffset
Definition: IOTypes.h:20
IOSize write(const void *from, IOSize n) override
edm::propagate_const< std::unique_ptr< Storage > > storage_
IOSize writev(const IOBuffer *from, IOSize n) override
void cache(IOOffset start, IOOffset end)
virtual IOOffset size() const
Definition: Storage.cc:509
edm::propagate_const< std::unique_ptr< File > > file_
bool prefetch(const IOPosBuffer *what, IOSize n) override
size_t IOSize
Definition: IOTypes.h:15
IOSize readv(IOBuffer *into, IOSize n) override
IOSize write(unsigned char byte)
Definition: Storage.cc:329
virtual IOOffset position() const
Definition: Storage.cc:504
LocalCacheFile(std::unique_ptr< Storage > base, const std::string &tmpdir="")
void resize(IOOffset size) override
std::vector< char > present_