CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StorageAccountProxy.cc
Go to the documentation of this file.
2 
4  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))
13 {
15  stats.tick ();
16 }
17 
19 {
21  m_baseStorage.release();
22  stats.tick ();
23 }
24 
25 IOSize
27 {
29  IOSize result = m_baseStorage->read (into, n);
30  stats.tick (result);
31  return result;
32 }
33 
34 IOSize
36 {
38  IOSize result = m_baseStorage->read (into, n, pos);
39  stats.tick (result);
40  return result;
41 }
42 
43 IOSize
45 {
47  IOSize result = m_baseStorage->readv (into, n);
48  stats.tick (result, n);
49  return result;
50 }
51 
52 IOSize
54 {
56  IOSize result = m_baseStorage->readv (into, n);
57  stats.tick (result, n);
58  return result;
59 }
60 
61 IOSize
62 StorageAccountProxy::write (const void *from, IOSize n)
63 {
65  IOSize result = m_baseStorage->write (from, n);
66  stats.tick (result);
67  return result;
68 }
69 
70 IOSize
71 StorageAccountProxy::write (const void *from, IOSize n, IOOffset pos)
72 {
74  IOSize result = m_baseStorage->write (from, n, pos);
75  stats.tick (result);
76  return result;
77 }
78 
79 IOSize
81 {
83  IOSize result = m_baseStorage->writev (from, n);
84  stats.tick (result, n);
85  return result;
86 }
87 
88 IOSize
90 {
92  IOSize result = m_baseStorage->writev (from, n);
93  stats.tick (result, n);
94  return result;
95 }
96 
99 {
101  IOOffset result = m_baseStorage->position (offset, whence);
102  stats.tick ();
103  return result;
104 }
105 
106 void
108 {
110  m_baseStorage->resize (size);
111  stats.tick ();
112 }
113 
114 void
116 {
118  m_baseStorage->flush ();
119  stats.tick ();
120 }
121 
122 void
124 {
126  m_baseStorage->close ();
127  stats.tick ();
128 }
129 
130 bool
132 {
134  bool value = m_baseStorage->prefetch(what, n);
135  if (value)
136  {
137  IOSize total = 0;
138  for (IOSize i = 0; i < n; ++i)
139  total += what[i].size();
140  stats.tick (total);
141  }
142  return value;
143 }
virtual IOSize writev(const IOBuffer *from, IOSize n)
int i
Definition: DBlmapReader.cc:9
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
StorageAccount::Counter & m_statsWrite
StorageAccount::Counter & m_statsPosition
virtual void close(void)
std::unique_ptr< Storage > m_baseStorage
Relative
Definition: Storage.h:23
StorageAccount::Counter & m_statsRead
StorageAccount::StorageClassToken m_token
virtual IOSize readv(IOBuffer *into, IOSize n)
StorageAccount::Counter & m_statsWriteV
StorageAccount::Counter & m_statsPrefetch
virtual IOOffset position(void) const
Definition: Storage.cc:95
tuple result
Definition: query.py:137
def move
Definition: eostools.py:510
virtual IOSize write(const void *from, IOSize n)
int read(void)
Definition: IOInput.cc:54
virtual void resize(IOOffset size)
static Counter & counter(StorageClassToken token, Operation operation)
virtual void flush(void)
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
void tick(uint64_t amount=0, int64_t tick=0) const
static std::atomic< unsigned int > counter
static int position[264][3]
Definition: ReadPGInfo.cc:509
size_t IOSize
Definition: IOTypes.h:14
StorageAccount::Counter & m_statsReadV
StorageAccountProxy(const std::string &storageClass, std::unique_ptr< Storage > baseStorage)
tuple size
Write out results.