-
Notifications
You must be signed in to change notification settings - Fork 2k
/
StorageHasherPicker.cs
44 lines (37 loc) · 1.28 KB
/
StorageHasherPicker.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
44
using Orleans.Runtime;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace Orleans.Storage
{
/// <summary>
/// <see cref="IStorageHasherPicker"/>.
/// </summary>
public class StorageHasherPicker: IStorageHasherPicker
{
/// <summary>
/// <see cref="IStorageHasherPicker.HashProviders"/>.
/// </summary>
public ICollection<IHasher> HashProviders { get; }
/// <summary>
/// A constructor.
/// </summary>
/// <param name="hashProviders">The hash providers this picker uses.</param>
public StorageHasherPicker(IEnumerable<IHasher> hashProviders)
{
if(hashProviders == null)
{
throw new ArgumentNullException(nameof(hashProviders));
}
HashProviders = new Collection<IHasher>(new List<IHasher>(hashProviders));
}
/// <summary>
/// <see cref="IStorageHasherPicker.PickHasher{T}"/>.
/// </summary>
public IHasher PickHasher<T>(string serviceId, string storageProviderInstanceName, string grainType, GrainId grainId, IGrainState<T> grainState, string tag = null)
{
return HashProviders.FirstOrDefault();
}
}
}