Project
Loading...
Searching...
No Matches
o2::ccdb::CcdbApi Class Reference

#include <CcdbApi.h>

Classes

struct  RequestContext
 

Public Types

typedef struct o2::ccdb::CcdbApi::RequestContext RequestContext
 

Public Member Functions

 CcdbApi ()
 Default constructor.
 
virtual ~CcdbApi ()
 Default destructor.
 
 CcdbApi (const CcdbApi &)=delete
 
void operator= (const CcdbApi &)=delete
 
const std::string getUniqueAgentID () const
 
void init (std::string const &hosts)
 
std::string const & getURL () const
 
bool isSnapshotMode () const
 
int storeAsTFile (const TObject *rootObject, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
 
template<typename T >
int storeAsTFileAny (const T *obj, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
 
int storeAsTFileAny (const TObject *rootobj, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
 
template<typename T >
std::enable_if<!std::is_base_of< o2::conf::ConfigurableParam, T >::value, T * >::type retrieveFromTFileAny (std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp=-1, std::map< std::string, std::string > *headers=nullptr, std::string const &etag="", const std::string &createdNotAfter="", const std::string &createdNotBefore="") const
 
template<typename T >
std::enable_if< std::is_base_of< o2::conf::ConfigurableParam, T >::value, T * >::type retrieveFromTFileAny (std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp=-1, std::map< std::string, std::string > *headers=nullptr, std::string const &etag="", const std::string &createdNotAfter="", const std::string &createdNotBefore="") const
 
void truncate (std::string const &path) const
 
void deleteObject (std::string const &path, long timestamp=-1) const
 
int updateMetadata (std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp, std::string const &id="", long newEOV=0)
 
std::string list (std::string const &path="", bool latestOnly=false, std::string const &returnFormat="text/plain", long createdNotAfter=-1, long createdNotBefore=-1) const
 
void snapshot (std::string const &ccdbrootpath, std::string const &localDir, long timestamp) const
 
bool isHostReachable () const
 
std::vector< std::string > parseSubFolders (std::string const &reply) const
 
std::vector< std::string > getAllFolders (std::string const &top) const
 
bool retrieveBlob (std::string const &path, std::string const &targetdir, std::map< std::string, std::string > const &metadata, long timestamp, bool preservePathStructure=true, std::string const &localFileName="snapshot.root", std::string const &createdNotAfter="", std::string const &createdNotBefore="") const
 
std::map< std::string, std::string > retrieveHeaders (std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp=-1) const
 
TObjectretrieve (std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp) const
 
TObjectretrieveFromTFile (std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp, std::map< std::string, std::string > *headers, std::string const &etag, const std::string &createdNotAfter, const std::string &createdNotBefore) const
 
void loadFileToMemory (std::vector< char > &dest, std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp, std::map< std::string, std::string > *headers, std::string const &etag, const std::string &createdNotAfter, const std::string &createdNotBefore, bool considerSnapshot=true) const
 
void saveSnapshot (RequestContext &requestContext) const
 
void scheduleDownload (RequestContext &requestContext, size_t *requestCounter) const
 
void getFromSnapshot (bool createSnapshot, std::string const &path, long timestamp, std::map< std::string, std::string > &headers, std::string &snapshotpath, o2::pmr::vector< char > &dest, int &fromSnapshot, std::string const &etag) const
 
void releaseNamedSemaphore (boost::interprocess::named_semaphore *sem, std::string const &path) const
 
boost::interprocess::named_semaphore * createNamedSemaphore (std::string const &path) const
 
void loadFileToMemory (o2::pmr::vector< char > &dest, const std::string &path, std::map< std::string, std::string > *localHeaders=nullptr) const
 
void loadFileToMemory (o2::pmr::vector< char > &dest, std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp, std::map< std::string, std::string > *headers, std::string const &etag, const std::string &createdNotAfter, const std::string &createdNotBefore, bool considerSnapshot=true) const
 
bool loadLocalContentToMemory (o2::pmr::vector< char > &dest, std::string &url) const
 
void navigateSourcesAndLoadFile (RequestContext &requestContext, int &fromSnapshot, size_t *requestCounter) const
 
void vectoredLoadFileToMemory (std::vector< RequestContext > &requestContext) const
 
int storeAsBinaryFile (const char *buffer, size_t size, const std::string &fileName, const std::string &objectType, const std::string &path, const std::map< std::string, std::string > &metadata, long startValidityTimestamp, long endValidityTimestamp, std::vector< char >::size_type maxSize=0) const
 
int storeAsTFile_impl (const void *obj1, std::type_info const &info, std::string const &path, std::map< std::string, std::string > const &metadata, long startValidityTimestamp=-1, long endValidityTimestamp=-1, std::vector< char >::size_type maxSize=0) const
 
voidretrieveFromTFile (std::type_info const &, std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp=-1, std::map< std::string, std::string > *headers=nullptr, std::string const &etag="", const std::string &createdNotAfter="", const std::string &createdNotBefore="") const
 
void runDownloaderLoop (bool noWait)
 
void setCurlRetriesParameters (int numberRetries, int delay=100000)
 

Static Public Member Functions

static bool checkAlienToken ()
 
template<typename T >
static std::unique_ptr< std::vector< char > > createObjectImage (const T *obj, CcdbObjectInfo *info=nullptr)
 
static std::unique_ptr< std::vector< char > > createObjectImage (const TObject *obj, CcdbObjectInfo *info=nullptr)
 
static std::unique_ptr< std::vector< char > > createObjectImage (const void *obj, std::type_info const &tinfo, CcdbObjectInfo *info=nullptr)
 
static voidextractFromTFile (TFile &file, TClass const *cl, const char *what=CCDBOBJECT_ENTRY)
 
static bool getCCDBEntryHeaders (std::string const &url, std::string const &etag, std::vector< std::string > &headers, const std::string &agentID="")
 
static void parseCCDBHeaders (std::vector< std::string > const &headers, std::vector< std::string > &pfns, std::string &etag)
 
static CCDBQueryretrieveQueryInfo (TFile &)
 
static std::map< std::string, std::string > * retrieveMetaInfo (TFile &)
 
static std::string generateFileName (const std::string &inp)
 
static void curlSetSSLOptions (CURL *curl)
 
static std::string determineSemaphoreName (std::string const &basedir, std::string const &objectpath)
 
static bool removeSemaphore (std::string const &name, bool remove=false)
 
static void removeLeakingSemaphores (std::string const &basedir, bool remove=false)
 
static void appendFlatHeader (o2::pmr::vector< char > &dest, const std::map< std::string, std::string > &headers)
 
static bool isMemoryFileInvalid (const o2::pmr::vector< char > &v)
 
template<typename T >
static T * extractFromMemoryBlob (o2::pmr::vector< char > &blob)
 

Static Public Attributes

static constexpr const charCCDBQUERY_ENTRY = "ccdb_query"
 
static constexpr const charCCDBMETA_ENTRY = "ccdb_meta"
 
static constexpr const charCCDBOBJECT_ENTRY = "ccdb_object"
 

Detailed Description

Interface to the CCDB. It uses Curl to talk to the REST api.

Todo:

use smart pointers ?

handle errors and exceptions

extend code coverage

Definition at line 59 of file CcdbApi.h.

Member Typedef Documentation

◆ RequestContext

Constructor & Destructor Documentation

◆ CcdbApi() [1/2]

o2::ccdb::CcdbApi::CcdbApi ( )

Default constructor.

Definition at line 95 of file CcdbApi.cxx.

◆ ~CcdbApi()

o2::ccdb::CcdbApi::~CcdbApi ( )
virtual

Default destructor.

Definition at line 111 of file CcdbApi.cxx.

◆ CcdbApi() [2/2]

o2::ccdb::CcdbApi::CcdbApi ( const CcdbApi )
delete

Member Function Documentation

◆ appendFlatHeader()

void o2::ccdb::CcdbApi::appendFlatHeader ( o2::pmr::vector< char > &  dest,
const std::map< std::string, std::string > &  headers 
)
static

Definition at line 1906 of file CcdbApi.cxx.

◆ checkAlienToken()

bool o2::ccdb::CcdbApi::checkAlienToken ( )
static

Definition at line 128 of file CcdbApi.cxx.

◆ createNamedSemaphore()

boost::interprocess::named_semaphore * o2::ccdb::CcdbApi::createNamedSemaphore ( std::string const &  path) const

Definition at line 1744 of file CcdbApi.cxx.

◆ createObjectImage() [1/3]

template<typename T >
static std::unique_ptr< std::vector< char > > o2::ccdb::CcdbApi::createObjectImage ( const T *  obj,
CcdbObjectInfo info = nullptr 
)
inlinestatic

Create a binary image of the arbitrary type object, if CcdbObjectInfo pointer is provided, register there

the assigned object class name and the filename

Parameters
objRaw pointer to the object to store.
infooptinal info where assigned object name and filename will be filled

Definition at line 103 of file CcdbApi.h.

◆ createObjectImage() [2/3]

std::unique_ptr< std::vector< char > > o2::ccdb::CcdbApi::createObjectImage ( const TObject obj,
CcdbObjectInfo info = nullptr 
)
static

Create a binary image of the TObject, if CcdbObjectInfo pointer is provided, register there

the assigned object class name and the filename

Parameters
objRaw pointer to the object to store.
infooptinal info where assigned object name and filename will be filled

Definition at line 321 of file CcdbApi.cxx.

◆ createObjectImage() [3/3]

std::unique_ptr< std::vector< char > > o2::ccdb::CcdbApi::createObjectImage ( const void obj,
std::type_info const &  tinfo,
CcdbObjectInfo info = nullptr 
)
static

Create a binary image of the object, if CcdbObjectInfo pointer is provided, register there

the assigned object class name and the filename

Parameters
objRaw pointer to the object to store.
tinfoobject type info
infooptinal info where assigned object name and filename will be filled

Definition at line 307 of file CcdbApi.cxx.

◆ curlSetSSLOptions()

void o2::ccdb::CcdbApi::curlSetSSLOptions ( CURL *  curl)
static

Set curl SSL options. The client still will be able to connect to non-ssl endpoints

Parameters
curlcurl handler
Returns

Definition at line 612 of file CcdbApi.cxx.

◆ deleteObject()

void o2::ccdb::CcdbApi::deleteObject ( std::string const &  path,
long  timestamp = -1 
) const

Delete the matching version of this object.

Todo:
Raise an exception if no such object exist.
Parameters
pathPath to the object to delete
timestampTimestamp of the object to delete.

Definition at line 1243 of file CcdbApi.cxx.

◆ determineSemaphoreName()

std::string o2::ccdb::CcdbApi::determineSemaphoreName ( std::string const &  basedir,
std::string const &  objectpath 
)
static

Definition at line 1737 of file CcdbApi.cxx.

◆ extractFromMemoryBlob()

template<typename T >
static T * o2::ccdb::CcdbApi::extractFromMemoryBlob ( o2::pmr::vector< char > &  blob)
inlinestatic

Definition at line 406 of file CcdbApi.h.

◆ extractFromTFile()

void * o2::ccdb::CcdbApi::extractFromTFile ( TFile &  file,
TClass const *  cl,
const char what = CCDBOBJECT_ENTRY 
)
static

A helper function to extract an object from an existing in-memory TFile

Parameters
filea TFile instance
clThe TClass object describing the serialized type
Returns
raw pointer to created object

Definition at line 877 of file CcdbApi.cxx.

◆ generateFileName()

std::string o2::ccdb::CcdbApi::generateFileName ( const std::string &  inp)
static

Generates a file-name where the object will be stored (usually, from the provided class name)

Definition at line 798 of file CcdbApi.cxx.

◆ getAllFolders()

std::vector< std::string > o2::ccdb::CcdbApi::getAllFolders ( std::string const &  top) const

Function returning the complete list of (recursive) paths below a given top path

Parameters
topThe top folder from which to search
Returns
The vector of all possible CCDB folders

Definition at line 1582 of file CcdbApi.cxx.

◆ getCCDBEntryHeaders()

bool o2::ccdb::CcdbApi::getCCDBEntryHeaders ( std::string const &  url,
std::string const &  etag,
std::vector< std::string > &  headers,
const std::string &  agentID = "" 
)
static

Get headers associated to a given CCDBEntry on the server.

Parameters
urlthe url which refers to the objects
etagof the previous reply
headersthe headers found in the request. Will be emptied when we return false.
Returns
true if the headers where updated WRT last time, false if the previous results can still be used.

Definition at line 1496 of file CcdbApi.cxx.

◆ getFromSnapshot()

void o2::ccdb::CcdbApi::getFromSnapshot ( bool  createSnapshot,
std::string const &  path,
long  timestamp,
std::map< std::string, std::string > &  headers,
std::string &  snapshotpath,
o2::pmr::vector< char > &  dest,
int fromSnapshot,
std::string const &  etag 
) const

Definition at line 1822 of file CcdbApi.cxx.

◆ getUniqueAgentID()

const std::string o2::ccdb::CcdbApi::getUniqueAgentID ( ) const
inline

Definition at line 71 of file CcdbApi.h.

◆ getURL()

std::string const & o2::ccdb::CcdbApi::getURL ( ) const
inline

Query current URL

Definition at line 87 of file CcdbApi.h.

◆ init()

void o2::ccdb::CcdbApi::init ( std::string const &  hosts)

Initialize connection to CCDB

Parameters
hostsThe URLs to the CCDB (e.g. "ccdb-test.cern.ch:8080" or to a local snapshot "file:///tmp/CCDBSnapshot"), separated with "," or ";" ("https://localhost:8080,https://ccdb-test.cern.ch:8080")

Definition at line 165 of file CcdbApi.cxx.

◆ isHostReachable()

bool o2::ccdb::CcdbApi::isHostReachable ( ) const

Check whether the url is reachable.

Parameters
urlThe url to test.
Returns
a bool indicating whether the url is reachable or not.

Definition at line 1301 of file CcdbApi.cxx.

◆ isMemoryFileInvalid()

static bool o2::ccdb::CcdbApi::isMemoryFileInvalid ( const o2::pmr::vector< char > &  v)
inlinestatic

Definition at line 404 of file CcdbApi.h.

◆ isSnapshotMode()

bool o2::ccdb::CcdbApi::isSnapshotMode ( ) const
inline

Check if we are in a snapshot mode

Definition at line 93 of file CcdbApi.h.

◆ list()

std::string o2::ccdb::CcdbApi::list ( std::string const &  path = "",
bool  latestOnly = false,
std::string const &  returnFormat = "text/plain",
long  createdNotAfter = -1,
long  createdNotBefore = -1 
) const

Return the listing of objects, and in some cases subfolders, matching this path. The path can contain sql patterns (correctly encoded) or regexps.

In the case where there is no pattern, the list of subfolders is returned along with all the objects at this path. It does not work recursively and objects from the subfolders are not returned.

In the case where there is a pattern, subfolders are not returned and any object matching the pattern will be returned, including those in subfolders if they match.

Example : Task/Detector will return objects and subfolders in /Task/Detector but not the object(s) in /Task/Detector/Sub. Example : Task/Detector/.* will return any object below Detector recursively. Example : Te*e* will return any object matching this pattern, including Test/detector and TestSecond/A/B.

Todo:
accept should use an enum class.
Parameters
pathThe path to the folder we want to list the children of (default : top dir).
latestOnlyIn case there are several versions of the same object, list only the latest one.
returnFormatThe format of the returned string -> one of "text/plain (default)", "application/json", "text/xml"
Returns
The listing of folder and/or objects in the format requested

Definition at line 1191 of file CcdbApi.cxx.

◆ loadFileToMemory() [1/3]

void o2::ccdb::CcdbApi::loadFileToMemory ( o2::pmr::vector< char > &  dest,
const std::string &  path,
std::map< std::string, std::string > *  localHeaders = nullptr 
) const

Definition at line 1987 of file CcdbApi.cxx.

◆ loadFileToMemory() [2/3]

void o2::ccdb::CcdbApi::loadFileToMemory ( o2::pmr::vector< char > &  dest,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp,
std::map< std::string, std::string > *  headers,
std::string const &  etag,
const std::string &  createdNotAfter,
const std::string &  createdNotBefore,
bool  considerSnapshot = true 
) const

Definition at line 1888 of file CcdbApi.cxx.

◆ loadFileToMemory() [3/3]

void o2::ccdb::CcdbApi::loadFileToMemory ( std::vector< char > &  dest,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp,
std::map< std::string, std::string > *  headers,
std::string const &  etag,
const std::string &  createdNotAfter,
const std::string &  createdNotBefore,
bool  considerSnapshot = true 
) const

Definition at line 1873 of file CcdbApi.cxx.

◆ loadLocalContentToMemory()

bool o2::ccdb::CcdbApi::loadLocalContentToMemory ( o2::pmr::vector< char > &  dest,
std::string &  url 
) const

Definition at line 1971 of file CcdbApi.cxx.

◆ navigateSourcesAndLoadFile()

void o2::ccdb::CcdbApi::navigateSourcesAndLoadFile ( RequestContext requestContext,
int fromSnapshot,
size_t *  requestCounter 
) const

Retrieves files either as snapshot or schedules them to be downloaded via CCDBDownloader.

Parameters
requestContextStructure giving details about the transfer.
fromSnapshotAfter navigateSourcesAndLoadFile returns signals whether file was retrieved from snapshot.
requestCounterPointer to the variable storing the number of requests to be done.

Definition at line 1925 of file CcdbApi.cxx.

◆ operator=()

void o2::ccdb::CcdbApi::operator= ( const CcdbApi )
delete

◆ parseCCDBHeaders()

void o2::ccdb::CcdbApi::parseCCDBHeaders ( std::vector< std::string > const &  headers,
std::vector< std::string > &  pfns,
std::string &  etag 
)
static

Extract the possible locations for a file and check whether or not the current cached object is still valid.

Parameters
headersthe headers to be parsed
pfnsthe vector of pfns to be filled.
etagthe etag to be updated with the new value

Definition at line 1531 of file CcdbApi.cxx.

◆ parseSubFolders()

std::vector< std::string > o2::ccdb::CcdbApi::parseSubFolders ( std::string const &  reply) const

Helper function to extract the list of sub-folders from a list reply into a vector container. Can be used to achieve full recursive traversal/listing of the CCDB.

Parameters
replyThe reply that we got from a GET/browse sort of request.
Returns
The vector of sub-folders.

Definition at line 1324 of file CcdbApi.cxx.

◆ releaseNamedSemaphore()

void o2::ccdb::CcdbApi::releaseNamedSemaphore ( boost::interprocess::named_semaphore *  sem,
std::string const &  path 
) const

Definition at line 1756 of file CcdbApi.cxx.

◆ removeLeakingSemaphores()

void o2::ccdb::CcdbApi::removeLeakingSemaphores ( std::string const &  basedir,
bool  remove = false 
)
static

Definition at line 1790 of file CcdbApi.cxx.

◆ removeSemaphore()

bool o2::ccdb::CcdbApi::removeSemaphore ( std::string const &  name,
bool  remove = false 
)
static

Definition at line 1767 of file CcdbApi.cxx.

◆ retrieve()

TObject * o2::ccdb::CcdbApi::retrieve ( std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp 
) const

Definition at line 770 of file CcdbApi.cxx.

◆ retrieveBlob()

bool o2::ccdb::CcdbApi::retrieveBlob ( std::string const &  path,
std::string const &  targetdir,
std::map< std::string, std::string > const &  metadata,
long  timestamp,
bool  preservePathStructure = true,
std::string const &  localFileName = "snapshot.root",
std::string const &  createdNotAfter = "",
std::string const &  createdNotBefore = "" 
) const

Simple function to retrieve the blob corresponding to some path and timestamp. Saves the blob locally to a binary file with the following properties: a) The base destination directory is given by "targetdir" (will be created if not present) b) If preservePathStructure == true; Additional sub-folders corresponding to "path" will be created inside "targetdir". c) The filename on disc will be determined by localFileName, or in case localFilename="" from the filename returned by CCDB meta data.

