File indexing completed on 2024-04-06 12:31:52
0001 #ifndef STORAGE_FACTORY_STORAGE_ACCOUNT_PROXY_H
0002 #define STORAGE_FACTORY_STORAGE_ACCOUNT_PROXY_H
0003
0004 #include "Utilities/StorageFactory/interface/StorageAccount.h"
0005 #include "Utilities/StorageFactory/interface/Storage.h"
0006 #include "FWCore/Utilities/interface/get_underlying_safe.h"
0007 #include <string>
0008 #include <memory>
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 namespace edm::storage {
0019 class StorageAccountProxy : public Storage {
0020 public:
0021 StorageAccountProxy(const std::string &storageClass, std::unique_ptr<Storage> baseStorage);
0022 ~StorageAccountProxy(void) override;
0023
0024 using Storage::read;
0025 using Storage::write;
0026
0027 bool prefetch(const IOPosBuffer *what, IOSize n) override;
0028 IOSize read(void *into, IOSize n) override;
0029 IOSize read(void *into, IOSize n, IOOffset pos) override;
0030 IOSize readv(IOBuffer *into, IOSize n) override;
0031 IOSize readv(IOPosBuffer *into, IOSize n) override;
0032 IOSize write(const void *from, IOSize n) override;
0033 IOSize write(const void *from, IOSize n, IOOffset pos) override;
0034 IOSize writev(const IOBuffer *from, IOSize n) override;
0035 IOSize writev(const IOPosBuffer *from, IOSize n) override;
0036
0037 IOOffset position(IOOffset offset, Relative whence = SET) override;
0038 void resize(IOOffset size) override;
0039 void flush(void) override;
0040 void close(void) override;
0041
0042 protected:
0043 void releaseStorage() { get_underlying_safe(m_baseStorage).release(); }
0044
0045 edm::propagate_const<std::unique_ptr<Storage>> m_baseStorage;
0046
0047 StorageAccount::StorageClassToken m_token;
0048 StorageAccount::Counter &m_statsRead;
0049 StorageAccount::Counter &m_statsReadV;
0050 StorageAccount::Counter &m_statsWrite;
0051 StorageAccount::Counter &m_statsWriteV;
0052 StorageAccount::Counter &m_statsPosition;
0053 StorageAccount::Counter &m_statsPrefetch;
0054 };
0055 }
0056 #endif