CMS 3D CMS Logo

StorageAccountProxy.cc
Go to the documentation of this file.
2 
3 StorageAccountProxy::StorageAccountProxy(const std::string &storageClass, std::unique_ptr<Storage> baseStorage)
4  : m_baseStorage(std::move(baseStorage)),
5  m_token(StorageAccount::tokenForStorageClassName(storageClass)),
6  m_statsRead(StorageAccount::counter(m_token, StorageAccount::Operation::read)),
7  m_statsReadV(StorageAccount::counter(m_token, StorageAccount::Operation::readv)),
8  m_statsWrite(StorageAccount::counter(m_token, StorageAccount::Operation::write)),
9  m_statsWriteV(StorageAccount::counter(m_token, StorageAccount::Operation::writev)),
10  m_statsPosition(StorageAccount::counter(m_token, StorageAccount::Operation::position)),
11  m_statsPrefetch(StorageAccount::counter(m_token, StorageAccount::Operation::prefetch)) {
13  stats.tick();
14 }
15 
19  stats.tick();
20 }
21 
24  IOSize result = m_baseStorage->read(into, n);
25  stats.tick(result);
26  return result;
27 }
28 
31  IOSize result = m_baseStorage->read(into, n, pos);
32  stats.tick(result);
33  return result;
34 }
35 
38  IOSize result = m_baseStorage->readv(into, n);
39  stats.tick(result, n);
40  return result;
41 }
42 
45  IOSize result = m_baseStorage->readv(into, n);
46  stats.tick(result, n);
47  return result;
48 }
49 
52  IOSize result = m_baseStorage->write(from, n);
53  stats.tick(result);
54  return result;
55 }
56 
59  IOSize result = m_baseStorage->write(from, n, pos);
60  stats.tick(result);
61  return result;
62 }
63 
66  IOSize result = m_baseStorage->writev(from, n);
67  stats.tick(result, n);
68  return result;
69 }
70 
73  IOSize result = m_baseStorage->writev(from, n);
74  stats.tick(result, n);
75  return result;
76 }
77 
80  IOOffset result = m_baseStorage->position(offset, whence);
81  stats.tick();
82  return result;
83 }
84 
87  m_baseStorage->resize(size);
88  stats.tick();
89 }
90 
93  m_baseStorage->flush();
94  stats.tick();
95 }
96 
99  m_baseStorage->close();
100  stats.tick();
101 }
102 
105  bool value = m_baseStorage->prefetch(what, n);
106  if (value) {
107  IOSize total = 0;
108  for (IOSize i = 0; i < n; ++i)
109  total += what[i].size();
110  stats.tick(total);
111  }
112  return value;
113 }
IOSize readv(IOBuffer *into, IOSize n) override
IOSize writev(const IOBuffer *from, IOSize n) override
void close(void) override
StorageAccount::Counter & m_statsWrite
StorageAccount::Counter & m_statsPosition
Relative
Definition: Storage.h:22
StorageAccount::Counter & m_statsRead
StorageAccount::StorageClassToken m_token
~StorageAccountProxy(void) override
StorageAccount::Counter & m_statsWriteV
StorageAccount::Counter & m_statsPrefetch
virtual IOOffset position(void) const
Definition: Storage.cc:72
IOSize write(const void *from, IOSize n) override
Definition: value.py:1
int read(void)
Definition: IOInput.cc:52
bool prefetch(const IOPosBuffer *what, IOSize n) override
static Counter & counter(StorageClassToken token, Operation operation)
virtual IOOffset size(void) const
Definition: Storage.cc:77
int64_t IOOffset
Definition: IOTypes.h:19
void tick(uint64_t amount=0, int64_t tick=0) const
edm::propagate_const< std::unique_ptr< Storage > > m_baseStorage
static int position[264][3]
Definition: ReadPGInfo.cc:289
void resize(IOOffset size) override
size_t IOSize
Definition: IOTypes.h:14
StorageAccount::Counter & m_statsReadV
void flush(void) override
StorageAccountProxy(const std::string &storageClass, std::unique_ptr< Storage > baseStorage)
def move(src, dest)
Definition: eostools.py:511