-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
684d71f
commit 941553f
Showing
9 changed files
with
295 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
Source/Orleans.StorageProviderInterceptors/GrainStorageInterceptorProxy{TIInterceptor}.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
namespace Orleans.StorageProviderInterceptors; | ||
|
||
using System.Threading.Tasks; | ||
using Orleans; | ||
using Orleans.Runtime; | ||
using Orleans.Storage; | ||
|
||
/// <summary> | ||
/// GrainStorageInterceptorProxy is responsable for performing the interception of the given storage provider. | ||
/// </summary> | ||
public class GrainStorageInterceptorProxy : IGrainStorage, ILifecycleParticipant<ISiloLifecycle> | ||
{ | ||
private readonly IServiceProvider serviceProvider; | ||
|
||
/// <summary> | ||
/// Creates an instance of GrainStorageInterceptorProxy. | ||
/// </summary> | ||
/// <param name="serviceProvider">a service provider.</param> | ||
public GrainStorageInterceptorProxy(IServiceProvider serviceProvider) | ||
{ | ||
this.serviceProvider = serviceProvider; | ||
this.targetProvider = serviceProvider.Storage | ||
} | ||
|
||
/// <summary>Delete / Clear data function for this storage instance.</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 Task ClearStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) | ||
{ | ||
|
||
} | ||
|
||
/// <summary> | ||
/// Provides hook to take part in lifecycle. | ||
/// Also may act as a signal interface indicating that an object can take part in lifecycle. | ||
/// </summary> | ||
/// <param name="lifecycle">The lifecycle event.</param> | ||
public void Participate(ISiloLifecycle lifecycle) => throw new NotImplementedException(); | ||
|
||
/// <summary>Read data function for this storage instance.</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">State data object to be populated for this grain.</param> | ||
/// <returns>Completion promise for the Read operation on the specified grain.</returns> | ||
public Task ReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) => throw new NotImplementedException(); | ||
|
||
/// <summary>Write data function for this storage instance.</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">State data object to be written for this grain.</param> | ||
/// <returns>Completion promise for the Write operation on the specified grain.</returns> | ||
public Task WriteStateAsync(string grainType, GrainReference grainReference, IGrainState grainState) => throw new NotImplementedException(); | ||
} |
53 changes: 53 additions & 0 deletions
53
Source/Orleans.StorageProviderInterceptors/IGrainStorageInterceptor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
namespace Orleans.StorageProviderInterceptors; | ||
|
||
using System.Threading.Tasks; | ||
using Orleans; | ||
using Orleans.Runtime; | ||
|
||
/// <summary> | ||
/// IGrainStorageInterceptor defines an interceptor. | ||
/// </summary> | ||
public interface IGrainStorageInterceptor | ||
{ | ||
/// <summary>Called before the Delete / Clear data function for this storage instance.</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> | ||
ValueTask OnBeforeClearStateAsync(string grainType, GrainReference grainReference, IGrainState grainState); | ||
|
||
/// <summary>Called after the Delete / Clear data function for this storage instance.</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> | ||
ValueTask OnAfterClearStateAsync(string grainType, GrainReference grainReference, IGrainState grainState); | ||
|
||
/// <summary>Called before the Read data function for this storage instance.</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">State data object to be populated for this grain.</param> | ||
/// <returns>Completion promise for the Read operation on the specified grain.</returns> | ||
public ValueTask OnBeforeReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState); | ||
|
||
/// <summary>Called after the Read data function for this storage instance.</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">State data object to be populated for this grain.</param> | ||
/// <returns>Completion promise for the Read operation on the specified grain.</returns> | ||
public ValueTask OnAfterReadStateAsync(string grainType, GrainReference grainReference, IGrainState grainState); | ||
|
||
/// <summary>Called before the Write data function for this storage instance.</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">State data object to be written for this grain.</param> | ||
/// <returns>Completion promise for the Write operation on the specified grain.</returns> | ||
public ValueTask OnBeforeWriteStateAsync(string grainType, GrainReference grainReference, IGrainState grainState); | ||
|
||
/// <summary>Called after the Write data function for this storage instance.</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">State data object to be written for this grain.</param> | ||
/// <returns>Completion promise for the Write operation on the specified grain.</returns> | ||
public ValueTask OnAfterWriteStateAsync(string grainType, GrainReference grainReference, IGrainState grainState); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.