internal static ReplicationStatistics GetReplicationInformation(DocumentDatabase database) { var mostRecentDocumentEtag = Etag.Empty; database.TransactionalStorage.Batch(accessor => { mostRecentDocumentEtag = accessor.Staleness.GetMostRecentDocumentEtag(); }); var replicationTask = database.StartupTasks.OfType <ReplicationTask>().FirstOrDefault(); var replicationStatistics = new ReplicationStatistics { Self = database.ServerUrl, MostRecentDocumentEtag = mostRecentDocumentEtag, Stats = replicationTask == null ? new List <DestinationStats>() : replicationTask.DestinationStats.Values.ToList() }; return(replicationStatistics); }
public HttpResponseMessage ReplicationInfoGet() { var mostRecentDocumentEtag = Etag.Empty; var mostRecentAttachmentEtag = Etag.Empty; Database.TransactionalStorage.Batch(accessor => { mostRecentDocumentEtag = accessor.Staleness.GetMostRecentDocumentEtag(); mostRecentAttachmentEtag = accessor.Staleness.GetMostRecentAttachmentEtag(); }); var replicationTask = Database.StartupTasks.OfType <ReplicationTask>().FirstOrDefault(); var replicationStatistics = new ReplicationStatistics { Self = Database.ServerUrl, MostRecentDocumentEtag = mostRecentDocumentEtag, MostRecentAttachmentEtag = mostRecentAttachmentEtag, Stats = replicationTask == null ? new List <DestinationStats>() : replicationTask.DestinationStats.Values.ToList() }; return(GetMessageWithObject(replicationStatistics)); }
public override void Respond(IHttpContext context) { Etag mostRecentDocumentEtag = Etag.Empty; Etag mostRecentAttachmentEtag = Etag.Empty; Database.TransactionalStorage.Batch(accessor => { mostRecentDocumentEtag = accessor.Staleness.GetMostRecentDocumentEtag(); mostRecentAttachmentEtag = accessor.Staleness.GetMostRecentAttachmentEtag(); }); var replicationTask = Database.StartupTasks.OfType <ReplicationTask>().FirstOrDefault(); var replicationStatistics = new ReplicationStatistics { Self = Database.ServerUrl, MostRecentDocumentEtag = mostRecentDocumentEtag, MostRecentAttachmentEtag = mostRecentAttachmentEtag, Stats = replicationTask == null ? new List <DestinationStats>() : replicationTask.DestinationStats.Values.ToList() }; context.WriteJson(RavenJObject.FromObject(replicationStatistics)); }