Returns
: True in case operation successful or false if there was a failure/problem.

Definition at line 815 of file CcdbApi.cxx.

◆ retrieveFromTFile() [1/2]

TObject * o2::ccdb::CcdbApi::retrieveFromTFile ( std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp,
std::map< std::string, std::string > *  headers,
std::string const &  etag,
const std::string &  createdNotAfter,
const std::string &  createdNotBefore 
) const

Definition at line 808 of file CcdbApi.cxx.

◆ retrieveFromTFile() [2/2]

void * o2::ccdb::CcdbApi::retrieveFromTFile ( std::type_info const &  tinfo,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp = -1,
std::map< std::string, std::string > *  headers = nullptr,
std::string const &  etag = "",
const std::string &  createdNotAfter = "",
const std::string &  createdNotBefore = "" 
) const

A generic helper implementation to query obj whose type is given by a std::type_info

Returns
0 -> ok, positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html), -1 : object bigger than maxSize, -2 : curl initialization error

Definition at line 1113 of file CcdbApi.cxx.

◆ retrieveFromTFileAny() [1/2]

template<typename T >
std::enable_if< std::is_base_of< o2::conf::ConfigurableParam, T >::value, T * >::type o2::ccdb::CcdbApi::retrieveFromTFileAny ( std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp = -1,
std::map< std::string, std::string > *  headers = nullptr,
std::string const &  etag = "",
const std::string &  createdNotAfter = "",
const std::string &  createdNotBefore = "" 
) const

