@@ -115,9 +115,13 @@ class CcdbApi //: public DatabaseInterface
115115 * @param metadata Key-values representing the metadata for this object.
116116 * @param startValidityTimestamp Start of validity. If omitted, current timestamp is used.
117117 * @param endValidityTimestamp End of validity. If omitted, current timestamp + 1 day is used.
118+ * @return 0 -> ok,
119+ * positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html),
120+ * -1 : object bigger than maxSize,
121+ * -2 : curl initialization error
118122 */
119- void storeAsTFile (const TObject* rootObject, std::string const & path, std::map<std::string, std::string> const & metadata,
120- long startValidityTimestamp = -1 , long endValidityTimestamp = -1 ) const ;
123+ int storeAsTFile (const TObject* rootObject, std::string const & path, std::map<std::string, std::string> const & metadata,
124+ long startValidityTimestamp = -1 , long endValidityTimestamp = -1 , std::vector< char >::size_type maxSize = 0 /* bytes */ ) const ;
121125
122126 /* *
123127 * Store into the CCDB a TFile containing an object of type T (which needs to have a ROOT dictionary)
@@ -127,19 +131,23 @@ class CcdbApi //: public DatabaseInterface
127131 * @param metadata Key-values representing the metadata for this object.
128132 * @param startValidityTimestamp Start of validity. If omitted, current timestamp is used.
129133 * @param endValidityTimestamp End of validity. If omitted, current timestamp + 1 day is used.
134+ * @return 0 -> ok,
135+ * positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html),
136+ * -1 : object bigger than maxSize,
137+ * -2 : curl initialization error
130138 */
131139 template <typename T>
132- void storeAsTFileAny (const T* obj, std::string const & path, std::map<std::string, std::string> const & metadata,
133- long startValidityTimestamp = -1 , long endValidityTimestamp = -1 ) const
140+ int storeAsTFileAny (const T* obj, std::string const & path, std::map<std::string, std::string> const & metadata,
141+ long startValidityTimestamp = -1 , long endValidityTimestamp = -1 , std::vector< char >::size_type maxSize = 0 /* bytes */ ) const
134142 {
135- storeAsTFile_impl (reinterpret_cast <const void *>(obj), typeid (T), path, metadata, startValidityTimestamp, endValidityTimestamp);
143+ return storeAsTFile_impl (reinterpret_cast <const void *>(obj), typeid (T), path, metadata, startValidityTimestamp, endValidityTimestamp, maxSize );
136144 }
137145
138146 // interface for storing TObject via storeAsTFileAny
139- void storeAsTFileAny (const TObject* rootobj, std::string const & path, std::map<std::string, std::string> const & metadata,
140- long startValidityTimestamp = -1 , long endValidityTimestamp = -1 ) const
147+ int storeAsTFileAny (const TObject* rootobj, std::string const & path, std::map<std::string, std::string> const & metadata,
148+ long startValidityTimestamp = -1 , long endValidityTimestamp = -1 , std::vector< char >::size_type maxSize = 0 /* bytes */ ) const
141149 {
142- storeAsTFile (rootobj, path, metadata, startValidityTimestamp, endValidityTimestamp);
150+ return storeAsTFile (rootobj, path, metadata, startValidityTimestamp, endValidityTimestamp, maxSize );
143151 }
144152
145153 /* *
@@ -392,19 +400,31 @@ class CcdbApi //: public DatabaseInterface
392400 public:
393401 /* *
394402 * A generic method to store a binary buffer (e.g. an image of the TMemFile)
403+ * @return 0 -> ok,
404+ * positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html),
405+ * -1 : object bigger than maxSize,
406+ * -2 : curl initialization error
395407 */
396- void storeAsBinaryFile (const char * buffer, size_t size, const std::string& fileName, const std::string& objectType,
397- const std::string& path, const std::map<std::string, std::string>& metadata,
398- long startValidityTimestamp, long endValidityTimestamp) const ;
408+ int storeAsBinaryFile (const char * buffer, size_t size, const std::string& fileName, const std::string& objectType,
409+ const std::string& path, const std::map<std::string, std::string>& metadata,
410+ long startValidityTimestamp, long endValidityTimestamp, std::vector< char >::size_type maxSize = 0 /* in bytes */ ) const ;
399411
400412 /* *
401413 * A generic helper implementation to store an obj whose type is given by a std::type_info
414+ * @return 0 -> ok,
415+ * positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html),
416+ * -1 : object bigger than maxSize,
417+ * -2 : curl initialization error
402418 */
403- void storeAsTFile_impl (const void * obj1, std::type_info const & info, std::string const & path, std::map<std::string, std::string> const & metadata,
404- long startValidityTimestamp = -1 , long endValidityTimestamp = -1 ) const ;
419+ int storeAsTFile_impl (const void * obj1, std::type_info const & info, std::string const & path, std::map<std::string, std::string> const & metadata,
420+ long startValidityTimestamp = -1 , long endValidityTimestamp = -1 , std::vector< char >::size_type maxSize = 0 /* in bytes */ ) const ;
405421
406422 /* *
407423 * A generic helper implementation to query obj whose type is given by a std::type_info
424+ * @return 0 -> ok,
425+ * positive number -> curl error (https://curl.se/libcurl/c/libcurl-errors.html),
426+ * -1 : object bigger than maxSize,
427+ * -2 : curl initialization error
408428 */
409429 void * retrieveFromTFile (std::type_info const &, std::string const & path, std::map<std::string, std::string> const & metadata,
410430 long timestamp = -1 , std::map<std::string, std::string>* headers = nullptr , std::string const & etag = " " ,
0 commit comments