|
ORE Studio 0.0.4
|
Service for accessing well-known system flags with type-safe methods. More...
#include <system_flags_service.hpp>

Public Member Functions | |
| system_flags_service (database::context ctx) | |
| Constructs a system_flags_service. | |
| void | refresh () |
| Refreshes the cache by reading all system flags from the database. | |
| const domain::system_flags_cache & | cache () const |
| Gets a const reference to the cached system flags. | |
| bool | is_enabled (domain::system_flag flag) const |
| Checks if a system flag is enabled (from cache). | |
| void | set_enabled (domain::system_flag flag, bool enabled, std::string_view recorded_by) |
| Sets a system flag's enabled state. | |
| bool | is_bootstrap_mode_enabled () const |
| Checks if the system is in bootstrap mode (from cache). | |
| void | set_bootstrap_mode (bool enabled, std::string_view recorded_by) |
| Sets the bootstrap mode state. | |
| bool | is_user_signups_enabled () const |
| Checks if user self-registration (signups) is enabled (from cache). | |
| void | set_user_signups (bool enabled, std::string_view recorded_by) |
| Sets the user signups state. | |
Service for accessing well-known system flags with type-safe methods.
This service provides a typed interface for querying and modifying system flags. Unlike feature_flags_service which works with arbitrary flag names, this service only handles the predefined system flags enumerated in domain::system_flag.
The service maintains an internal cache of flag values for fast access. The cache is populated on first access or via explicit refresh(). Write operations automatically update the cache after persisting to database.
The service wraps feature_flags_service internally and translates between the system_flag enum and the underlying string-based storage.
|
explicit |
Constructs a system_flags_service.
| ctx | The database context to be used by the underlying repository. |
| void refresh | ( | ) |
Refreshes the cache by reading all system flags from the database.
Call this at startup after system_flags_seeder has run, or when you need to ensure the cache reflects the latest database state.

| const domain::system_flags_cache & cache | ( | ) | const |
Gets a const reference to the cached system flags.
This provides fast, read-only access to the cached flag values without database queries. The cache must be populated via refresh() first.
| bool is_enabled | ( | domain::system_flag | flag | ) | const |
Checks if a system flag is enabled (from cache).
Returns the cached value. Call refresh() first to populate the cache.
| flag | The system flag to check. |
| void set_enabled | ( | domain::system_flag | flag, |
| bool | enabled, | ||
| std::string_view | recorded_by | ||
| ) |
Sets a system flag's enabled state.
Persists to database and updates the cache.
| flag | The system flag to modify. |
| enabled | The new enabled state. |
| recorded_by | Username of the user making the change. |

| bool is_bootstrap_mode_enabled | ( | ) | const |
Checks if the system is in bootstrap mode (from cache).

| void set_bootstrap_mode | ( | bool | enabled, |
| std::string_view | recorded_by | ||
| ) |
Sets the bootstrap mode state.
Persists to database and updates the cache.
| enabled | The new bootstrap mode state. |
| recorded_by | Username of the user making the change. |

| bool is_user_signups_enabled | ( | ) | const |
Checks if user self-registration (signups) is enabled (from cache).
| void set_user_signups | ( | bool | enabled, |
| std::string_view | recorded_by | ||
| ) |
Sets the user signups state.
Persists to database and updates the cache.
| enabled | The new user signups state. |
| recorded_by | Username of the user making the change. |