Retrieve object at the given path for the given timestamp.

Parameters
pathThe path where the object is to be found.
metadataKey-values representing the metadata to filter out objects.
timestampTimestamp of the object to retrieve. If omitted, current timestamp is used.
headersMap to be populated with the headers we received, if it is not null.
optionaletag from previous call
optionalcreatedNotAfter upper time limit for the object creation timestamp (TimeMachine mode)
optionalcreatedNotBefore lower time limit for the object creation timestamp (TimeMachine mode)
Returns
the object, or nullptr if none were found or type does not match serialized type.

Definition at line 660 of file CcdbApi.h.

◆ retrieveFromTFileAny() [2/2]

template<typename T >
std::enable_if< std::is_base_of< o2::conf::ConfigurableParam, T >::value, T * >::type o2::ccdb::CcdbApi::retrieveFromTFileAny ( std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp = -1,
std::map< std::string, std::string > *  headers = nullptr,
std::string const &  etag = "",
const std::string &  createdNotAfter = "",
const std::string &  createdNotBefore = "" 
) const

◆ retrieveHeaders()

std::map< std::string, std::string > o2::ccdb::CcdbApi::retrieveHeaders ( std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp = -1 
) const

Retrieve the headers of a CCDB entry, if it exists.

Parameters
pathThe path where the object is to be found.
metadataKey-values representing the metadata to filter out objects.
timestampTimestamp of the object to retrieve. If omitted, current timestamp is used.
Returns
A map containing the headers. The map is empty if no CCDB entry can be found.

