Module: Dbwatcher::Storage
- Defined in:
- lib/dbwatcher/storage.rb,
lib/dbwatcher/storage/errors.rb,
lib/dbwatcher/storage/session.rb,
lib/dbwatcher/storage/date_helper.rb,
lib/dbwatcher/storage/api/base_api.rb,
lib/dbwatcher/storage/base_storage.rb,
lib/dbwatcher/storage/file_manager.rb,
lib/dbwatcher/storage/null_session.rb,
lib/dbwatcher/storage/api/query_api.rb,
lib/dbwatcher/storage/api/table_api.rb,
lib/dbwatcher/storage/query_storage.rb,
lib/dbwatcher/storage/session_query.rb,
lib/dbwatcher/storage/table_storage.rb,
lib/dbwatcher/storage/api/session_api.rb,
lib/dbwatcher/storage/query_validator.rb,
lib/dbwatcher/storage/session_storage.rb,
lib/dbwatcher/storage/change_processor.rb,
lib/dbwatcher/storage/session_operations.rb,
lib/dbwatcher/storage/system_info_storage.rb,
lib/dbwatcher/storage/concerns/validatable.rb,
lib/dbwatcher/storage/concerns/error_handler.rb,
lib/dbwatcher/storage/concerns/timestampable.rb,
lib/dbwatcher/storage/concerns/data_normalizer.rb,
lib/dbwatcher/storage/api/concerns/table_analyzer.rb
Overview
Storage module provides the main interface for database monitoring data persistence
This module acts as a facade for different storage backends and provides clean API entry points for sessions, queries, and tables. It manages storage instances and provides cleanup operations.
Defined Under Namespace
Modules: Api, Concerns, DateHelper, ErrorHandler Classes: BaseStorage, ChangeProcessor, CorruptedDataError, FileManager, NullSession, PermissionError, QueryNotFoundError, QueryStorage, QueryValidator, Session, SessionNotFoundError, SessionOperations, SessionQuery, SessionStorage, StorageError, SystemInfoStorage, TableNotFoundError, TableStorage, ValidationError
Class Method Summary collapse
-
.cleanup_old_sessions ⇒ void
Removes old session files based on configuration.
-
.clear_all ⇒ Integer
Clears all storage data.
-
.queries ⇒ QueryAPI
Provides access to query operations.
-
.query_storage ⇒ QueryStorage
private
Returns the query storage instance.
-
.reset_storage_instances! ⇒ void
Resets all cached storage instances (primarily for testing).
-
.session_storage ⇒ SessionStorage
private
Returns the session storage instance.
-
.sessions ⇒ SessionAPI
Provides access to session operations.
-
.system_info ⇒ SystemInfoStorage
Provides access to system information operations.
-
.table_storage ⇒ TableStorage
private
Returns the table storage instance.
-
.tables ⇒ TableAPI
Provides access to table operations.
Class Method Details
.cleanup_old_sessions ⇒ void
This method returns an undefined value.
Removes old session files based on configuration
Automatically removes session files that exceed the configured retention period. This helps manage storage space usage.
109 110 111 |
# File 'lib/dbwatcher/storage.rb', line 109 def cleanup_old_sessions session_storage.cleanup_old_sessions end |
.clear_all ⇒ Integer
Clears all storage data
142 143 144 145 146 |
# File 'lib/dbwatcher/storage.rb', line 142 def clear_all session_count = session_storage.clear_all query_count = query_storage.clear_all session_count + query_count end |
.queries ⇒ QueryAPI
Provides access to query operations
58 59 60 |
# File 'lib/dbwatcher/storage.rb', line 58 def queries @queries ||= Api::QueryAPI.new(query_storage) end |
.query_storage ⇒ QueryStorage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the query storage instance
127 128 129 |
# File 'lib/dbwatcher/storage.rb', line 127 def query_storage @query_storage ||= QueryStorage.new end |
.reset_storage_instances! ⇒ void
This method returns an undefined value.
Resets all cached storage instances (primarily for testing)
This method clears all memoized storage instances, forcing them to be recreated on next access. Useful for testing scenarios.
90 91 92 93 94 95 96 97 98 |
# File 'lib/dbwatcher/storage.rb', line 90 def reset_storage_instances! @session_storage = nil @query_storage = nil @table_storage = nil @system_info = nil @sessions = nil @queries = nil @tables = nil end |
.session_storage ⇒ SessionStorage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the session storage instance
119 120 121 |
# File 'lib/dbwatcher/storage.rb', line 119 def session_storage @session_storage ||= SessionStorage.new end |
.sessions ⇒ SessionAPI
Provides access to session operations
48 49 50 |
# File 'lib/dbwatcher/storage.rb', line 48 def sessions @sessions ||= Api::SessionAPI.new(session_storage) end |
.system_info ⇒ SystemInfoStorage
Provides access to system information operations
78 79 80 |
# File 'lib/dbwatcher/storage.rb', line 78 def system_info @system_info ||= SystemInfoStorage.new end |
.table_storage ⇒ TableStorage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the table storage instance
135 136 137 |
# File 'lib/dbwatcher/storage.rb', line 135 def table_storage @table_storage ||= TableStorage.new(session_storage) end |