-
-
Save ayende/ef59b1535dc10ee7a60f302b363d235d to your computer and use it in GitHub Desktop.
Custom Cluster Test
This file contains hidden or 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
public class CustomReplicationInformer : IDocumentStoreReplicationInformer | |
{ | |
private readonly ReplicationInformer _informer; | |
public CustomReplicationInformer(DocumentConvention conventions, HttpJsonRequestFactory jsonRequestFactory, Func<string, IRequestTimeMetric> requestTimeMetricGetter) | |
{ | |
_informer = new ReplicationInformer(conventions, jsonRequestFactory, requestTimeMetricGetter); | |
} | |
public event EventHandler<FailoverStatusChangedEventArgs> FailoverStatusChanged | |
{ | |
add { _informer.FailoverStatusChanged += value; } | |
remove { _informer.FailoverStatusChanged -= value; } | |
} | |
public int DelayTimeInMiliSec | |
{ | |
get { return _informer.DelayTimeInMiliSec; } | |
set { _informer.DelayTimeInMiliSec = value; } | |
} | |
public List<OperationMetadata> ReplicationDestinations | |
{ | |
get { return _informer.ReplicationDestinations; } | |
} | |
public List<OperationMetadata> ReplicationDestinationsUrls | |
{ | |
get { return _informer.ReplicationDestinationsUrls; } | |
} | |
public FailureCounters FailureCounters | |
{ | |
get { return _informer.FailureCounters; } | |
} | |
public int GetReadStripingBase(bool increment) | |
{ | |
return _informer.GetReadStripingBase(increment); | |
} | |
public ReplicationDestination[] FailoverServers | |
{ | |
get { return _informer.FailoverServers; } | |
set { _informer.FailoverServers = value; } | |
} | |
public Task UpdateReplicationInformationIfNeededAsync(AsyncServerClient serverClient) | |
{ | |
return _informer.UpdateReplicationInformationIfNeededAsync(serverClient); | |
} | |
public void ClearReplicationInformationLocalCache(ServerClient client) | |
{ | |
_informer.ClearReplicationInformationLocalCache(client); | |
} | |
public void RefreshReplicationInformation(AsyncServerClient serverClient) | |
{ | |
_informer.RefreshReplicationInformation(serverClient); | |
} | |
public void RefreshReplicationInformation(ServerClient serverClient) | |
{ | |
_informer.RefreshReplicationInformation(serverClient); | |
} | |
public void Dispose() | |
{ | |
_informer.Dispose(); | |
} | |
public Task<T> ExecuteWithReplicationAsync<T>(HttpMethod method, string primaryUrl, OperationCredentials primaryCredentials, | |
int currentRequest, int currentReadStripingBase, Func<OperationMetadata, IRequestTimeMetric, Task<T>> operation, CancellationToken token = new CancellationToken()) | |
{ | |
primaryUrl = method.Method == "GET" ? ReadFromDb : WriteToDb; //This is the only thing I care about | |
return _informer.ExecuteWithReplicationAsync(method, primaryUrl, primaryCredentials, currentRequest, currentReadStripingBase, operation, token); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment