2424#include < TObject.h>
2525#include < TMessage.h>
2626#include " CCDB/CcdbObjectInfo.h"
27+ #include " CCDB/CCDBDownloader.h"
2728#include < CommonUtils/ConfigurableParam.h>
2829#include < type_traits>
2930#include < vector>
3031
3132#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
3233#include " MemoryResources/MemoryResources.h"
33- #include < boost/interprocess/sync/named_semaphore.hpp>
3434#include < TJAlienCredentials.h>
3535#else
3636class TJAlienCredentials ;
3737#endif
3838
39- #include " CCDB/CCDBDownloader.h"
40-
4139class TFile ;
4240class TGrid ;
4341
@@ -344,43 +342,14 @@ class CcdbApi //: public DatabaseInterface
344342 TObject* retrieveFromTFile (std::string const & path, std::map<std::string, std::string> const & metadata, long timestamp,
345343 std::map<std::string, std::string>* headers, std::string const & etag,
346344 const std::string& createdNotAfter, const std::string& createdNotBefore) const ;
345+
347346#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__ROOTCLING__) && !defined(__CLING__)
348- typedef struct RequestContext {
349- o2::pmr::vector<char >& dest;
350- std::string path;
351- std::map<std::string, std::string> const & metadata;
352- long timestamp;
353- std::map<std::string, std::string>& headers;
354- std::string etag;
355- std::string createdNotAfter;
356- std::string createdNotBefore;
357- bool considerSnapshot;
358-
359- RequestContext (o2::pmr::vector<char >& d,
360- std::map<std::string, std::string> const & m,
361- std::map<std::string, std::string>& h)
362- : dest(d), metadata(m), headers(h) {}
363- } RequestContext;
364-
365- // Stores file associated with requestContext as a snapshot.
366- void saveSnapshot (RequestContext& requestContext) const ;
367-
368- // Schedules download via CCDBDownloader, but doesn't perform it until mUVLoop is ran.
369- void scheduleDownload (RequestContext& requestContext, size_t * requestCounter) const ;
370-
371- void getFromSnapshot (bool createSnapshot, std::string const & path,
372- long timestamp, std::map<std::string, std::string> headers,
373- std::string& snapshotpath, o2::pmr::vector<char >& dest, int & fromSnapshot, std::string const & etag) const ;
374- void releaseNamedSemaphore (boost::interprocess::named_semaphore* sem, std::string path) const ;
375- boost::interprocess::named_semaphore* createNamedSempahore (std::string path) const ;
376347 void loadFileToMemory (o2::pmr::vector<char >& dest, const std::string& path, std::map<std::string, std::string>* localHeaders = nullptr ) const ;
377348 void loadFileToMemory (o2::pmr::vector<char >& dest, std::string const & path,
378349 std::map<std::string, std::string> const & metadata, long timestamp,
379350 std::map<std::string, std::string>* headers, std::string const & etag,
380351 const std::string& createdNotAfter, const std::string& createdNotBefore, bool considerSnapshot = true ) const ;
381-
382- // Loads files from alien and cvmfs into given destination.
383- bool loadLocalContentToMemory (o2::pmr::vector<char >& dest, std::string& url) const ;
352+ void navigateURLsAndLoadFileToMemory (o2::pmr::vector<char >& dest, CURL* curl_handle, std::string const & url, std::map<string, string>* headers) const ;
384353
385354 // the failure to load the file to memory is signaled by 0 size and non-0 capacity
386355 static bool isMemoryFileInvalid (const o2::pmr::vector<char >& v) { return v.size () == 0 && v.capacity () > 0 ; }
@@ -395,36 +364,12 @@ class CcdbApi //: public DatabaseInterface
395364 }
396365 return obj;
397366 }
398-
399- /* *
400- * Retrieves files either as snapshot or schedules them to be downloaded via CCDBDownloader.
401- *
402- * @param requestContext Structure giving details about the transfer.
403- * @param fromSnapshot After navigateSourcesAndLoadFile returns signals whether file was retrieved from snapshot.
404- * @param requestCounter Pointer to the variable storing the number of requests to be done.
405- */
406- void navigateSourcesAndLoadFile (RequestContext& requestContext, int & fromSnapshot, size_t * requestCounter) const ;
407-
408- /* *
409- * Retrieves files described via RequestContexts into memory. Downloads are performed in parallel via CCDBDownloader.
410- *
411- * @param requestContext Structure giving details about the transfer.
412- */
413- void vectoredLoadFileToMemory (std::vector<RequestContext>& requestContext) const ;
414367#endif
415368
416369 private:
417370 // Sets the unique agent ID
418371 void setUniqueAgentID ();
419372
420- /* *
421- * Schedules download of data associated with the curl_handle. Doing that increments the requestCounter by 1. Requests are performed by running the mUVLoop
422- *
423- * @param handle CURL handle associated with the request.
424- * @param requestCounter Pointer to the variable storing the number of requests to be done.
425- */
426- void asynchPerform (CURL* handle, size_t * requestCounter) const ;
427-
428373 // internal helper function to update a CCDB file with meta information
429374 static void updateMetaInformationInLocalFile (std::string const & filename, std::map<std::string, std::string> const * headers, CCDBQuery const * querysummary = nullptr );
430375
@@ -605,7 +550,7 @@ class CcdbApi //: public DatabaseInterface
605550 CURLcode CURL_perform (CURL* handle) const ;
606551
607552 mutable CCDBDownloader* mDownloader = nullptr ; // ! the multi-handle (async) CURL downloader
608- bool mIsCCDBDownloaderPreferred = false ;
553+ bool mIsCCDBDownloaderEnabled = false ;
609554 // / Base URL of the CCDB (with port)
610555 std::string mUniqueAgentID {}; // Unique User-Agent ID communicated to server for logging
611556 std::string mUrl {};
0 commit comments