public ReplicationAwareRequestExecuter(IDocumentStoreReplicationInformer replicationInformer, RequestTimeMetric requestTimeMetric)
 {
     this.replicationInformer = replicationInformer;
     this.requestTimeMetric   = requestTimeMetric;
 }
Exemple #2
0
        public HttpJsonRequest AddReplicationStatusHeaders(string thePrimaryUrl, string currentUrl, IDocumentStoreReplicationInformer replicationInformer, FailoverBehavior failoverBehavior, Action <NameValueCollection, string, string> handleReplicationStatusChanges)
        {
            if (thePrimaryUrl.Equals(currentUrl, StringComparison.OrdinalIgnoreCase))
            {
                return(this);
            }
            if (replicationInformer.GetFailureCount(thePrimaryUrl) <= 0)
            {
                return(this); // not because of failover, no need to do this.
            }
            var lastPrimaryCheck = replicationInformer.GetFailureLastCheck(thePrimaryUrl);

            headers.Set(Constants.RavenClientPrimaryServerUrl, ToRemoteUrl(thePrimaryUrl));
            headers.Set(Constants.RavenClientPrimaryServerLastCheck, lastPrimaryCheck.ToString("s"));

            primaryUrl   = thePrimaryUrl;
            operationUrl = currentUrl;

            HandleReplicationStatusChanges = handleReplicationStatusChanges;

            return(this);
        }
Exemple #3
0
 public ReplicationAwareRequestExecuter(IDocumentStoreReplicationInformer replicationInformer)
 {
     this.replicationInformer = replicationInformer;
 }