コード例 #1
0
        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);
        }
コード例 #2
0
		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);
		}
コード例 #3
0
 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;
 }
コード例 #4
0
		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;
		}
コード例 #5
0
		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;
		}
コード例 #6
0
		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;
		}
コード例 #7
0
		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));
		}