Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:27

0001 #ifndef CondCore_CondDB_IDbSchema_h
0002 #define CondCore_CondDB_IDbSchema_h
0003 
0004 //
0005 #include <boost/date_time/posix_time/posix_time.hpp>
0006 
0007 #include "CondFormats/Common/interface/Time.h"
0008 #include "CondCore/CondDB/interface/Types.h"
0009 #include "CondCore/CondDB/interface/Binary.h"
0010 
0011 namespace cond {
0012 
0013   namespace persistency {
0014 
0015     class ITagTable {
0016     public:
0017       virtual ~ITagTable() {}
0018       virtual bool exists() = 0;
0019       virtual void create() = 0;
0020       virtual bool select(const std::string& name) = 0;
0021       virtual bool select(const std::string& name,
0022                           cond::TimeType& timeType,
0023                           std::string& objectType,
0024                           cond::SynchronizationType& synchronizationType,
0025                           cond::Time_t& endOfValidity,
0026                           cond::Time_t& lastValidatedTime,
0027                           int& protectionCode) = 0;
0028       virtual bool getMetadata(const std::string& name,
0029                                std::string& description,
0030                                boost::posix_time::ptime& insertionTime,
0031                                boost::posix_time::ptime& modificationTime) = 0;
0032       virtual void insert(const std::string& name,
0033                           cond::TimeType timeType,
0034                           const std::string& objectType,
0035                           cond::SynchronizationType synchronizationType,
0036                           cond::Time_t endOfValidity,
0037                           const std::string& description,
0038                           cond::Time_t lastValidatedTime,
0039                           const boost::posix_time::ptime& insertionTime) = 0;
0040       virtual void update(const std::string& name,
0041                           cond::SynchronizationType synchronizationType,
0042                           cond::Time_t& endOfValidity,
0043                           cond::Time_t lastValidatedTime,
0044                           const boost::posix_time::ptime& updateTime) = 0;
0045       virtual void updateMetadata(const std::string& name,
0046                                   const std::string& description,
0047                                   const boost::posix_time::ptime& updateTime) = 0;
0048       virtual void updateValidity(const std::string& name,
0049                                   cond::Time_t lastValidatedTime,
0050                                   const boost::posix_time::ptime& updateTime) = 0;
0051       virtual void setProtectionCode(const std::string& name, int code) = 0;
0052       virtual void unsetProtectionCode(const std::string& name, int code) = 0;
0053     };
0054 
0055     class IPayloadTable {
0056     public:
0057       virtual ~IPayloadTable() {}
0058       virtual bool exists() = 0;
0059       virtual void create() = 0;
0060       virtual bool select(const cond::Hash& payloadHash,
0061                           std::string& objectType,
0062                           cond::Binary& payloadData,
0063                           cond::Binary& streamerInfoData) = 0;
0064       virtual bool getType(const cond::Hash& payloadHash, std::string& objectType) = 0;
0065       virtual cond::Hash insertIfNew(const std::string& objectType,
0066                                      const cond::Binary& payloadData,
0067                                      const cond::Binary& streamerInfoData,
0068                                      const boost::posix_time::ptime& insertionTime) = 0;
0069     };
0070 
0071     class IIOVTable {
0072     public:
0073       virtual ~IIOVTable() {}
0074       virtual bool exists() = 0;
0075       virtual void create() = 0;
0076       virtual size_t getGroups(const std::string& tag,
0077                                const boost::posix_time::ptime& snapshotTime,
0078                                unsigned long long groupSize,
0079                                std::vector<cond::Time_t>& groups) = 0;
0080       virtual size_t select(const std::string& tag,
0081                             cond::Time_t lowerGroup,
0082                             cond::Time_t upperGroup,
0083                             const boost::posix_time::ptime& snapshotTime,
0084                             std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) = 0;
0085       virtual bool getLastIov(const std::string& tag,
0086                               const boost::posix_time::ptime& snapshotTime,
0087                               cond::Time_t& since,
0088                               cond::Hash& hash) = 0;
0089       virtual bool getSize(const std::string& tag, const boost::posix_time::ptime& snapshotTime, size_t& size) = 0;
0090       virtual bool getRange(const std::string& tag,
0091                             cond::Time_t begin,
0092                             cond::Time_t end,
0093                             const boost::posix_time::ptime& snapshotTime,
0094                             std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) = 0;
0095       virtual void insertOne(const std::string& tag,
0096                              cond::Time_t since,
0097                              cond::Hash payloadHash,
0098                              const boost::posix_time::ptime& insertTime) = 0;
0099       virtual void insertMany(
0100           const std::string& tag,
0101           const std::vector<std::tuple<cond::Time_t, cond::Hash, boost::posix_time::ptime> >& iovs) = 0;
0102       virtual void eraseOne(const std::string& tag, cond::Time_t since, cond::Hash payloadId) = 0;
0103       virtual void eraseMany(const std::string& tag,
0104                              const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs) = 0;
0105       virtual void erase(const std::string& tag) = 0;
0106     };
0107 
0108     class ITagAccessPermissionTable {
0109     public:
0110       virtual ~ITagAccessPermissionTable() {}
0111       virtual bool exists() = 0;
0112       virtual void create() = 0;
0113       virtual bool getAccessPermission(const std::string& tagName,
0114                                        const std::string& credential,
0115                                        int credentialType,
0116                                        int accessType) = 0;
0117       virtual void setAccessPermission(const std::string& tagName,
0118                                        const std::string& credential,
0119                                        int credentialType,
0120                                        int accessType) = 0;
0121       virtual void removeAccessPermission(const std::string& tagName,
0122                                           const std::string& credential,
0123                                           int credentialType) = 0;
0124       virtual void removeEntriesForCredential(const std::string& credential, int credentialType) = 0;
0125     };
0126 
0127     class ITagLogTable {
0128     public:
0129       virtual ~ITagLogTable() {}
0130       virtual bool exists() = 0;
0131       virtual void create() = 0;
0132       virtual void insert(const std::string& tag,
0133                           const boost::posix_time::ptime& eventTime,
0134                           const std::string& userName,
0135                           const std::string& hostName,
0136                           const std::string& command,
0137                           const std::string& action,
0138                           const std::string& userText) = 0;
0139     };
0140 
0141     class IIOVSchema {
0142     public:
0143       virtual ~IIOVSchema() {}
0144       virtual bool exists() = 0;
0145       virtual bool create() = 0;
0146       virtual ITagTable& tagTable() = 0;
0147       virtual IIOVTable& iovTable() = 0;
0148       virtual IPayloadTable& payloadTable() = 0;
0149       virtual ITagLogTable& tagLogTable() = 0;
0150       virtual ITagAccessPermissionTable& tagAccessPermissionTable() = 0;
0151     };
0152 
0153     class IGTTable {
0154     public:
0155       virtual ~IGTTable() {}
0156       virtual bool exists() = 0;
0157       virtual void create() = 0;
0158       virtual bool select(const std::string& name) = 0;
0159       virtual bool select(const std::string& name, cond::Time_t& validity, boost::posix_time::ptime& snapshotTime) = 0;
0160       virtual bool select(const std::string& name,
0161                           cond::Time_t& validity,
0162                           std::string& description,
0163                           std::string& release,
0164                           boost::posix_time::ptime& snapshotTime) = 0;
0165       virtual void insert(const std::string& name,
0166                           cond::Time_t validity,
0167                           const std::string& description,
0168                           const std::string& release,
0169                           const boost::posix_time::ptime& snapshotTime,
0170                           const boost::posix_time::ptime& insertionTime) = 0;
0171       virtual void update(const std::string& name,
0172                           cond::Time_t validity,
0173                           const std::string& description,
0174                           const std::string& release,
0175                           const boost::posix_time::ptime& snapshotTime,
0176                           const boost::posix_time::ptime& insertionTime) = 0;
0177     };
0178 
0179     class IGTMapTable {
0180     public:
0181       virtual ~IGTMapTable() {}
0182       virtual bool exists() = 0;
0183       virtual void create() = 0;
0184       virtual bool select(const std::string& gtName,
0185                           std::vector<std::tuple<std::string, std::string, std::string> >& tags) = 0;
0186       virtual bool select(const std::string& gtName,
0187                           const std::string& preFix,
0188                           const std::string& postFix,
0189                           std::vector<std::tuple<std::string, std::string, std::string> >& tags) = 0;
0190       virtual void insert(const std::string& gtName,
0191                           const std::vector<std::tuple<std::string, std::string, std::string> >& tags) = 0;
0192     };
0193 
0194     class IGTSchema {
0195     public:
0196       virtual ~IGTSchema() {}
0197       virtual bool exists() = 0;
0198       virtual void create() = 0;
0199       virtual IGTTable& gtTable() = 0;
0200       virtual IGTMapTable& gtMapTable() = 0;
0201     };
0202 
0203     class IRunInfoTable {
0204     public:
0205       virtual ~IRunInfoTable() {}
0206       virtual bool exists() = 0;
0207       virtual void create() = 0;
0208       virtual bool select(cond::Time_t runNumber, boost::posix_time::ptime& start, boost::posix_time::ptime& end) = 0;
0209       virtual cond::Time_t getLastInserted(boost::posix_time::ptime& start, boost::posix_time::ptime& end) = 0;
0210       virtual bool getInclusiveRunRange(
0211           cond::Time_t lower,
0212           cond::Time_t upper,
0213           std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >& runData) = 0;
0214       virtual bool getInclusiveTimeRange(
0215           const boost::posix_time::ptime& lower,
0216           const boost::posix_time::ptime& upper,
0217           std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >& runData) = 0;
0218       virtual void insertOne(cond::Time_t runNumber,
0219                              const boost::posix_time::ptime& start,
0220                              const boost::posix_time::ptime& end) = 0;
0221       virtual void insert(
0222           const std::vector<std::tuple<cond::Time_t, boost::posix_time::ptime, boost::posix_time::ptime> >& runs) = 0;
0223       virtual void updateEnd(cond::Time_t runNumber, const boost::posix_time::ptime& end) = 0;
0224     };
0225 
0226     class IRunInfoSchema {
0227     public:
0228       virtual ~IRunInfoSchema() {}
0229       virtual bool exists() = 0;
0230       virtual bool create() = 0;
0231       virtual IRunInfoTable& runInfoTable() = 0;
0232     };
0233 
0234   }  // namespace persistency
0235 }  // namespace cond
0236 #endif