CMS 3D CMS Logo

StorageAccountProxy.cc
Go to the documentation of this file.
2 using namespace edm::storage;
3 
4 StorageAccountProxy::StorageAccountProxy(const std::string &storageClass, std::unique_ptr<Storage> baseStorage)
5  : m_baseStorage(std::move(baseStorage)),
6  m_token(StorageAccount::tokenForStorageClassName(storageClass)),
7  m_statsRead(StorageAccount::counter(m_token, StorageAccount::Operation::read)),
8  m_statsReadV(StorageAccount::counter(m_token, StorageAccount::Operation::readv)),
9  m_statsWrite(StorageAccount::counter(m_token, StorageAccount::Operation::write)),
10  m_statsWriteV(StorageAccount::counter(m_token, StorageAccount::Operation::writev)),
11  m_statsPosition(StorageAccount::counter(m_token, StorageAccount::Operation::position)),
12  m_statsPrefetch(StorageAccount::counter(m_token, StorageAccount::Operation::prefetch)) {
14  stats.tick();
15 }
16 
20  stats.tick();
21 }
22 
25  IOSize result = m_baseStorage->read(into, n);
26  stats.tick(result);
27  return result;
28 }
29 
32  IOSize result = m_baseStorage->read(into, n, pos);
33  stats.tick(result);
34  return result;
35 }
36 
39  IOSize result = m_baseStorage->readv(into, n);
40  stats.tick(result, n);
41  return result;
42 }
43 
46  IOSize result = m_baseStorage->readv(into, n);
47  stats.tick(result, n);
48  return result;
49 }
50 
53  IOSize result = m_baseStorage->write(from, n);
54  stats.tick(result);
55  return result;
56 }
57 
60  IOSize result = m_baseStorage->write(from, n, pos);
61  stats.tick(result);
62  return result;
63 }
64 
67  IOSize result = m_baseStorage->writev(from, n);
68  stats.tick(result, n);
69  return result;
70 }
71 
74  IOSize result = m_baseStorage->writev(from, n);
75  stats.tick(result, n);
76  return result;
77 }
78 
81  IOOffset result = m_baseStorage->position(offset, whence);
82  stats.tick();
83  return result;
84 }
85 
88  m_baseStorage->resize(size);
89  stats.tick();
90 }
91 
94  m_baseStorage->flush();
95  stats.tick();
96 }
97 
100  m_baseStorage->close();
101  stats.tick();
102 }
103 
106  bool value = m_baseStorage->prefetch(what, n);
107  if (value) {
108  IOSize total = 0;
109  for (IOSize i = 0; i < n; ++i)
110  total += what[i].size();
111  stats.tick(total);
112  }
113  return value;
114 }
size
Write out results.
int64_t IOOffset
Definition: IOTypes.h:20
StorageAccountProxy(const std::string &storageClass, std::unique_ptr< Storage > baseStorage)
bool prefetch(const IOPosBuffer *what, IOSize n) override
static Counter & counter(StorageClassToken token, Operation operation)
StorageAccount::Counter & m_statsPrefetch
IOSize write(const void *from, IOSize n) override
StorageAccount::Counter & m_statsReadV
StorageAccount::StorageClassToken m_token
void resize(IOOffset size) override
virtual IOOffset size() const
Definition: Storage.cc:509
StorageAccount::Counter & m_statsWrite
IOSize readv(IOBuffer *into, IOSize n) override
Definition: value.py:1
StorageAccount::Counter & m_statsPosition
size_t IOSize
Definition: IOTypes.h:15
static int position[264][3]
Definition: ReadPGInfo.cc:289
virtual IOOffset position() const
Definition: Storage.cc:504
IOSize writev(const IOBuffer *from, IOSize n) override
edm::propagate_const< std::unique_ptr< Storage > > m_baseStorage
StorageAccount::Counter & m_statsRead
def move(src, dest)
Definition: eostools.py:511
StorageAccount::Counter & m_statsWriteV