/// <summary>Faults if exception is provided, otherwise calls through to decorated storage provider.</summary> /// <param name="grainType">Type of this grain [fully qualified class name]</param> /// <param name="grainReference">Grain reference object for this grain.</param> /// <param name="grainState">Copy of last-known state data object for this grain.</param> /// <returns>Completion promise for the Delete operation on the specified grain.</returns> public async Task ClearStateAsync <T>(string grainType, GrainReference grainReference, IGrainState <T> grainState) { IStorageFaultGrain faultGrain = grainFactory.GetGrain <IStorageFaultGrain>(grainType); try { await InsertDelay(); await faultGrain.OnClear(grainReference); } catch (Exception) { logger.LogInformation( "Fault injected for ClearState for grain {GrainId} of type {GrainType}", grainReference.GrainId, grainType); throw; } logger.LogInformation( "ClearState for grain {GrainId} of type {GrainType}", grainReference.GrainId, grainType); await realStorageProvider.ClearStateAsync(grainType, grainReference, grainState); }
/// <summary>Faults if exception is provided, otherwise calls through to decorated storage provider.</summary> /// <param name="grainType">Type of this grain [fully qualified class name]</param> /// <param name="grainReference">Grain reference object for this grain.</param> /// <param name="grainState">Copy of last-known state data object for this grain.</param> /// <returns>Completion promise for the Delete operation on the specified grain.</returns> public async Task ClearStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) { IStorageFaultGrain faultGrain = grainFactory.GetGrain <IStorageFaultGrain>(grainType); try { await faultGrain.OnClear(grainReference); } catch (Exception) { Log.Info($"Fault injected for ClearState for grain {grainReference} of type {grainType}"); throw; } Log.Info($"ClearState for grain {grainReference} of type {grainType}"); await realStorageProvider.ClearStateAsync(grainType, grainReference, grainState); }