-
Notifications
You must be signed in to change notification settings - Fork 2k
/
LogConsistencyProvider.cs
43 lines (41 loc) · 1.88 KB
/
LogConsistencyProvider.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Orleans.LogConsistency;
using Orleans.Storage;
namespace Orleans.EventSourcing.StateStorage
{
/// <summary>
/// A log-consistency provider that stores the latest view in primary storage, using any standard storage provider.
/// Supports multiple clusters connecting to the same primary storage (doing optimistic concurrency control via e-tags)
///<para>
/// The log itself is transient, i.e. not actually saved to storage - only the latest view (snapshot) and some
/// metadata (the log position, and write flags) are stored in the primary.
/// </para>
/// </summary>
public class LogConsistencyProvider : ILogViewAdaptorFactory
{
/// <inheritdoc/>
public bool UsesStorageProvider
{
get
{
return true;
}
}
/// <summary>
/// Make log view adaptor
/// </summary>
/// <typeparam name="TView">The type of the view</typeparam>
/// <typeparam name="TEntry">The type of the log entries</typeparam>
/// <param name="hostGrain">The grain that is hosting this adaptor</param>
/// <param name="initialState">The initial state for this view</param>
/// <param name="grainTypeName">The type name of the grain</param>
/// <param name="grainStorage">Storage provider</param>
/// <param name="services">Runtime services for multi-cluster coherence protocols</param>
public ILogViewAdaptor<TView, TEntry> MakeLogViewAdaptor<TView, TEntry>(ILogViewAdaptorHost<TView, TEntry> hostGrain, TView initialState, string grainTypeName, IGrainStorage grainStorage, ILogConsistencyProtocolServices services)
where TView : class, new()
where TEntry : class
{
return new LogViewAdaptor<TView,TEntry>(hostGrain, initialState, grainStorage, grainTypeName, services);
}
}
}