Exemple #1
0
 public _IVisitor4_284(IPassCommand command, DefragmentServicesImpl context, ClassMetadata
                       curClass)
 {
     this.command  = command;
     this.context  = context;
     this.curClass = curClass;
 }
Exemple #2
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();
        }
Exemple #3
0
 /// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 private static void ProcessClassIndex(DefragmentServicesImpl context, ClassMetadata
                                       curClass, IPassCommand command)
 {
     if (curClass.HasClassIndex())
     {
         BTreeClassIndexStrategy indexStrategy = (BTreeClassIndexStrategy)curClass.Index();
         BTree btree = indexStrategy.Btree();
         command.ProcessBTree(context, btree);
     }
 }
Exemple #4
0
 // TODO order of class index/object slot processing is crucial:
 // - object slots before field indices (object slots register addresses for
 // use by string indices)
 // - class index before object slots, otherwise phantom btree entries from
 // deletions appear in the source class index?!?
 // reproducable with SelectiveCascadingDeleteTestCase and ObjectSetTestCase
 // - investigate.
 /// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 private static void ProcessClass(DefragmentServicesImpl context, ClassMetadata curClass
                                  , IPassCommand command)
 {
     ProcessClassIndex(context, curClass, command);
     if (!ParentHasIndex(curClass))
     {
         ProcessObjectsForClass(context, curClass, command);
     }
     ProcessClassAndFieldIndices(context, curClass, command);
 }
Exemple #5
0
        /// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        private static void ProcessClassAndFieldIndices(DefragmentServicesImpl context, ClassMetadata
                                                        curClass, IPassCommand command)
        {
            int sourceClassIndexID = 0;
            int targetClassIndexID = 0;

            if (curClass.HasClassIndex())
            {
                sourceClassIndexID = curClass.Index().Id();
                targetClassIndexID = context.MappedID(sourceClassIndexID, -1);
            }
            command.ProcessClass(context, curClass, curClass.GetID(), targetClassIndexID);
        }
Exemple #6
0
 private static void ProcessObjectsForClass(DefragmentServicesImpl context, ClassMetadata
                                            curClass, IPassCommand command)
 {
     context.TraverseAll(curClass, new _IVisitor4_284(command, context, curClass));
 }
Exemple #7
0
 private static void Registra(IPassCommand cmd)
 {
     _commands.Add(cmd.GetName(), cmd);
 }
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static void ProcessClassAndFieldIndices(DefragmentServicesImpl context, ClassMetadata
			 curClass, IPassCommand command)
		{
			int sourceClassIndexID = 0;
			int targetClassIndexID = 0;
			if (curClass.HasClassIndex())
			{
				sourceClassIndexID = curClass.Index().Id();
				targetClassIndexID = context.MappedID(sourceClassIndexID, -1);
			}
			command.ProcessClass(context, curClass, curClass.GetID(), targetClassIndexID);
		}
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static void ProcessClassIndex(DefragmentServicesImpl context, ClassMetadata
			 curClass, IPassCommand command)
		{
			if (curClass.HasClassIndex())
			{
				BTreeClassIndexStrategy indexStrategy = (BTreeClassIndexStrategy)curClass.Index();
				BTree btree = indexStrategy.Btree();
				command.ProcessBTree(context, btree);
			}
		}
			public _IVisitor4_284(IPassCommand command, DefragmentServicesImpl context, ClassMetadata
				 curClass)
			{
				this.command = command;
				this.context = context;
				this.curClass = curClass;
			}
		private static void ProcessObjectsForClass(DefragmentServicesImpl context, ClassMetadata
			 curClass, IPassCommand command)
		{
			context.TraverseAll(curClass, new _IVisitor4_284(command, context, curClass));
		}
		// TODO order of class index/object slot processing is crucial:
		// - object slots before field indices (object slots register addresses for
		// use by string indices)
		// - class index before object slots, otherwise phantom btree entries from
		// deletions appear in the source class index?!?
		// reproducable with SelectiveCascadingDeleteTestCase and ObjectSetTestCase
		// - investigate.
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		private static void ProcessClass(DefragmentServicesImpl context, ClassMetadata curClass
			, IPassCommand command)
		{
			ProcessClassIndex(context, curClass, command);
			if (!ParentHasIndex(curClass))
			{
				ProcessObjectsForClass(context, curClass, command);
			}
			ProcessClassAndFieldIndices(context, curClass, command);
		}
		/// <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();
		}
Exemple #14
0
 private static void Registra(IPassCommand cmd)
 {
     _commands.Add(cmd.GetName(), cmd);
 }