CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
cond Namespace Reference

Namespaces

 auth
 
 payloadInspector
 
 persistency
 
 RelationalAuthenticationService
 
 serialization
 
 service
 
 time
 
 XMLAuthenticationService
 

Classes

struct  AuthorizationData
 
class  BaseKeyed
 
class  BasicPayload
 
class  Binary
 
class  BTransitionAnalyzer
 
class  CoralServiceFactory
 
class  CoralServiceManager
 
struct  CoralServiceWrapper
 
struct  CoralServiceWrapperBase
 
struct  CredentialData
 
class  CredentialStore
 
class  CSScopedSession
 
class  DataProxyWrapperBase
 
struct  DefaultInitializer
 
class  EmptyIOVSource
 
class  FileBasedEmptySource
 
class  FileReader
 
class  GenericSummary
 
class  GTEntry_t
 
struct  GTMetadata_t
 
struct  Iov_t
 
class  IOVDescription
 
class  IOVKeysDescription
 
class  IOVProvenance
 
class  IOVUserMetaData
 
class  KeyedElement
 
struct  LessFrame
 
struct  LogDBEntry_t
 
struct  PrincipalData
 
struct  RealTimeType
 
struct  RealTimeType< hash >
 
struct  RealTimeType< lumiid >
 
struct  RealTimeType< runnumber >
 
struct  RealTimeType< timestamp >
 
struct  RealTimeType< userid >
 
struct  RunInfo_t
 
class  SmallWORMDict
 
class  StreamerInfo
 
class  Summary
 
struct  Tag_t
 
struct  TagInfo_t
 
struct  TagMetadata_t
 
struct  TimeTypeSpecs
 
struct  TimeTypeTraits
 
class  UnregisteredRecordException
 
struct  UserLogInfo
 
class  Utilities
 
class  UtilitiesError
 

Typedefs

typedef cond::serialization::InputArchive CondInputArchive
 
typedef cond::serialization::OutputArchive CondOutputArchive
 
typedef edmplugin::PluginFactory< cond::CoralServiceWrapperBase *()> CoralServicePluginFactory
 
typedef persistency::Exception Exception
 
typedef std::string Hash
 
typedef edmplugin::PluginFactory< cond::DataProxyWrapperBase *()> ProxyFactory
 
typedef unsigned long long Time_t
 
typedef unsigned long long uint64_t
 
typedef std::pair< unsigned int, unsigned int > UnpackedTime
 
typedef std::pair< Time_t, Time_tValidityInterval
 

Enumerations

enum  SynchronizationType {
  SYNCH_ANY = 0, SYNCH_VALIDATION, SYNCH_OFFLINE, SYNCH_MC,
  SYNCH_RUNMC, SYNCH_HLT, SYNCH_EXPRESS, SYNCH_PROMPT,
  SYNCH_PCL
}
 
enum  TimeType {
  invalid = -1, runnumber = 0, timestamp, lumiid,
  hash, userid
}
 

Functions

template<typename T >
TcreatePayload (const std::string &payloadTypeName)
 
template<>
HcalCalibrationQIEDatacreatePayload< HcalCalibrationQIEData > (const std::string &payloadTypeName)
 
template<>
std::string * createPayload< std::string > (const std::string &payloadTypeName)
 
