-
Notifications
You must be signed in to change notification settings - Fork 2k
/
NoOpCheckpointer.cs
36 lines (34 loc) · 1.41 KB
/
NoOpCheckpointer.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
using Orleans.Streams;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Orleans.ServiceBus.Providers.Testing
{
public class NoOpCheckpointerFactory : IStreamQueueCheckpointerFactory
{
public static NoOpCheckpointerFactory Instance = new NoOpCheckpointerFactory();
public Task<IStreamQueueCheckpointer<string>> Create(string partition)
{
return Task.FromResult<IStreamQueueCheckpointer<string>>(NoOpCheckpointer.Instance);
}
}
/// <summary>
/// NoOpCheckpointer is used in EventDataGeneratorStreamProvider ecosystem to replace the default Checkpointer which requires a back end storage. In EventHubDataGeneratorStreamProvider,
/// it is generating EventData on the fly when receiver pull messages from the queue, which means it doesn't support recoverable stream, hence check pointing won't bring much value there.
/// So a checkpointer with no ops should be enough.
/// </summary>
public class NoOpCheckpointer : IStreamQueueCheckpointer<string>
{
public static NoOpCheckpointer Instance = new NoOpCheckpointer();
public bool CheckpointExists => true;
public Task<string> Load()
{
return Task.FromResult(EventHubConstants.StartOfStream);
}
public void Update(string offset, DateTime utcNow)
{
}
}
}