updated docs
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
eb911a5000
commit
9a6b91b75b
@ -268,7 +268,9 @@ try await StorageRouter.shared.forceMigration(for: StorageKey.modernToken)
|
|||||||
#### Automated Startup Sweep
|
#### Automated Startup Sweep
|
||||||
When registering a catalog, you can enable `migrateImmediately` to perform a global sweep of all legacy keys for every key in the catalog.
|
When registering a catalog, you can enable `migrateImmediately` to perform a global sweep of all legacy keys for every key in the catalog.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!IMPORTANT]
|
||||||
|
> **Catalog Enforcement**: Once any catalog is registered, *all* storage operations require the key to be in a registered catalog. Any unregistered key will throw `StorageError.unregisteredKey`.
|
||||||
|
>
|
||||||
> **Modular Registration**: `registerCatalog` is additive. You can call it multiple times from different modules to build an aggregate registry. The library will throw an error if multiple catalogs attempt to register the same key name.
|
> **Modular Registration**: `registerCatalog` is additive. You can call it multiple times from different modules to build an aggregate registry. The library will throw an error if multiple catalogs attempt to register the same key name.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
|
|||||||
@ -35,6 +35,10 @@ await StorageRouter.shared.updateStorageConfiguration(storageConfig)
|
|||||||
|
|
||||||
Catalogs are mandatory if you want auditing and duplicate detection.
|
Catalogs are mandatory if you want auditing and duplicate detection.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Once any catalog is registered, *all* storage operations require the key to be present in a registered catalog.
|
||||||
|
> Unregistered keys will throw `StorageError.unregisteredKey`.
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
struct AuthCatalog: StorageKeyCatalog {
|
struct AuthCatalog: StorageKeyCatalog {
|
||||||
let allKeys: [AnyStorageKey] = [
|
let allKeys: [AnyStorageKey] = [
|
||||||
|
|||||||
@ -18,6 +18,10 @@ Catalog registration enforces correctness:
|
|||||||
- Duplicate key names across catalogs are rejected.
|
- Duplicate key names across catalogs are rejected.
|
||||||
- Unregistered keys throw ``StorageError/unregisteredKey(_:)`` at runtime.
|
- Unregistered keys throw ``StorageError/unregisteredKey(_:)`` at runtime.
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Once any catalog is registered, *all* storage operations require keys to be registered.
|
||||||
|
> If you add a new module or feature, you must register its catalog before using its keys.
|
||||||
|
|
||||||
If you skip catalog registration, LocalData cannot guarantee that all writes are auditable.
|
If you skip catalog registration, LocalData cannot guarantee that all writes are auditable.
|
||||||
|
|
||||||
## Modular catalogs
|
## Modular catalogs
|
||||||
|
|||||||
@ -89,7 +89,10 @@ public actor StorageRouter: StorageProviding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Registers a catalog of known storage keys for audit and validation.
|
/// Registers a catalog of known storage keys for audit and validation.
|
||||||
/// When registered, all storage operations will verify keys are listed.
|
///
|
||||||
|
/// - Important: Once any catalog is registered, *all* storage operations require keys
|
||||||
|
/// to be present in a registered catalog. Unregistered keys throw
|
||||||
|
/// ``StorageError/unregisteredKey(_:)``.
|
||||||
/// - Parameters:
|
/// - Parameters:
|
||||||
/// - catalog: The catalog type to register.
|
/// - catalog: The catalog type to register.
|
||||||
/// - migrateImmediately: If true, triggers a proactive migration (sweep) for all keys in the catalog.
|
/// - migrateImmediately: If true, triggers a proactive migration (sweep) for all keys in the catalog.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user