template<typename T >
std::unique_ptr< Tdefault_deserialize (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<typename T >
std::unique_ptr< Tdeserialize (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< BaseKeyeddeserialize< BaseKeyed > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< condex::Efficiencydeserialize< condex::Efficiency > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< CSCReadoutMappingdeserialize< CSCReadoutMapping > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< CSCReadoutMappingForSliceTestdeserialize< CSCReadoutMappingForSliceTest > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< PerformancePayloaddeserialize< PerformancePayload > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
const TimeTypeSpecsfindSpecs (std::string const &name)
 
int getch ()
 
cond::Time_t getLatestLumiFromFile (const std::string &fileName)
 
std::string getLoginName ()
 
bool getNextSequenceValue (coral::ISchema &schema, const std::string &sequenceName, int &value)
 
std::string getpass (const std::string &prompt, bool show_asterisk=true)
 
std::string getpassForUser (const std::string &userName)
 
unsigned long long hash64 (unsigned char *k, unsigned long long length, unsigned long long level)
 
const Time_t invalidTime (0)
 
const std::string invalidToken (" ")
 
Iov_t makeIov (cond::Time_t since, const Hash &payloadId)
 
void parseLineForNamedParams (const std::string &line, std::map< std::string, std::string > &params)
 
const char * pluginCategory ()
 
char randomChar ()
 
std::string schemaLabel (const std::string &serviceName, const std::string &userName)
 
std::string schemaLabelForCredentialStore (const std::string &connectionString)
 
bool selectAuthorization (coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString, AuthorizationData &destination)
 
bool selectConnection (coral::ISchema &schema, const std::string &connectionLabel, CredentialData &destination)
 
bool selectPrincipal (coral::ISchema &schema, const std::string &principal, PrincipalData &destination)
 
template<typename T >
std::pair< Binary, Binaryserialize (const T &payload)
 
bool setPermissionData (coral::ISchema &schema, int principalId, const std::string &principalKey, const std::string &role, const std::string &connectionString, int connectionId, const std::string &connectionKey)
 
SynchronizationType synchronizationTypeFromName (const std::string &name)
 
std::string synchronizationTypeNames (SynchronizationType type)
 
void throwException (const std::string &message, const std::string &methodName)
 
const Time_t TIMELIMIT (std::numeric_limits< Time_t >::max())
 
std::string const & timeTypeNames (int)
 
std::pair< int, std::string > updateConnectionData (coral::ISchema &schema, const std::string &adminKey, const std::string &connectionLabel, const std::string &userName, const std::string &password, bool forceUpdate)
 
std::pair< int, std::string > updatePrincipalData (coral::ISchema &schema, const std::string &authenticationKey, const std::string &principalName, const std::string &adminKey, bool init=false)
 

Variables

static constexpr unsigned int HASH_SIZE = 40
 
static std::pair< const char *, SynchronizationTypes_obsoleteSynchronizationTypeArray []
 
static std::pair< const char *, SynchronizationTypes_synchronizationTypeArray []
 
const unsigned int TIMETYPE_LIST_MAX = 5
 
const cond::TimeType timeTypeList [TIMETYPE_LIST_MAX] = {runnumber, timestamp, lumiid, hash, userid}
 
const TimeTypeSpecs timeTypeSpecs []
 
const cond::TimeType timeTypeValues [] = {runnumber, timestamp, lumiid, hash, userid}
 

Detailed Description

The wrapper is used to allow edm::PluginFactory to change its return type to unique_ptr from a raw pointer. The unique_ptr does not work for coral::Service, because its destructor is protected and ownership is managed by intrusive reference counting.

Serialization.h CondCore/CondDB/interface/Serialization.h Description: functions for serializing the payload objects.

Typedef Documentation

◆ CondInputArchive

Definition at line 61 of file Serialization.h.

◆ CondOutputArchive

Definition at line 62 of file Serialization.h.

◆ CoralServicePluginFactory

Definition at line 25 of file CoralServiceFactory.h.

◆ Exception

Definition at line 25 of file Exception.h.

◆ Hash

typedef std::string cond::Hash

Definition at line 43 of file Types.h.

◆ ProxyFactory

Definition at line 29 of file ProxyFactory.h.

◆ Time_t

typedef unsigned long long cond::Time_t

Definition at line 14 of file Time.h.

◆ uint64_t

typedef unsigned long long cond::uint64_t

Definition at line 13 of file Time.h.

◆ UnpackedTime

typedef std::pair<unsigned int, unsigned int> cond::UnpackedTime

Definition at line 15 of file Time.h.

◆ ValidityInterval

typedef std::pair<Time_t, Time_t> cond::ValidityInterval

Definition at line 17 of file Time.h.

Enumeration Type Documentation

◆ SynchronizationType

Enumerator
SYNCH_ANY 
SYNCH_VALIDATION 
SYNCH_OFFLINE 
SYNCH_MC 
SYNCH_RUNMC 
SYNCH_HLT 
SYNCH_EXPRESS 
SYNCH_PROMPT 
SYNCH_PCL 

Definition at line 27 of file Types.h.

27  {
28  SYNCH_ANY = 0,
31  SYNCH_MC,
33  SYNCH_HLT,
36  SYNCH_PCL

◆ TimeType

Enumerator
invalid 
runnumber 
timestamp 
lumiid 
hash 
userid 

Definition at line 19 of file Time.h.

Function Documentation

◆ createPayload()

template<typename T >
T* cond::createPayload ( const std::string &  payloadTypeName)

Definition at line 31 of file Serialization.h.

31  {
32  std::string userTypeName = demangledName(typeid(T));
33  if (userTypeName != payloadTypeName)
35  std::string("Type mismatch, user type: \"" + userTypeName + "\", target type: \"") + payloadTypeName + "\"",
36  "createPayload");
37  return new T;
38  }

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ createPayload< HcalCalibrationQIEData >()

template<>
HcalCalibrationQIEData* cond::createPayload< HcalCalibrationQIEData > ( const std::string &  payloadTypeName)

Definition at line 37 of file plugin.cc.

37  {
38  if (payloadTypeName == "HcalCalibrationQIEData")
39  return new HcalCalibrationQIEData(nullptr);
40  throwException(std::string("Type mismatch, target object is type \"") + payloadTypeName + "\"", "createPayload");
41  }

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ createPayload< std::string >()

template<>
std::string* cond::createPayload< std::string > ( const std::string &  payloadTypeName)
inline

Definition at line 41 of file Serialization.h.

41  {
42  std::string userTypeName = demangledName(typeid(std::string));
43  if (payloadTypeName != userTypeName && payloadTypeName != "std::string")
44  throwException(std::string("Type mismatch, user type: \"std::string\", target type: \"") + payloadTypeName + "\"",
45  "createPayload");
46  return new std::string;
47  }

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ default_deserialize()

template<typename T >
std::unique_ptr<T> cond::default_deserialize ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 86 of file Serialization.h.

88  {
89  std::unique_ptr<T> payload;
90  std::stringbuf sstreamerInfoBuf;
91  sstreamerInfoBuf.pubsetbuf(static_cast<char*>(const_cast<void*>(streamerInfoData.data())), streamerInfoData.size());
92  std::string streamerInfo = sstreamerInfoBuf.str();
93  try {
94  std::stringbuf sdataBuf;
95  sdataBuf.pubsetbuf(static_cast<char*>(const_cast<void*>(payloadData.data())), payloadData.size());
96  std::istream dataBuffer(&sdataBuf);
97  CondInputArchive ia(dataBuffer);
98  payload.reset(createPayload<T>(payloadType));
99  ia >> (*payload);
100  } catch (const std::exception& e) {
101  std::string errorMsg("De-serialization failed: ");
102  std::string em(e.what());
103  if (em == "unsupported version") {
104  errorMsg += "the current boost version (" + StreamerInfo::techVersion() +
105  ") is unable to read the payload. Data might have been serialized with an incompatible version.";
106  } else if (em == "input stream error") {
107  errorMsg += "data size does not fit with the current class layout. The Class " + payloadType +
108  " might have been changed with respect to the layout used in the upload.";
109  } else {
110  errorMsg += em;
111  }
112  if (!streamerInfo.empty())
113  errorMsg += " Payload serialization info: " + streamerInfo;
114  throwException(errorMsg, "default_deserialize");
115  }
116  return payload;
117  }

References cond::Binary::data(), MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, jets_cff::payload, HLT_2018_cff::payloadType, cond::Binary::size(), AlCaHLTBitMon_QueryRunRegistry::string, cond::StreamerInfo::techVersion(), and throwException().

◆ deserialize()

template<typename T >
std::unique_ptr<T> cond::deserialize ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 121 of file Serialization.h.

123  {
124  return default_deserialize<T>(payloadType, payloadData, streamerInfoData);
125  }

References HLT_2018_cff::payloadType.

◆ deserialize< BaseKeyed >()

template<>
std::unique_ptr< BaseKeyed > cond::deserialize< BaseKeyed > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 39 of file plugin.cc.

41  {
42  DESERIALIZE_BASE_CASE(BaseKeyed);
45 
46  // here we come if none of the deserializations above match the payload type:
47  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
48  }

References DESERIALIZE_BASE_CASE, DESERIALIZE_POLIMORPHIC_CASE, HLT_2018_cff::payloadType, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ deserialize< condex::Efficiency >()

template<>
std::unique_ptr<condex::Efficiency> cond::deserialize< condex::Efficiency > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 25 of file plugin.cc.

27  {
28  // DESERIALIZE_BASE_CASE( condex::Efficiency ); abstract
31 
32  // here we come if none of the deserializations above match the payload type:
33  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
34  }

References DESERIALIZE_POLIMORPHIC_CASE, HLT_2018_cff::payloadType, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ deserialize< CSCReadoutMapping >()

template<>
std::unique_ptr<CSCReadoutMapping> cond::deserialize< CSCReadoutMapping > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 65 of file plugin.cc.

67  {
68  // DESERIALIZE_BASE_CASE( CSCReadoutMapping ); abstract
70  // here we come if none of the deserializations above match the payload type:
71  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
72  }

References DESERIALIZE_POLIMORPHIC_CASE, HLT_2018_cff::payloadType, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ deserialize< CSCReadoutMappingForSliceTest >()

template<>
std::unique_ptr<CSCReadoutMappingForSliceTest> cond::deserialize< CSCReadoutMappingForSliceTest > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 74 of file plugin.cc.

75  {
76  // DESERIALIZE_BASE_CASE( CSCReadoutMappingForSliceTest ); abstract
78  // here we come if none of the deserializations above match the payload type:
79  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
80  }

References DESERIALIZE_POLIMORPHIC_CASE, HLT_2018_cff::payloadType, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ deserialize< PerformancePayload >()

template<>
std::unique_ptr<PerformancePayload> cond::deserialize< PerformancePayload > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 18 of file PerformanceRecordPlugin.cc.

20  {
21  // DESERIALIZE_BASE_CASE( PerformancePayload ); abstract
25  // here we come if none of the deserializations above match the payload type:
26  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "createPayload");
27  }

References DESERIALIZE_POLIMORPHIC_CASE, HLT_2018_cff::payloadType, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

◆ findSpecs()

const TimeTypeSpecs & cond::findSpecs ( std::string const &  name)

Definition at line 23 of file Time.cc.

23  {
24  size_t i = 0;
25  for (; i < TIMETYPE_LIST_MAX; i++)
26  if (name == timeTypeSpecs[i].name)
27  return timeTypeSpecs[i];
28  throw cms::Exception("invalid timetype: " + name);
29  return timeTypeSpecs[0]; // compiler happy
30  }

References Exception, mps_fire::i, Skims_PA_cff::name, TIMETYPE_LIST_MAX, and timeTypeSpecs.

Referenced by cond::time::timeTypeFromName().

◆ getch()

int cond::getch ( )

Definition at line 19 of file Utilities.cc.

19  {
20  int ch;
21  struct termios t_old, t_new;
22 
23  tcgetattr(STDIN_FILENO, &t_old);
24  t_new = t_old;
25  t_new.c_lflag &= ~(ICANON | ECHO);
26  tcsetattr(STDIN_FILENO, TCSANOW, &t_new);
27 
28  ch = getchar();
29 
30  tcsetattr(STDIN_FILENO, TCSANOW, &t_old);
31  return ch;
32  }

Referenced by getpass().

◆ getLatestLumiFromFile()

cond::Time_t cond::getLatestLumiFromFile ( const std::string &  fileName)

Definition at line 24 of file OnlineDBOutputService.h.

24  {
25  cond::Time_t lastLumiProcessed = cond::time::MIN_VAL;
26  std::ifstream lastLumiFile(fileName);
27  if (lastLumiFile) {
28  lastLumiFile >> lastLumiProcessed;
29  }
30  return lastLumiProcessed;
31  }

References MillePedeFileConverter_cfg::fileName, beam_dqm_sourceclient-live_cfg::lastLumiFile, and cond::time::MIN_VAL().

Referenced by cond::service::OnlineDBOutputService::getLastLumiProcessed().

◆ getLoginName()

std::string cond::getLoginName ( )

Definition at line 41 of file DecodingKey.cc.

41  {
42  std::string loginName("");
43  struct passwd* userp = ::getpwuid(::getuid());
44  if (userp) {
45  char* uName = userp->pw_name;
46  if (uName) {
47  loginName += uName;
48  }
49  }
50  if (loginName.empty()) {
51  std::string msg("Cannot determine login name.");
52  throwException(msg, "DecodingKey::getLoginName");
53  }
54  return loginName;
55  }

References mps_check::msg, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by cond::auth::DecodingKey::init().

◆ getNextSequenceValue()

bool cond::getNextSequenceValue ( coral::ISchema &  schema,
const std::string &  sequenceName,
int &  value 
)

Definition at line 308 of file CredentialStore.cc.

308  {
309  bool ret = false;
310  std::unique_ptr<coral::IQuery> query(schema.tableHandle(SEQUENCE_TABLE_NAME).newQuery());
311  query->limitReturnedRows(1, 0);
312  query->addToOutputList(SEQUENCE_VALUE_COL);
313  query->defineOutputType(SEQUENCE_VALUE_COL, coral::AttributeSpecification::typeNameForType<int>());
314  query->setForUpdate();
315  std::string whereClause(SEQUENCE_NAME_COL + " = :" + SEQUENCE_NAME_COL);
316  coral::AttributeList rowData;
317  rowData.extend<std::string>(SEQUENCE_NAME_COL);
318  rowData.begin()->data<std::string>() = sequenceName;
319  query->setCondition(whereClause, rowData);
320  coral::ICursor& cursor = query->execute();
321  if (cursor.next()) {
322  value = cursor.currentRow().begin()->data<int>() + 1;
323  ret = true;
324  } else {
325  return false;
326  }
327  // update...
328  coral::AttributeList updateData;
329  updateData.extend<std::string>(SEQUENCE_NAME_COL);
330  updateData.extend<int>(SEQUENCE_VALUE_COL);
331  std::string setClause(SEQUENCE_VALUE_COL + " = :" + SEQUENCE_VALUE_COL);
332  std::string whClause(SEQUENCE_NAME_COL + " = :" + SEQUENCE_NAME_COL);
333  coral::AttributeList::iterator iAttribute = updateData.begin();
334  iAttribute->data<std::string>() = sequenceName;
335  ++iAttribute;
336  iAttribute->data<int>() = value;
337  schema.tableHandle(SEQUENCE_TABLE_NAME).dataEditor().updateRows(setClause, whClause, updateData);
338  return ret;
339  }

References contentValuesFiles::query, runTheMatrix::ret, SEQUENCE_NAME_COL(), SEQUENCE_TABLE_NAME(), SEQUENCE_VALUE_COL(), TrackCollections2monitor_cff::sequenceName, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setPermissionData(), updateConnectionData(), and updatePrincipalData().

◆ getpass()

std::string cond::getpass ( const std::string &  prompt,
bool  show_asterisk = true 
)

Definition at line 34 of file Utilities.cc.

34  {
35  const char BACKSPACE = 127;
36  const char RETURN = 10;
37 
39  unsigned char ch = 0;
40 
41  std::cout << prompt;
42 
43  while ((ch = getch()) != RETURN) {
44  if (ch == BACKSPACE) {
45  if (password.length() != 0) {
46  if (show_asterisk)
47  std::cout << "\b \b";
48  password.resize(password.length() - 1);
49  }
50  } else {
51  password += ch;
52  if (show_asterisk)
53  std::cout << '*';
54  }
55  }
56  std::cout << std::endl;
57  return password;
58  }

References gather_cfg::cout, getch(), EcalCondDBWriter_cfi::password, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getpassForUser().

◆ getpassForUser()

std::string cond::getpassForUser ( const std::string &  userName)

Definition at line 60 of file Utilities.cc.

60  {
61  std::string prompt("Enter password for user ");
62  prompt += userName;
63  prompt += ": ";
64  return getpass(prompt, true);
65  }

References getpass(), AlCaHLTBitMon_QueryRunRegistry::string, and EcalCondDBWriter_cfi::userName.

◆ hash64()

ub8 cond::hash64 ( unsigned char *  k,
unsigned long long  length,
unsigned long long  level 
)

Definition at line 68 of file hash64.cc.

72  {
73  ub8 a, b, c, len;
74 
75  /* Set up the internal state */
76  len = length;
77  a = b = level; /* the previous hash value */
78  c = 0x9e3779b97f4a7c13LL; /* the golden ratio; an arbitrary value */
79 
80  /*---------------------------------------- handle most of the key */
81  if (((unsigned long)k) & 7) {
82  while (len >= 24) {
83  a += (k[0] + ((ub8)k[1] << 8) + ((ub8)k[2] << 16) + ((ub8)k[3] << 24) + ((ub8)k[4] << 32) + ((ub8)k[5] << 40) +
84  ((ub8)k[6] << 48) + ((ub8)k[7] << 56));
85  b += (k[8] + ((ub8)k[9] << 8) + ((ub8)k[10] << 16) + ((ub8)k[11] << 24) + ((ub8)k[12] << 32) +
86  ((ub8)k[13] << 40) + ((ub8)k[14] << 48) + ((ub8)k[15] << 56));
87  c += (k[16] + ((ub8)k[17] << 8) + ((ub8)k[18] << 16) + ((ub8)k[19] << 24) + ((ub8)k[20] << 32) +
88  ((ub8)k[21] << 40) + ((ub8)k[22] << 48) + ((ub8)k[23] << 56));
89  mix64(a, b, c);
90  k += 24;
91  len -= 24;
92  }
93  } else {
94  while (len >= 24) /* aligned */
95  {
96  a += *(ub8 *)(k + 0);
97  b += *(ub8 *)(k + 8);
98  c += *(ub8 *)(k + 16);
99  mix64(a, b, c);
100  k += 24;
101  len -= 24;
102  }
103  }
104 
105  /*------------------------------------- handle the last 23 bytes */
106  c += length;
107  switch (len) /* all the case statements fall through */
108  {
109  case 23:
110  c += ((ub8)k[22] << 56);
111  [[fallthrough]];
112  case 22:
113  c += ((ub8)k[21] << 48);
114  [[fallthrough]];
115  case 21:
116  c += ((ub8)k[20] << 40);
117  [[fallthrough]];
118  case 20:
119  c += ((ub8)k[19] << 32);
120  [[fallthrough]];
121  case 19:
122  c += ((ub8)k[18] << 24);
123  [[fallthrough]];
124  case 18:
125  c += ((ub8)k[17] << 16);
126  [[fallthrough]];
127  case 17:
128  c += ((ub8)k[16] << 8);
129  [[fallthrough]];
130  /* the first byte of c is reserved for the length */
131  case 16:
132  b += ((ub8)k[15] << 56);
133  [[fallthrough]];
134  case 15:
135  b += ((ub8)k[14] << 48);
136  [[fallthrough]];
137  case 14:
138  b += ((ub8)k[13] << 40);
139  [[fallthrough]];
140  case 13:
141  b += ((ub8)k[12] << 32);
142  [[fallthrough]];
143  case 12:
144  b += ((ub8)k[11] << 24);
145  [[fallthrough]];
146  case 11:
147  b += ((ub8)k[10] << 16);
148  [[fallthrough]];
149  case 10:
150  b += ((ub8)k[9] << 8);
151  [[fallthrough]];
152  case 9:
153  b += ((ub8)k[8]);
154  [[fallthrough]];
155  case 8:
156  a += ((ub8)k[7] << 56);
157  [[fallthrough]];
158  case 7:
159  a += ((ub8)k[6] << 48);
160  [[fallthrough]];
161  case 6:
162  a += ((ub8)k[5] << 40);
163  [[fallthrough]];
164  case 5:
165  a += ((ub8)k[4] << 32);
166  [[fallthrough]];
167  case 4:
168  a += ((ub8)k[3] << 24);
169  [[fallthrough]];
170  case 3:
171  a += ((ub8)k[2] << 16);
172  [[fallthrough]];
173  case 2:
174  a += ((ub8)k[1] << 8);
175  [[fallthrough]];
176  case 1:
177  a += ((ub8)k[0]);
178  /* case 0: nothing left to add */
179  }
180  mix64(a, b, c);
181  /*-------------------------------------------- report the result */
182  return c;
183  }

References a, b, HltBtagPostValidation_cff::c, dqmdumpme::k, personalPlayback::level, L1DTConfigBti_cff::LL, and mix64.

Referenced by cond::KeyedElement::convert().

◆ invalidTime()

const Time_t cond::invalidTime ( )

◆ invalidToken()

const std::string cond::invalidToken ( " "  )

◆ makeIov()

Iov_t cond::makeIov ( cond::Time_t  since,
const Hash payloadId 
)

Definition at line 20 of file CondDBPyWrappers.cc.

20  {
21  Iov_t ret;
22  ret.since = since;
23  ret.payloadId = payloadId;
24  return ret;
25  }

References runTheMatrix::ret, and writeEcalDQMStatus::since.

Referenced by BOOST_PYTHON_MODULE().

◆ parseLineForNamedParams()

void cond::parseLineForNamedParams ( const std::string &  line,
std::map< std::string, std::string > &  params 
)

Definition at line 57 of file DecodingKey.cc.

57  {
58  std::stringstream str(line);
59  std::string paramName("");
60  std::string paramValue("");
61  while (str.good()) {
62  std::string item("");
63  getline(str, item, ItemSeparator);
64  if (item.size() > 3) {
65  paramName = item.substr(0, 2);
66  paramValue = item.substr(2);
67  params.insert(std::make_pair(paramName, paramValue));
68  }
69  }
70  }

References B2GTnPMonitor_cfi::item, ItemSeparator, mps_splice::line, CalibrationSummaryClient_cfi::params, str, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by cond::auth::DecodingKey::createFromInputFile().

◆ pluginCategory()

const char * cond::pluginCategory ( )

Definition at line 64 of file ProxyFactory.cc.

64 { return "CondProxyFactory"; }

◆ randomChar()

char cond::randomChar ( )

Definition at line 36 of file DecodingKey.cc.

36  {
37  int irand = ::rand() % (::strlen(b64str));
38  return b64str[irand];
39  }

References b64str, and rand().

Referenced by cond::auth::KeyGenerator::make().

◆ schemaLabel()

std::string cond::schemaLabel ( const std::string &  serviceName,
const std::string &  userName 
)

◆ schemaLabelForCredentialStore()

std::string cond::schemaLabelForCredentialStore ( const std::string &  connectionString)

Definition at line 162 of file CredentialStore.cc.

162  {
163  coral::URIParser parser;
164  parser.setURI(connectionString);
165  std::string serviceName = parser.hostName();
166  std::string schemaName = parser.databaseOrSchemaName();
167  return schemaLabel(serviceName, schemaName);
168  }

References l1RCTOmdsFedVectorProducer_cfi::connectionString, writedatasetfile::parser, schemaLabel(), serviceName, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ selectAuthorization()

bool cond::selectAuthorization ( coral::ISchema &  schema,
int  principalId,
const std::string &  role,
const std::string &  connectionString,
AuthorizationData destination 
)

Definition at line 270 of file CredentialStore.cc.

274  {
275  std::unique_ptr<coral::IQuery> query(schema.tableHandle(COND_AUTHORIZATION_TABLE).newQuery());
276  coral::AttributeList readBuff;
277  readBuff.extend<int>(AUTH_ID_COL);
278  readBuff.extend<int>(C_ID_COL);
279  readBuff.extend<std::string>(AUTH_KEY_COL);
280  coral::AttributeList whereData;
281  whereData.extend<int>(P_ID_COL);
282  whereData.extend<std::string>(ROLE_COL);
283  whereData.extend<std::string>(SCHEMA_COL);
284  whereData[P_ID_COL].data<int>() = principalId;
285  whereData[ROLE_COL].data<std::string>() = role;
286  whereData[SCHEMA_COL].data<std::string>() = connectionString;
287  std::stringstream whereClause;
288  whereClause << P_ID_COL << " = :" << P_ID_COL;
289  whereClause << " AND " << ROLE_COL << " = :" << ROLE_COL;
290  whereClause << " AND " << SCHEMA_COL << " = :" << SCHEMA_COL;
291  query->defineOutput(readBuff);
292  query->addToOutputList(AUTH_ID_COL);
293  query->addToOutputList(C_ID_COL);
294  query->addToOutputList(AUTH_KEY_COL);
295  query->setCondition(whereClause.str(), whereData);
296  coral::ICursor& cursor = query->execute();
297  bool found = false;
298  if (cursor.next()) {
299  const coral::AttributeList& row = cursor.currentRow();
300  destination.id = row[AUTH_ID_COL].data<int>();
301  destination.connectionId = row[C_ID_COL].data<int>();
302  destination.key = row[AUTH_KEY_COL].data<std::string>();
303  found = true;
304  }
305  return found;
306  }

References AUTH_ID_COL(), AUTH_KEY_COL(), C_ID_COL(), COND_AUTHORIZATION_TABLE(), l1RCTOmdsFedVectorProducer_cfi::connectionString, HLTMuonOfflineAnalyzer_cff::destination, newFWLiteAna::found, P_ID_COL(), contentValuesFiles::query, ROLE_COL(), SCHEMA_COL(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setPermissionData().

◆ selectConnection()

bool cond::selectConnection ( coral::ISchema &  schema,
const std::string &  connectionLabel,
CredentialData destination 
)

Definition at line 230 of file CredentialStore.cc.

230  {
231  std::unique_ptr<coral::IQuery> query(schema.tableHandle(COND_CREDENTIAL_TABLE).newQuery());
232  coral::AttributeList readBuff;
233  readBuff.extend<int>(CONNECTION_ID_COL);
234  readBuff.extend<std::string>(USERNAME_COL);
235  readBuff.extend<std::string>(PASSWORD_COL);
236  readBuff.extend<std::string>(VERIFICATION_KEY_COL);
237  readBuff.extend<std::string>(CONNECTION_KEY_COL);
238  coral::AttributeList whereData;
239  whereData.extend<std::string>(CONNECTION_LABEL_COL);
240  whereData[CONNECTION_LABEL_COL].data<std::string>() = connectionLabel;
241  std::string whereClause = CONNECTION_LABEL_COL + " = :" + CONNECTION_LABEL_COL;
242  query->defineOutput(readBuff);
243  query->addToOutputList(CONNECTION_ID_COL);
244  query->addToOutputList(USERNAME_COL);
245  query->addToOutputList(PASSWORD_COL);
246  query->addToOutputList(VERIFICATION_KEY_COL);
247  query->addToOutputList(CONNECTION_KEY_COL);
248  query->setCondition(whereClause, whereData);
249  coral::ICursor& cursor = query->execute();
250  bool found = false;
251  if (cursor.next()) {
252  const coral::AttributeList& row = cursor.currentRow();
253  destination.id = row[CONNECTION_ID_COL].data<int>();
254  destination.userName = row[USERNAME_COL].data<std::string>();
255  destination.password = row[PASSWORD_COL].data<std::string>();
256  destination.verificationKey = row[VERIFICATION_KEY_COL].data<std::string>();
257  destination.connectionKey = row[CONNECTION_KEY_COL].data<std::string>();
258  found = true;
259  }
260  return found;
261  }

References COND_CREDENTIAL_TABLE(), CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), HLTMuonOfflineAnalyzer_cff::destination, newFWLiteAna::found, PASSWORD_COL(), contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, USERNAME_COL(), and VERIFICATION_KEY_COL().

Referenced by cond::CredentialStore::removeConnection(), cond::CredentialStore::setPermission(), updateConnectionData(), and cond::CredentialStore::updatePrincipal().

◆ selectPrincipal()

bool cond::selectPrincipal ( coral::ISchema &  schema,
const std::string &  principal,
PrincipalData destination 
)

Definition at line 191 of file CredentialStore.cc.

191  {
192  std::unique_ptr<coral::IQuery> query(schema.tableHandle(COND_AUTHENTICATION_TABLE).newQuery());
193  coral::AttributeList readBuff;
194  readBuff.extend<int>(PRINCIPAL_ID_COL);
195  readBuff.extend<std::string>(VERIFICATION_COL);
196  readBuff.extend<std::string>(PRINCIPAL_KEY_COL);
197  readBuff.extend<std::string>(ADMIN_KEY_COL);
198  coral::AttributeList whereData;
199  whereData.extend<std::string>(PRINCIPAL_NAME_COL);
200  whereData[PRINCIPAL_NAME_COL].data<std::string>() = principal;
201  std::string whereClause = PRINCIPAL_NAME_COL + " = :" + PRINCIPAL_NAME_COL;
202  query->defineOutput(readBuff);
203  query->addToOutputList(PRINCIPAL_ID_COL);
204  query->addToOutputList(VERIFICATION_COL);
205  query->addToOutputList(PRINCIPAL_KEY_COL);
206  query->addToOutputList(ADMIN_KEY_COL);
207  query->setCondition(whereClause, whereData);
208  coral::ICursor& cursor = query->execute();
209  bool found = false;
210  if (cursor.next()) {
211  found = true;
212  const coral::AttributeList& row = cursor.currentRow();
213  destination.id = row[PRINCIPAL_ID_COL].data<int>();
214  destination.verifKey = row[VERIFICATION_COL].data<std::string>();
215  destination.principalKey = row[PRINCIPAL_KEY_COL].data<std::string>();
216  destination.adminKey = row[ADMIN_KEY_COL].data<std::string>();
217  }
218  return found;
219  }

References ADMIN_KEY_COL(), COND_AUTHENTICATION_TABLE(), HLTMuonOfflineAnalyzer_cff::destination, newFWLiteAna::found, PRINCIPAL_ID_COL(), PRINCIPAL_KEY_COL(), PRINCIPAL_NAME_COL(), contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, and VERIFICATION_COL().

Referenced by cond::CredentialStore::importForPrincipal(), cond::CredentialStore::removePrincipal(), cond::CredentialStore::resetAdmin(), cond::CredentialStore::setPermission(), cond::CredentialStore::startSession(), cond::CredentialStore::unsetPermission(), and updatePrincipalData().

◆ serialize()

template<typename T >
std::pair<Binary, Binary> cond::serialize ( const T payload)

Definition at line 66 of file Serialization.h.

66  {
67  std::pair<Binary, Binary> ret;
68  std::string streamerInfo(StreamerInfo::jsonString());
69  try {
70  // save data to buffers
71  std::ostringstream dataBuffer;
72  CondOutputArchive oa(dataBuffer);
73  oa << payload;
74  //TODO: avoid (2!!) copies
75  ret.first.copy(dataBuffer.str());
76  ret.second.copy(streamerInfo);
77  } catch (const std::exception& e) {
78  std::string em(e.what());
79  throwException("Serialization failed: " + em + ". Serialization info:" + streamerInfo, "serialize");
80  }
81  return ret;
82  }

References MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, cond::StreamerInfo::jsonString(), jets_cff::payload, runTheMatrix::ret, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by cond::persistency::Session::storePayload< std::string >(), cond::persistency::Session::storePayload(), and RawEventFileWriterForBU::writeJsds().

◆ setPermissionData()

bool cond::setPermissionData ( coral::ISchema &  schema,
int  principalId,
const std::string &  principalKey,
const std::string &  role,
const std::string &  connectionString,
int  connectionId,
const std::string &  connectionKey 
)

Definition at line 399 of file CredentialStore.cc.

405  {
406  auth::Cipher cipher(principalKey);
407  std::string encryptedConnectionKey = cipher.b64encrypt(connectionKey);
408  AuthorizationData authData;
409  bool found = selectAuthorization(schema, principalId, role, connectionString, authData);
410 
411  coral::ITableDataEditor& editor = schema.tableHandle(COND_AUTHORIZATION_TABLE).dataEditor();
412  if (found) {
413  coral::AttributeList updateData;
414  updateData.extend<int>(AUTH_ID_COL);
415  updateData.extend<int>(C_ID_COL);
416  updateData.extend<std::string>(AUTH_KEY_COL);
417  updateData[AUTH_ID_COL].data<int>() = authData.id;
418  updateData[C_ID_COL].data<int>() = connectionId;
419  updateData[AUTH_KEY_COL].data<std::string>() = encryptedConnectionKey;
420  std::string setCl = C_ID_COL + " = :" + C_ID_COL + ", " + AUTH_KEY_COL + " = :" + AUTH_KEY_COL;
421  std::string whereCl = AUTH_ID_COL + " = :" + AUTH_ID_COL;
422  editor.updateRows(setCl, whereCl, updateData);
423  } else {
424  int next = -1;
426  throwException("Can't find " + COND_AUTHORIZATION_TABLE + " sequence.", "CredentialStore::setPermission");
427 
428  coral::AttributeList insertData;
429  insertData.extend<int>(AUTH_ID_COL);
430  insertData.extend<int>(P_ID_COL);
431  insertData.extend<std::string>(ROLE_COL);
432  insertData.extend<std::string>(SCHEMA_COL);
433  insertData.extend<std::string>(AUTH_KEY_COL);
434  insertData.extend<int>(C_ID_COL);
435  insertData[AUTH_ID_COL].data<int>() = next;
436  insertData[P_ID_COL].data<int>() = principalId;
437  insertData[ROLE_COL].data<std::string>() = role;
438  insertData[SCHEMA_COL].data<std::string>() = connectionString;
439  insertData[AUTH_KEY_COL].data<std::string>() = encryptedConnectionKey;
440  insertData[C_ID_COL].data<int>() = connectionId;
441  editor.insertRow(insertData);
442  }
443  return true;
444  }

References AUTH_ID_COL(), AUTH_KEY_COL(), cond::auth::Cipher::b64encrypt(), C_ID_COL(), COND_AUTHORIZATION_TABLE(), l1RCTOmdsFedVectorProducer_cfi::connectionString, newFWLiteAna::found, getNextSequenceValue(), cond::AuthorizationData::id, GetRecoTauVFromDQM_MC_cff::next, P_ID_COL(), ROLE_COL(), SCHEMA_COL(), selectAuthorization(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::persistency::throwException().

Referenced by cond::CredentialStore::createSchema(), cond::CredentialStore::importForPrincipal(), cond::CredentialStore::resetAdmin(), cond::CredentialStore::setPermission(), and cond::CredentialStore::updatePrincipal().

◆ synchronizationTypeFromName()

SynchronizationType cond::synchronizationTypeFromName ( const std::string &  name)

Definition at line 47 of file Types.cc.

47  {
48  for (auto const &i : s_synchronizationTypeArray)
49  if (name == i.first)
50  return i.second;
51  for (auto const &i : s_obsoleteSynchronizationTypeArray)
52  if (name == i.first)
53  return i.second;
54  throwException("SynchronizationType \"" + name + "\" is unknown.", "synchronizationTypeFromName");
55  }

References mps_fire::i, Skims_PA_cff::name, s_obsoleteSynchronizationTypeArray, s_synchronizationTypeArray, and throwException().

Referenced by cond::persistency::GetFromRow< cond::SynchronizationType >::operator()().

◆ synchronizationTypeNames()

std::string cond::synchronizationTypeNames ( SynchronizationType  type)

◆ throwException()

void cond::throwException ( const std::string &  message,
const std::string &  methodName 
)

Definition at line 18 of file Exception.cc.

18  {
19  throw Exception(message, methodName);
20  }

Referenced by cond::service::PoolDBOutputService::appendSinceTime(), cond::auth::Cipher::b64decrypt(), cond::service::PoolDBOutputService::closeIOV(), cond::auth::DecodingKey::createFromInputFile(), cond::service::PoolDBOutputService::createNewIOV(), createPayload(), createPayload< HcalCalibrationQIEData >(), createPayload< std::string >(), cond::CredentialStore::createSchema(), cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials(), cond::Binary::data(), default_deserialize(), deserialize< BaseKeyed >(), deserialize< condex::Efficiency >(), deserialize< CSCReadoutMapping >(), deserialize< CSCReadoutMappingForSliceTest >(), deserialize< PerformancePayload >(), cond::service::PoolDBOutputService::eraseSinceTime(), cond::auth::DecodingKey::flush(), cond::service::PoolDBOutputService::forceInit(), cond::persistency::getConnectionParams(), getLoginName(), cond::payloadInspector::PlotBase::getTag(), cond::service::PoolDBOutputService::getTagInfo(), cond::CredentialStore::importForPrincipal(), cond::persistency::importPayload(), cond::auth::DecodingKey::init(), cond::persistency::IOVEditor::load(), cond::persistency::KeyList::loadFromDB(), cond::service::PoolDBOutputService::lookUpRecord(), cond::CredentialStore::removeConnection(), cond::CredentialStore::removePrincipal(), cond::CredentialStore::resetAdmin(), serialize(), cond::persistency::KeyList::setKeys(), cond::CredentialStore::setPermission(), cond::CredentialStore::setUpForService(), cond::Binary::size(), synchronizationTypeFromName(), cond::CredentialStore::unsetPermission(), cond::CredentialStore::updatePrincipal(), and cond::service::PoolDBOutputService::writeOne().

◆ TIMELIMIT()

const Time_t cond::TIMELIMIT ( std::numeric_limits< Time_t ::max())

◆ timeTypeNames()

std::string const & cond::timeTypeNames ( int  i)

Definition at line 11 of file Time.cc.

11  {
12  static const std::string local[] = {"runnumber", "timestamp", "lumiid", "hash", "userid"};
13  return local[i];
14  }

References mps_fire::i, DTRecHitClients_cfi::local, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CondDBESSource::setIntervalFor(), and cond::TimeTypeTraits< type >::specs().

◆ updateConnectionData()

std::pair<int, std::string> cond::updateConnectionData ( coral::ISchema &  schema,
const std::string &  adminKey,
const std::string &  connectionLabel,
const std::string &  userName,
const std::string &  password,
bool  forceUpdate 
)

Definition at line 446 of file CredentialStore.cc.

451  {
452  CredentialData credsData;
453  bool found = selectConnection(schema, connectionLabel, credsData);
454  int connId = credsData.id;
455 
456  auth::Cipher adminCipher(adminKey);
457  std::string connectionKey("");
458  coral::ITableDataEditor& editor = schema.tableHandle(COND_CREDENTIAL_TABLE).dataEditor();
459  if (found) {
460  connectionKey = adminCipher.b64decrypt(credsData.connectionKey);
461  auth::Cipher cipher(connectionKey);
462  std::string verificationKey = cipher.b64decrypt(credsData.verificationKey);
463  if (verificationKey != connectionLabel) {
464  throwException("Decoding of connection key failed.", "CredentialStore::updateConnection");
465  }
466  if (forceUpdate) {
467  std::string encryptedUserName = cipher.b64encrypt(userName);
468  std::string encryptedPassword = cipher.b64encrypt(password);
469 
470  coral::AttributeList updateData;
471  updateData.extend<int>(CONNECTION_ID_COL);
472  updateData.extend<std::string>(USERNAME_COL);
473  updateData.extend<std::string>(PASSWORD_COL);
474  updateData[CONNECTION_ID_COL].data<int>() = connId;
475  updateData[USERNAME_COL].data<std::string>() = encryptedUserName;
476  updateData[PASSWORD_COL].data<std::string>() = encryptedPassword;
477  std::stringstream setCl;
478  setCl << USERNAME_COL << " = :" << USERNAME_COL;
479  setCl << ", " << PASSWORD_COL << " = :" << PASSWORD_COL;
480  std::string whereCl = CONNECTION_ID_COL + " = :" + CONNECTION_ID_COL;
481  editor.updateRows(setCl.str(), whereCl, updateData);
482  }
483  }
484 
485  if (!found) {
486  auth::KeyGenerator gen;
487  connectionKey = gen.make(auth::COND_DB_KEY_SIZE);
488  auth::Cipher cipher(connectionKey);
489  std::string encryptedUserName = cipher.b64encrypt(userName);
490  std::string encryptedPassword = cipher.b64encrypt(password);
491  std::string encryptedLabel = cipher.b64encrypt(connectionLabel);
492 
493  if (!getNextSequenceValue(schema, COND_CREDENTIAL_TABLE, connId))
494  throwException("Can't find " + COND_CREDENTIAL_TABLE + " sequence.", "CredentialStore::updateConnection");
495 
496  coral::AttributeList insertData;
497  insertData.extend<int>(CONNECTION_ID_COL);
498  insertData.extend<std::string>(CONNECTION_LABEL_COL);
499  insertData.extend<std::string>(USERNAME_COL);
500  insertData.extend<std::string>(PASSWORD_COL);
501  insertData.extend<std::string>(VERIFICATION_KEY_COL);
502  insertData.extend<std::string>(CONNECTION_KEY_COL);
503  insertData[CONNECTION_ID_COL].data<int>() = connId;
504  insertData[CONNECTION_LABEL_COL].data<std::string>() = connectionLabel;
505  insertData[USERNAME_COL].data<std::string>() = encryptedUserName;
506  insertData[PASSWORD_COL].data<std::string>() = encryptedPassword;
507  insertData[VERIFICATION_KEY_COL].data<std::string>() = encryptedLabel;
508  insertData[CONNECTION_KEY_COL].data<std::string>() = adminCipher.b64encrypt(connectionKey);
509  ;
510  editor.insertRow(insertData);
511  }
512  return std::make_pair(connId, connectionKey);
513  }

References cond::auth::Cipher::b64decrypt(), cond::auth::Cipher::b64encrypt(), COND_CREDENTIAL_TABLE(), cond::auth::COND_DB_KEY_SIZE, CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), cond::CredentialData::connectionKey, newFWLiteAna::found, relval_steps::gen(), getNextSequenceValue(), cond::CredentialData::id, EcalCondDBWriter_cfi::password, PASSWORD_COL(), selectConnection(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), EcalCondDBWriter_cfi::userName, USERNAME_COL(), VERIFICATION_KEY_COL(), and cond::CredentialData::verificationKey.

Referenced by cond::CredentialStore::createSchema(), cond::CredentialStore::importForPrincipal(), cond::CredentialStore::resetAdmin(), and cond::CredentialStore::updateConnection().

◆ updatePrincipalData()

std::pair<int, std::string> cond::updatePrincipalData ( coral::ISchema &  schema,
const std::string &  authenticationKey,
const std::string &  principalName,
const std::string &  adminKey,
bool  init = false 
)

Definition at line 341 of file CredentialStore.cc.

345  {
346  PrincipalData princData;
347  bool found = selectPrincipal(schema, principalName, princData);
348 
349  auth::Cipher cipher0(authenticationKey);
350  auth::Cipher cipher1(adminKey);
351 
352  std::string verifStr = cipher0.b64encrypt(principalName);
353  std::string principalKey("");
354  int principalId = princData.id;
355 
356  coral::ITableDataEditor& editor = schema.tableHandle(COND_AUTHENTICATION_TABLE).dataEditor();
357  if (found) {
358  principalKey = cipher1.b64decrypt(princData.adminKey);
359  coral::AttributeList updateData;
360  updateData.extend<int>(PRINCIPAL_ID_COL);
361  updateData.extend<std::string>(VERIFICATION_COL);
362  updateData.extend<std::string>(PRINCIPAL_KEY_COL);
363  updateData.extend<std::string>(ADMIN_KEY_COL);
364  updateData[PRINCIPAL_ID_COL].data<int>() = principalId;
365  updateData[VERIFICATION_COL].data<std::string>() = verifStr;
366  updateData[PRINCIPAL_KEY_COL].data<std::string>() = cipher0.b64encrypt(principalKey);
367  updateData[ADMIN_KEY_COL].data<std::string>() = cipher1.b64encrypt(principalKey);
368  std::stringstream setClause;
369  setClause << VERIFICATION_COL << " = :" << VERIFICATION_COL << ", ";
370  setClause << PRINCIPAL_KEY_COL << " = :" << PRINCIPAL_KEY_COL << ", ";
371  setClause << ADMIN_KEY_COL << " = :" << ADMIN_KEY_COL;
372  std::string whereClause = PRINCIPAL_ID_COL + " = :" + PRINCIPAL_ID_COL;
373  editor.updateRows(setClause.str(), whereClause, updateData);
374  } else {
375  if (init) {
376  principalKey = adminKey;
377  } else {
378  auth::KeyGenerator gen;
379  principalKey = gen.make(auth::COND_DB_KEY_SIZE);
380  }
381  coral::ITableDataEditor& editor0 = schema.tableHandle(COND_AUTHENTICATION_TABLE).dataEditor();
382 
383  if (!getNextSequenceValue(schema, COND_AUTHENTICATION_TABLE, principalId))
384  throwException("Can't find " + COND_AUTHENTICATION_TABLE + " sequence.", "CredentialStore::updatePrincipal");
385 
386  coral::AttributeList authData;
387  editor0.rowBuffer(authData);
388  authData[PRINCIPAL_ID_COL].data<int>() = principalId;
389  authData[PRINCIPAL_NAME_COL].data<std::string>() = principalName;
390  authData[VERIFICATION_COL].data<std::string>() = verifStr;
391  authData[PRINCIPAL_KEY_COL].data<std::string>() = cipher0.b64encrypt(principalKey);
392  authData[ADMIN_KEY_COL].data<std::string>() = cipher1.b64encrypt(principalKey);
393  editor0.insertRow(authData);
394  }
395 
396  return std::make_pair(principalId, principalKey);
397  }

References ADMIN_KEY_COL(), cond::PrincipalData::adminKey, cond::auth::Cipher::b64decrypt(), cond::auth::Cipher::b64encrypt(), COND_AUTHENTICATION_TABLE(), cond::auth::COND_DB_KEY_SIZE, newFWLiteAna::found, relval_steps::gen(), getNextSequenceValue(), cond::PrincipalData::id, PRINCIPAL_ID_COL(), PRINCIPAL_KEY_COL(), PRINCIPAL_NAME_COL(), selectPrincipal(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), and VERIFICATION_COL().

Referenced by cond::CredentialStore::createSchema(), cond::CredentialStore::resetAdmin(), and cond::CredentialStore::updatePrincipal().

Variable Documentation

◆ HASH_SIZE

constexpr unsigned int cond::HASH_SIZE = 40
staticconstexpr

Definition at line 44 of file Types.h.

◆ s_obsoleteSynchronizationTypeArray

std::pair<const char *, SynchronizationType> cond::s_obsoleteSynchronizationTypeArray[]
static
Initial value:
= {
std::make_pair("Offline", SYNCH_OFFLINE),
std::make_pair("HLT", SYNCH_HLT),
std::make_pair("Prompt", SYNCH_PROMPT),
std::make_pair("Pcl", SYNCH_PCL)}

Definition at line 40 of file Types.cc.

Referenced by synchronizationTypeFromName().

◆ s_synchronizationTypeArray

std::pair<const char *, SynchronizationType> cond::s_synchronizationTypeArray[]
static
Initial value:
= {
std::make_pair("any", SYNCH_ANY),
std::make_pair("validation", SYNCH_VALIDATION),
std::make_pair("offline", SYNCH_OFFLINE),
std::make_pair("mc", SYNCH_MC),
std::make_pair("runmc", SYNCH_RUNMC),
std::make_pair("hlt", SYNCH_HLT),
std::make_pair("express", SYNCH_EXPRESS),
std::make_pair("prompt", SYNCH_PROMPT),
std::make_pair("pcl", SYNCH_PCL)}

Definition at line 29 of file Types.cc.

Referenced by synchronizationTypeFromName(), and synchronizationTypeNames().

◆ TIMETYPE_LIST_MAX

const unsigned int cond::TIMETYPE_LIST_MAX = 5

Definition at line 20 of file Time.h.

Referenced by findSpecs().

◆ timeTypeList

const cond::TimeType cond::timeTypeList = {runnumber, timestamp, lumiid, hash, userid}

Definition at line 7 of file Time.cc.

◆ timeTypeSpecs

const TimeTypeSpecs cond::timeTypeSpecs

◆ timeTypeValues

const cond::TimeType cond::timeTypeValues = {runnumber, timestamp, lumiid, hash, userid}

Definition at line 9 of file Time.cc.

personalPlayback.level
level
Definition: personalPlayback.py:22
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
PerformancePayloadFromTFormula
Definition: PerformancePayloadFromTFormula.h:17
ROLE_COL
static const std::string ROLE_COL("C_ROLE")
cond::selectAuthorization
bool selectAuthorization(coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString, AuthorizationData &destination)
Definition: CredentialStore.cc:270
condex::Efficiency
Definition: Efficiency.h:19
SCHEMA_COL
static const std::string SCHEMA_COL("C_SCHEMA")
cond::time::MIN_VAL
const Time_t MIN_VAL(0)
cond::lumiid
Definition: Time.h:19
mps_fire.i
i
Definition: mps_fire.py:355
C_ID_COL
static const std::string C_ID_COL("C_ID")
CalibrationSummaryClient_cfi.params
params
Definition: CalibrationSummaryClient_cfi.py:14
cond::hash
Definition: Time.h:19
cond::TIMETYPE_LIST_MAX
const unsigned int TIMETYPE_LIST_MAX
Definition: Time.h:20
ItemSeparator
constexpr char ItemSeparator
Definition: DecodingKey.cc:14
AUTH_KEY_COL
static const std::string AUTH_KEY_COL("CRED3")
PRINCIPAL_NAME_COL
static const std::string PRINCIPAL_NAME_COL("P_NAME")
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HistogramManager_cfi.specs
specs
Definition: HistogramManager_cfi.py:80
CONNECTION_LABEL_COL
static const std::string CONNECTION_LABEL_COL("CONN_LABEL")
cond::SYNCH_HLT
Definition: Types.h:33
beam_dqm_sourceclient-live_cfg.lastLumiFile
lastLumiFile
Definition: beam_dqm_sourceclient-live_cfg.py:364
VERIFICATION_KEY_COL
static const std::string VERIFICATION_KEY_COL("CRED6")
cond::CondOutputArchive
cond::serialization::OutputArchive CondOutputArchive
Definition: Serialization.h:62
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
mps_check.msg
tuple msg
Definition: mps_check.py:285
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
CTPPSpixelLocalTrackReconstructionInfo::invalid
cond::SYNCH_VALIDATION
Definition: Types.h:29
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
serviceName
static const std::string serviceName
Definition: CredentialStore.cc:31
ADMIN_KEY_COL
static const std::string ADMIN_KEY_COL("CRED2")
COND_AUTHORIZATION_TABLE
static const std::string COND_AUTHORIZATION_TABLE("COND_AUTHORIZATION")
EcalCondDBWriter_cfi.userName
userName
Definition: EcalCondDBWriter_cfi.py:61
CONNECTION_KEY_COL
static const std::string CONNECTION_KEY_COL("CRED7")
cond::SYNCH_EXPRESS
Definition: Types.h:34
cond::timestamp
Definition: Time.h:19
cond::userid
Definition: Time.h:19
EcalCondDBWriter_cfi.password
password
Definition: EcalCondDBWriter_cfi.py:62
PerformancePayloadFromTable
Definition: PerformancePayloadFromTable.h:15
cond::timeTypeSpecs
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
cond::SynchronizationType
SynchronizationType
Definition: Types.h:27
query
Definition: query.py:1
cond::getNextSequenceValue
bool getNextSequenceValue(coral::ISchema &schema, const std::string &sequenceName, int &value)
Definition: CredentialStore.cc:308
SEQUENCE_NAME_COL
static const std::string SEQUENCE_NAME_COL("NAME")
cond::SYNCH_PROMPT
Definition: Types.h:35
USERNAME_COL
static const std::string USERNAME_COL("CRED4")
SEQUENCE_TABLE_NAME
static const std::string SEQUENCE_TABLE_NAME("COND_CREDENTIAL_SEQUENCE")
str
#define str(s)
Definition: TestProcessor.cc:48
COND_CREDENTIAL_TABLE
static const std::string COND_CREDENTIAL_TABLE("COND_CREDENTIAL")
writeEcalDQMStatus.since
since
Definition: writeEcalDQMStatus.py:53
DESERIALIZE_POLIMORPHIC_CASE
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
Definition: Serialization.h:134
jets_cff.payload
payload
Definition: jets_cff.py:34
dqmdumpme.k
k
Definition: dqmdumpme.py:60
gen
Definition: PythiaDecays.h:13
PASSWORD_COL
static const std::string PASSWORD_COL("CRED5")
PerformancePayload
Definition: PerformancePayload.h:14
b
double b
Definition: hdecay.h:118
DESERIALIZE_BASE_CASE
#define DESERIALIZE_BASE_CASE(BASETYPENAME)
Definition: Serialization.h:129
CONNECTION_ID_COL
static const std::string CONNECTION_ID_COL("CONN_ID")
cond::SYNCH_OFFLINE
Definition: Types.h:30
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
TrackCollections2monitor_cff.sequenceName
sequenceName
Definition: TrackCollections2monitor_cff.py:6
cond::selectConnection
bool selectConnection(coral::ISchema &schema, const std::string &connectionLabel, CredentialData &destination)
Definition: CredentialStore.cc:230
a
double a
Definition: hdecay.h:119
cond::s_synchronizationTypeArray
static std::pair< const char *, SynchronizationType > s_synchronizationTypeArray[]
Definition: Types.cc:29
cond::SYNCH_ANY
Definition: Types.h:28
cond::runnumber
Definition: Time.h:19
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
condex::ParametricEfficiencyInEta
Definition: Efficiency.h:50
cond::getch
int getch()
Definition: Utilities.cc:19
P_ID_COL
static const std::string P_ID_COL("P_ID")
value
Definition: value.py:1
condex::ParametricEfficiencyInPt
Definition: Efficiency.h:31
cond::time::TimeType
cond::TimeType TimeType
Definition: Time.h:30
CSCReadoutMappingForSliceTest
Definition: CSCReadoutMappingForSliceTest.h:13
HLT_2018_cff.payloadType
payloadType
Definition: HLT_2018_cff.py:8133
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
rand
Signal rand(Signal arg)
Definition: vlib.cc:379
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
PerformancePayloadFromBinnedTFormula
Definition: PerformancePayloadFromBinnedTFormula.h:17
VERIFICATION_COL
static const std::string VERIFICATION_COL("CRED0")
cond::getpass
std::string getpass(const std::string &prompt, bool show_asterisk=true)
Definition: Utilities.cc:34
HLTMuonOfflineAnalyzer_cff.destination
destination
Definition: HLTMuonOfflineAnalyzer_cff.py:50
L1DTConfigBti_cff.LL
LL
Definition: L1DTConfigBti_cff.py:25
HcalCalibrationQIEData
Definition: HcalCalibrationQIEData.h:22
type
type
Definition: HCALResponse.h:21
init
Definition: init.py:1
cond::selectPrincipal
bool selectPrincipal(coral::ISchema &schema, const std::string &principal, PrincipalData &destination)
Definition: CredentialStore.cc:191
T
long double T
Definition: Basic3DVectorLD.h:48
AUTH_ID_COL
static const std::string AUTH_ID_COL("AUTH_ID")
cond::SYNCH_RUNMC
Definition: Types.h:32
Exception
Definition: hltDiff.cc:246
PRINCIPAL_KEY_COL
static const std::string PRINCIPAL_KEY_COL("CRED1")
PRINCIPAL_ID_COL
static const std::string PRINCIPAL_ID_COL("P_ID")
cond::CondInputArchive
cond::serialization::InputArchive CondInputArchive
Definition: Serialization.h:61
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
relval_steps.gen
def gen(fragment, howMuch)
Production test section ####.
Definition: relval_steps.py:500
cond::persistency::throwException
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
cond::schemaLabel
std::string schemaLabel(const std::string &serviceName, const std::string &userName)
Definition: CredentialStore.cc:154
cond::SYNCH_MC
Definition: Types.h:31
contentValuesFiles.query
query
Definition: contentValuesFiles.py:38
CSCReadoutMappingFromFile
Definition: CSCReadoutMappingFromFile.h:15
CSCReadoutMapping
Definition: CSCReadoutMapping.h:26
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
b64str
static const char * b64str
Definition: DecodingKey.cc:18
cond::s_obsoleteSynchronizationTypeArray
static std::pair< const char *, SynchronizationType > s_obsoleteSynchronizationTypeArray[]
Definition: Types.cc:40
condex::ConfI
Definition: Conf.h:14
l1RCTOmdsFedVectorProducer_cfi.connectionString
connectionString
Definition: l1RCTOmdsFedVectorProducer_cfi.py:4
mps_splice.line
line
Definition: mps_splice.py:76
SEQUENCE_VALUE_COL
static const std::string SEQUENCE_VALUE_COL("VALUE")
mix64
#define mix64(a, b, c)
Definition: hash64.cc:22
ub8
unsigned long long ub8
Definition: hash64.cc:62
cond::SYNCH_PCL
Definition: Types.h:36
cond::auth::COND_DB_KEY_SIZE
static constexpr unsigned int COND_DB_KEY_SIZE
Definition: Auth.h:25
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
COND_AUTHENTICATION_TABLE
static const std::string COND_AUTHENTICATION_TABLE("COND_AUTHENTICATION")