8#ifndef CONFFWK_CONFIGURATIONIMPL_H_
9#define CONFFWK_CONFIGURATIONIMPL_H_
21class ConfigurationChange;
23class ConfigObjectImpl;
74 virtual
bool loaded() const noexcept = 0;
78 virtual
void create(const
std::
string& db_name, const
std::list<
std::
string>& includes) = 0;
106 virtual
void commit(const
std::
string& log_message) = 0;
131 virtual
void get(const
std::
string& class_name, const
std::
string&
id,
ConfigObject&
object,
unsigned long rlevel, const
std::vector<
std::
string> * rclasses) = 0;
135 virtual
void get(const
std::
string& class_name,
std::vector<
ConfigObject>& objects, const
std::
string& query,
unsigned long rlevel, const
std::vector<
std::
string> * rclasses) = 0;
143 virtual
bool test_object(const
std::
string& class_name, const
std::
string&
id,
unsigned long rlevel, const
std::vector<
std::
string> * rclasses) = 0;
230 template<class T, class OBJ>
243 static_cast<T *
>(p)->
set(obj);
247 return static_cast<T *
>(p);
253 void clean() noexcept;
279 void rename_impl_object(
const std::string * class_name,
const std::string& old_id,
const std::string& new_id)
noexcept;
Implements database objects.
dunedaq::conffwk::ObjectState m_state
Represents database objects.
Describes changes inside a class returned by the notification mechanism.
Provides pure virtual interface used by the Configuration class.
void(*) notify(std::vector< ConfigurationChange * > &changes, Configuration *)
Callback to notify database changes.
virtual bool test_object(const std::string &class_name, const std::string &id, unsigned long rlevel, const std::vector< std::string > *rclasses)=0
Test object existence (used by Python binding)
void put_impl_object(const std::string &class_name, const std::string &id, ConfigObjectImpl *obj) noexcept
put object to cache
ConfigurationImpl() noexcept
The constructor.
virtual void subscribe(const std::set< std::string > &class_names, const std::map< std::string, std::set< std::string > > &objs, notify cb, pre_notify pre_cb)=0
Subscribe on database changes.
virtual void set_commit_credentials(const std::string &user, const std::string &password)=0
Set commit credentials.
void clean() noexcept
clean cache (e.g. to be used by destructor)
virtual void close_db()=0
Close database implementation.
virtual void get_superclasses(conffwk::fmap< conffwk::fset > &schema)=0
Get inheritance hierarchy.
virtual void abort()=0
Abort database changes.
virtual void get(const std::string &class_name, const std::string &id, ConfigObject &object, unsigned long rlevel, const std::vector< std::string > *rclasses)=0
Get object of class by id.
virtual void get_includes(const std::string &db_name, std::list< std::string > &includes) const =0
Get included files.
virtual void print_profiling_info() noexcept=0
Print implementation specific profiling information.
virtual void prefetch_all_data()=0
Prefetch all data into client cache.
virtual void get_updated_dbs(std::list< std::string > &dbs) const =0
Get uncommitted files.
virtual bool is_writable(const std::string &db_name)=0
Return write access status.
std::vector< ConfigObjectImpl * > m_tangled_objects
virtual std::vector< dunedaq::conffwk::Version > get_changes()=0
Get newly available versions.
ConfigObjectImpl * get_impl_object(const std::string &class_name, const std::string &id) const noexcept
get object from cache
virtual bool loaded() const noexcept=0
Check if a database is loaded.
void rename_impl_object(const std::string *class_name, const std::string &old_id, const std::string &new_id) noexcept
rename object in cache
void(*) pre_notify(Configuration *)
Callback to pre-notify database changes.
virtual void destroy(ConfigObject &object)=0
Destroy object of class by id.
virtual void add_include(const std::string &db_name, const std::string &include)=0
Add include file.
unsigned long p_number_of_cache_hits
virtual void commit(const std::string &log_message)=0
Commit database changes.
void print_cache_info() noexcept
Print profiling information about objects in cache.
virtual std::vector< dunedaq::conffwk::Version > get_versions(const std::string &since, const std::string &until, dunedaq::conffwk::Version::QueryType type, bool skip_irrelevant)=0
Get archived versions.
virtual void remove_include(const std::string &db_name, const std::string &include)=0
Remove include file.
Configuration * m_conf
Configuration pointer is needed for notification on changes, e.g. in case of subscription or an objec...
std::mutex & get_conf_impl_mutex() const
Is required by reload methods.
virtual void create(const std::string &db_name, const std::list< std::string > &includes)=0
Create database.
conffwk::pmap< conffwk::map< ConfigObjectImpl * > * > m_impl_objects
cache of implementation objects (class-name::->object_id->implementation)
virtual void open_db(const std::string &db_name)=0
Open database implementation in accordance with given name.
virtual void unsubscribe()=0
Remove subscription on database changes.
T * insert_object(OBJ &obj, const std::string &id, const std::string &class_name) noexcept
insert new object (update cache or create-and-insert)
unsigned long p_number_of_object_read
Defines base class for cache of template objects.
Represents configuration version.
std::unordered_set< const std::string *, string_ptr_hash > fset
std::unordered_set< std::string > set