forked from SolrNet/SolrNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolrCloudState.cs
37 lines (32 loc) · 995 Bytes
/
SolrCloudState.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
using System.Collections.Generic;
using System.Linq;
namespace SolrNet.Cloud {
/// <summary>
/// Represents cloud state
/// </summary>
public class SolrCloudState {
/// <summary>
/// State collections
/// </summary>
public IDictionary<string, SolrCloudCollection> Collections { get; private set; }
/// <summary>
/// Constructor
/// </summary>
public SolrCloudState(IDictionary<string, SolrCloudCollection> collections) {
Collections = collections;
}
/// <summary>
/// Returns merged cloud states
/// </summary>
public SolrCloudState Merge(SolrCloudState state)
{
if (state == null || state.Collections == null || !state.Collections.Any())
return this;
foreach (var element in state.Collections)
{
Collections.Add(element);
}
return this;
}
}
}