Definition at line 1416 of file CcdbApi.cxx.

◆ retrieveMetaInfo()

std::map< std::string, std::string > * o2::ccdb::CcdbApi::retrieveMetaInfo ( TFile &  file)
static

Extracts meta-information associated to the CCDB blob sitting in given TFile.

Definition at line 1553 of file CcdbApi.cxx.

◆ retrieveQueryInfo()

CCDBQuery * o2::ccdb::CcdbApi::retrieveQueryInfo ( TFile &  file)
static

Extracts meta-information of the query from a TFile containing the CCDB blob.

Definition at line 1544 of file CcdbApi.cxx.

◆ runDownloaderLoop()

void o2::ccdb::CcdbApi::runDownloaderLoop ( bool  noWait)

Run the uvLoop belonging to mDownloader once.

Parameters
noWaitUsing this flag will cause the loop to run only if sockets have pendind data.

Definition at line 267 of file CcdbApi.cxx.

◆ saveSnapshot()

void o2::ccdb::CcdbApi::saveSnapshot ( RequestContext requestContext) const

Definition at line 1847 of file CcdbApi.cxx.

◆ scheduleDownload()

void o2::ccdb::CcdbApi::scheduleDownload ( RequestContext requestContext,
size_t *  requestCounter 
) const

Definition at line 1674 of file CcdbApi.cxx.

