MigratingStorage
extension MoEngageStorage.MigratingStorage: MoEngageStorage.ReadOnlyLocation
extension MoEngageStorage.MigratingStorage: MoEngageStorage.MigratableLocation
extension MoEngageStorage.MigratingStorage: MoEngageStorage.WriteOnlyLocation where ReadInput == Void
-
Reads from the primary location; consults the migration chain when needed.
When a migration value is found it is saved to the primary location via
try?(write-back failures are silently suppressed), and all traversed legacy locations are cleaned up. If the primary read fails,PrimaryReadErroris rethrown directly to the caller.Throws
PrimaryReadErrorwhen the primary read fails.Declaration
Swift
public func read( withInput input: ReadInput, fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(ReadError) -> ValueParameters
inputUnused (
Void).sdkInstanceThe isolated SDK instance to read from.
Return Value
The stored value.
-
Removes the value from all chain entries, then from the primary location.
Chain removals are silently suppressed via
try?. Only the primary removal can surface an error. WhenprimaryRemoveisnilthis is a no-op after chain clean-up.Throws
PrimaryRemoveErrorwhen the primary removal fails.Declaration
Swift
public func remove( fromInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(RemoveError) -> RemoveOutputParameters
sdkInstanceThe isolated SDK instance to remove from.
-
Writes directly to the primary location.
When
primaryWriteisnil(primary has no write capability) this is a no-op.Throws
PrimaryWriteErrorwhen the primary write fails.Declaration
Swift
public func write( _ value: Value, toInstance sdkInstance: isolated MoEngageSDKInstance = #isolation ) throws(WriteError) -> WriteOutputParameters
valueThe value to persist.
sdkInstanceThe isolated SDK instance to write to.