Make database connection lazy and adjust config execution order

This commit is contained in:
2025-08-21 15:00:10 +03:00
parent f4fefb3391
commit d26587cfc3
8 changed files with 129 additions and 173 deletions

View File

@@ -25,13 +25,13 @@ import DataLiteCore
public protocol DatabaseServiceKeyProvider: AnyObject, Sendable {
/// Returns the encryption key for the specified database service.
///
/// May return `nil` if the encryption key is currently unavailable or if the database
/// does not require encryption.
/// This method must either return a valid encryption key or throw an error if
/// the key cannot be retrieved.
///
/// - Parameter service: The service requesting the key.
/// - Returns: The encryption key or `nil`.
/// - Returns: The encryption key.
/// - Throws: An error if the key cannot be retrieved.
func databaseService(keyFor service: DatabaseServiceProtocol) throws -> Connection.Key?
func databaseService(keyFor service: DatabaseServiceProtocol) throws -> Connection.Key
/// Indicates whether the service should attempt to reconnect if applying the key fails.
///