private void RemoveOldRevisions(string key, int revision, VersioningConfiguration versioningConfiguration, TransactionInformation transactionInformation) { int latestValidRevision = revision - versioningConfiguration.MaxRevisions; if (latestValidRevision <= 1) return; Database.Delete(key + "/revisions/" + (latestValidRevision - 1), null, transactionInformation); }
private void RemoveOldRevisions(string key, int revision, VersioningConfiguration versioningConfiguration, TransactionInformation transactionInformation) { int latestValidRevision = revision - versioningConfiguration.MaxRevisions; if (latestValidRevision <= 0) return; Database.Delete(string.Format("{0}/revisions/{1}", key, latestValidRevision), null, transactionInformation); }
private VersioningConfiguration GetDocumentVersioningConfiguration(JObject metadata) { var versioningConfiguration = new VersioningConfiguration { MaxRevisions = Int32.MaxValue, Exclude = false }; var entityName = metadata.Value<string>("Raven-Entity-Name"); if(entityName != null) { var doc = Database.Get("Raven/Versioning/" + entityName, null) ?? Database.Get("Raven/Versioning/DefaultConfiguration", null); if( doc != null) { versioningConfiguration = doc.DataAsJson.JsonDeserialization<VersioningConfiguration>(); } } return versioningConfiguration; }
private bool TryGetVersioningConfiguration(string key, RavenJObject metadata, out VersioningConfiguration versioningConfiguration) { versioningConfiguration = null; if (key.StartsWith("Raven/", StringComparison.OrdinalIgnoreCase)) return false; if (metadata.Value<string>(VersioningUtil.RavenDocumentRevisionStatus) == "Historical") return false; versioningConfiguration = Database.GetDocumentVersioningConfiguration(metadata); if (versioningConfiguration == null || versioningConfiguration.Exclude) return false; return true; }
private bool TryGetVersioningConfiguration(string key, RavenJObject metadata, out VersioningConfiguration versioningConfiguration) { versioningConfiguration = null; if (key.StartsWith("Raven/", StringComparison.OrdinalIgnoreCase)) return false; if (metadata.Value<string>(VersioningUtil.RavenDocumentRevisionStatus) == "Historical") return false; versioningConfiguration = Database.GetDocumentVersioningConfiguration(metadata); if (versioningConfiguration == null || versioningConfiguration.Exclude || (versioningConfiguration.ExcludeUnlessExplicit && !metadata.__ExternalState.ContainsKey(Constants.RavenCreateVersion))) return false; return true; }
private static bool TryGetVersioningConfiguration(string name, RavenJObject metadata, IStorageActionsAccessor accessor, out VersioningConfiguration versioningConfiguration) { versioningConfiguration = null; if (name.StartsWith("Raven/", StringComparison.OrdinalIgnoreCase)) return false; if (metadata.Value<string>(VersioningUtil.RavenFileRevisionStatus) == "Historical") return false; versioningConfiguration = accessor.GetVersioningConfiguration(); if (versioningConfiguration == null || versioningConfiguration.Exclude || (versioningConfiguration.ExcludeUnlessExplicit && !metadata.__ExternalState.ContainsKey(Constants.RavenCreateVersion))) return false; return true; }
private void RemoveOldRevisions(string name, long revision, VersioningConfiguration versioningConfiguration) { var latestValidRevision = revision - versioningConfiguration.MaxRevisions; if (latestValidRevision <= 0) return; FileSystem.StorageOperationsTask.IndicateFileToDelete(string.Format("{0}/revisions/{1}", name, latestValidRevision)); }