◆ setCurlRetriesParameters()

void o2::ccdb::CcdbApi::setCurlRetriesParameters ( int  numberRetries,
int  delay = 100000 
)
inline

Set the number of times curl should retry in case of failure and the delay between thte attempts.

Parameters
numberRetries
delay

Definition at line 538 of file CcdbApi.h.

◆ snapshot()

void o2::ccdb::CcdbApi::snapshot ( std::string const &  ccdbrootpath,
std::string const &  localDir,
long  timestamp 
) const

Make a local snapshot of all valid objects, given a timestamp, of the CCDB under a given local path. This is doing a recursive list and fetching the files locally.

Definition at line 867 of file CcdbApi.cxx.

◆ storeAsBinaryFile()

int o2::ccdb::CcdbApi::storeAsBinaryFile ( const char buffer,
size_t  size,
const std::string &  fileName,
const std::string &  objectType,
const std::string &  path,
const std::map< std::string, std::string > &  metadata,
long  startValidityTimestamp,
long  endValidityTimestamp,
std::vector< char >::size_type  maxSize = 0 
) const

A generic method to store a binary buffer (e.g. an image of the TMemFile)

Returns
0 -> ok, positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html), -1 : object bigger than maxSize, -2 : curl initialization error

Definition at line 351 of file CcdbApi.cxx.

