Exemple #1
0
        /// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private static void Pass(DefragmentServicesImpl context, DefragmentConfig config,
                                 IPassCommand command)
        {
            command.ProcessClassCollection(context);
            IStoredClass[] classes = context.StoredClasses(DefragmentServicesImpl.Sourcedb);
            for (int classIdx = 0; classIdx < classes.Length; classIdx++)
            {
                ClassMetadata classMetadata = (ClassMetadata)classes[classIdx];
                if (!config.StoredClassFilter().Accept(classMetadata))
                {
                    continue;
                }
                ProcessClass(context, classMetadata, command);
                command.Flush(context);
                if (config.ObjectCommitFrequency() > 0)
                {
                    context.TargetCommit();
                }
            }
            BTree uuidIndex = context.SourceUuidIndex();

            if (uuidIndex != null)
            {
                command.ProcessBTree(context, uuidIndex);
            }
            command.Flush(context);
            context.TargetCommit();
        }
        public void SetCommitFrequency()
        {
            // #example: Set the commit frequency
            DefragmentConfig config = new DefragmentConfig("database.db4o");
            config.ObjectCommitFrequency(10000);

            Defragment.Defrag(config);
            // #end example
        }
Exemple #3
0
 /// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 private static void SecondPass(DefragmentServicesImpl context, DefragmentConfig config
                                )
 {
     // System.out.println("SECOND");
     Pass(context, config, new SecondPassCommand(config.ObjectCommitFrequency()));
 }
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static void Pass(DefragmentServicesImpl context, DefragmentConfig config, 
			IPassCommand command)
		{
			command.ProcessClassCollection(context);
			IStoredClass[] classes = context.StoredClasses(DefragmentServicesImpl.Sourcedb);
			for (int classIdx = 0; classIdx < classes.Length; classIdx++)
			{
				ClassMetadata classMetadata = (ClassMetadata)classes[classIdx];
				if (!config.StoredClassFilter().Accept(classMetadata))
				{
					continue;
				}
				ProcessClass(context, classMetadata, command);
				command.Flush(context);
				if (config.ObjectCommitFrequency() > 0)
				{
					context.TargetCommit();
				}
			}
			BTree uuidIndex = context.SourceUuidIndex();
			if (uuidIndex != null)
			{
				command.ProcessBTree(context, uuidIndex);
			}
			command.Flush(context);
			context.TargetCommit();
		}
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static void SecondPass(DefragmentServicesImpl context, DefragmentConfig config
			)
		{
			// System.out.println("SECOND");
			Pass(context, config, new SecondPassCommand(config.ObjectCommitFrequency()));
		}