Ejemplo n.º 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();
        }
Ejemplo n.º 2
0
 /// <exception cref="System.IO.IOException"></exception>
 private void Defrag(string fname)
 {
     var config = new DefragmentConfig(fname);
     config.Db4oConfig(NewConfiguration());
     config.StoredClassFilter(IgnoreClassFilter(typeof (SimpleClass
         )));
     Db4o.Defragment.Defragment.Defrag(config);
 }
Ejemplo n.º 3
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 UseAClassFilter()
        {
            // #example: Use class filter
            DefragmentConfig config = new DefragmentConfig("database.db4o");
            config.StoredClassFilter(new AvailableTypeFilter());

            Defragment.Defrag(config);
            // #end example
        }