// MagdaFileCatalog.h #ifndef dset__MagdaFileCatalog_H #define dset__MagdaFileCatalog_H #include "dataset_file/FileCatalog.h" #include namespace mysqlpp { class Connection; } namespace dset { class MagdaFileCatalog : public FileCatalog { public: // typedefs typedef FileCatalog::Name Name; typedef std::string Host; typedef std::string string; private: // data mysqlpp::Connection* m_connection; Host m_host; std::string m_cache; public: // Static functions // Catalog type. static Name static_type() { return "MagdaFileCatalog"; } // Catalog type. static Name static_url_scheme() { return "lfn"; } // Return the single instance of this class. static MagdaFileCatalog& instance(); private: // Hidden function. // Constructor. MagdaFileCatalog(); // Message void message(string msg) const; // All sites associated with the host string allsites() const; // The store type string storetype(string site) const; public: // Virtual functions // Destructor. ~MagdaFileCatalog(); // Return the catalog type. Name type() const; // Return the catalog name. Name name() const; // Return whether a file appears in the catalog. // True if get(id) return a name. bool has(Url lurl); // GUID. Fails. Url guid(Url lurl); // LFN. Url lfn(Url lurl); // Fetch a physical file replica corresponding // to the given ID. // File must exist and be readable. // Returns blank for failure. UrlList replicas(Url lurl); // Put a file in the catalog. // Input is the name of an existing physical file. // File must exist and be readable. // The location name lname is ignored. // The lifetime ltime is ignored. // A valid ID is returned if successful. Url insert(Url purl, Url lurl =Url(), Time ltime =0); // Remove. int remove(Url lurl, Url purl, bool remlog); }; } // end namespace dset #endif