◆ storeAsTFile()

int o2::ccdb::CcdbApi::storeAsTFile ( const TObject rootObject,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  startValidityTimestamp = -1,
long  endValidityTimestamp = -1,
std::vector< char >::size_type  maxSize = 0 
) const

Store into the CCDB a TFile containing the ROOT object.

Parameters
rootObjectRaw pointer to the object to store.
pathThe path where the object is going to be stored.
metadataKey-values representing the metadata for this object.
startValidityTimestampStart of validity. If omitted, current timestamp is used.
endValidityTimestampEnd of validity. If omitted, current timestamp + 1 day is used.
Returns
0 -> ok, positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html), -1 : object bigger than maxSize, -2 : curl initialization error

Definition at line 466 of file CcdbApi.cxx.

◆ storeAsTFile_impl()

int o2::ccdb::CcdbApi::storeAsTFile_impl ( const void obj1,
std::type_info const &  info,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  startValidityTimestamp = -1,
long  endValidityTimestamp = -1,
std::vector< char >::size_type  maxSize = 0 
) const

A generic helper implementation to store an obj whose type is given by a std::type_info

Returns
0 -> ok, positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html), -1 : object bigger than maxSize, -2 : curl initialization error

Definition at line 335 of file CcdbApi.cxx.

◆ storeAsTFileAny() [1/2]

