![]()  | 
  
    MySQL 8.4.7
    
   Source Code Documentation 
   | 
 
DynamicState represents a MySQLRouter dynamic state object. More...
#include <dynamic_state.h>
Classes | |
| struct | Pimpl | 
Public Member Functions | |
| DynamicState (const std::string &file_name) | |
| Creates and initializes dynamic state object.  More... | |
| ~DynamicState () | |
| Destructor.  More... | |
| bool | load () | 
| Loads the json state object from the associated file, overwrites the current with the file content.  More... | |
| bool | save (bool is_clusterset, bool pretty=true) | 
| Saves the json state object to the associated file, overwrites the the file content.  More... | |
| bool | save_to_stream (std::ostream &output_stream, bool is_clusterset, bool pretty=true) | 
| Saves the json state object to the output stream given as a parameter, overwrites the stream content.  More... | |
| std::unique_ptr< JsonValue > | get_section (const std::string §ion_name) | 
| Returns selected state object section by its name.  More... | |
| bool | update_section (const std::string §ion_name, JsonValue &&value) | 
| Updates selected state object section.  More... | |
Private Member Functions | |
| bool | load_from_stream (std::istream &input_stream) | 
| void | ensure_valid_against_schema () | 
| void | ensure_version_compatibility () | 
| std::ifstream | open_for_read () | 
| std::ofstream | open_for_write () | 
Private Attributes | |
| std::unique_ptr< Pimpl > | pimpl_ | 
| std::string | file_name_ | 
| std::string | tmp_file_name_ | 
DynamicState represents a MySQLRouter dynamic state object.
It's meant to be used as a singleton that provides methods to read/update sections from the specific modules requiring saving their runtime state.
It handles the file handling synchronization, versioning and validation.
| mysql_harness::DynamicState::DynamicState | ( | const std::string & | file_name | ) | 
Creates and initializes dynamic state object.
| file_name | path to the json file where the state is being stored | 
      
  | 
  default | 
Destructor.
      
  | 
  private | 
      
  | 
  private | 
| std::unique_ptr< JsonValue > mysql_harness::DynamicState::get_section | ( | const std::string & | section_name | ) | 
Returns selected state object section by its name.
| section_name | name of the section to retrieve | 
| bool mysql_harness::DynamicState::load | ( | ) | 
Loads the json state object from the associated file, overwrites the current with the file content.
| true | operation succeeded | 
| false | operation failed | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private | 
| bool mysql_harness::DynamicState::save | ( | bool | is_clusterset, | 
| bool | pretty = true  | 
        ||
| ) | 
Saves the json state object to the associated file, overwrites the the file content.
| is_clusterset | true if the metadata is configured to work with a ClusterSet, false if a single Cluster | 
| pretty | if true the json data is written in a human readable json format | 
| true | operation succeeded | 
| false | operation failed | 
| bool mysql_harness::DynamicState::save_to_stream | ( | std::ostream & | output_stream, | 
| bool | is_clusterset, | ||
| bool | pretty = true  | 
        ||
| ) | 
Saves the json state object to the output stream given as a parameter, overwrites the stream content.
| output_stream | stream where json content should be written to | 
| is_clusterset | true if the metadata is configured to work with a ClusterSet, false if a single Cluster | 
| pretty | if true the json data is written in a human readable json format | 
| true | operation succeeded | 
| false | operation failed | 
| bool mysql_harness::DynamicState::update_section | ( | const std::string & | section_name, | 
| JsonValue && | value | ||
| ) | 
Updates selected state object section.
| section_name | name of the section to update | 
| value | rapidJson object to replaces the section value | 
| true | operation succeeded | 
| false | operation failed | 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  private |