template<typename T >
int o2::ccdb::CcdbApi::storeAsTFileAny ( const T *  obj,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  startValidityTimestamp = -1,
long  endValidityTimestamp = -1,
std::vector< char >::size_type  maxSize = 0 
) const
inline

Store into the CCDB a TFile containing an object of type T (which needs to have a ROOT dictionary)

Parameters
objRaw pointer to the object to store.
pathThe path where the object is going to be stored.
metadataKey-values representing the metadata for this object.
startValidityTimestampStart of validity. If omitted, current timestamp is used.
endValidityTimestampEnd of validity. If omitted, current timestamp + 1 day is used.
Returns
0 -> ok, positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html), -1 : object bigger than maxSize, -2 : curl initialization error

Definition at line 157 of file CcdbApi.h.

◆ storeAsTFileAny() [2/2]

int o2::ccdb::CcdbApi::storeAsTFileAny ( const TObject rootobj,
std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  startValidityTimestamp = -1,
long  endValidityTimestamp = -1,
std::vector< char >::size_type  maxSize = 0 
) const
inline

Definition at line 164 of file CcdbApi.h.

◆ truncate()

void o2::ccdb::CcdbApi::truncate ( std::string const &  path) const

Delete all versions of the object at this path.

Todo:
Raise an exception if no such object exist.
Parameters
path

Definition at line 1270 of file CcdbApi.cxx.

◆ updateMetadata()

int o2::ccdb::CcdbApi::updateMetadata ( std::string const &  path,
std::map< std::string, std::string > const &  metadata,
long  timestamp,
std::string const &  id = "",
long  newEOV = 0 
)

Update the metadata of the object defined by the provided timestamp, and id if provided.

Parameters
pathPath to the object to update
metadataThe metadata to update
timestampThe timestamp to select the object
idThe id, if any, to select the object
Returns
anithing non-0 is CURL error code or -1

Definition at line 1599 of file CcdbApi.cxx.

◆ vectoredLoadFileToMemory()

void o2::ccdb::CcdbApi::vectoredLoadFileToMemory ( std::vector< RequestContext > &  requestContext) const

Retrieves files described via RequestContexts into memory. Downloads are performed in parallel via CCDBDownloader.

Parameters
requestContextStructure giving details about the transfer.

Definition at line 1941 of file CcdbApi.cxx.

Member Data Documentation

◆ CCDBMETA_ENTRY

constexpr const char* o2::ccdb::CcdbApi::CCDBMETA_ENTRY = "ccdb_meta"
staticconstexpr

Definition at line 336 of file CcdbApi.h.

◆ CCDBOBJECT_ENTRY

constexpr const char* o2::ccdb::CcdbApi::CCDBOBJECT_ENTRY = "ccdb_object"
staticconstexpr

Definition at line 337 of file CcdbApi.h.

◆ CCDBQUERY_ENTRY

constexpr const char* o2::ccdb::CcdbApi::CCDBQUERY_ENTRY = "ccdb_query"
staticconstexpr

Definition at line 335 of file CcdbApi.h.


The documentation for this class was generated from the following files: