public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO sio, DefragmentContextImpl context) { base.Defrag(classMetadata, aspect, sio, context); if (!(aspect is FieldMetadata)) { return; } var field = (FieldMetadata)aspect; if (field.IsVirtual()) { return; } if (field.HasIndex()) { var index = field.GetIndex(context.SystemTrans()); var targetIndexID = context.CopyID(); if (targetIndexID != 0) { index.DefragBTree(context.Services()); } } else { context.WriteInt(0); } }
public virtual void DefragBTree(IDefragmentServices services) { DefragmentContextImpl.ProcessCopy(services, GetID(), new _ISlotCopyHandler_481(this )); services.TraverseAllIndexSlots(this, new _IVisitor4_486(this, services)); ConvertCacheEvictedNodesToReadMode(); }
public override void DefragReference(ClassMetadata classMetadata, DefragmentContextImpl context, int classIndexID) { int newID = -classIndexID; context.WriteInt(newID); }
public static void Defragment(IDefragmentContext context, ArrayHandler handler) { int sourceAddress = context.SourceBuffer().ReadInt(); int length = context.SourceBuffer().ReadInt(); if (sourceAddress == 0 && length == 0) { context.TargetBuffer().WriteInt(0); context.TargetBuffer().WriteInt(0); return; } Slot slot = context.AllocateMappedTargetSlot(sourceAddress, length); ByteArrayBuffer sourceBuffer = null; try { sourceBuffer = context.SourceBufferByAddress(sourceAddress, length); } catch (IOException exc) { throw new Db4oIOException(exc); } DefragmentContextImpl payloadContext = new DefragmentContextImpl(sourceBuffer, (DefragmentContextImpl )context); handler.DefragmentSlot(payloadContext); payloadContext.WriteToTarget(slot.Address()); context.TargetBuffer().WriteInt(slot.Address()); context.TargetBuffer().WriteInt(length); }
/// <exception cref="Db4objects.Db4o.CorruptionException"></exception> /// <exception cref="System.IO.IOException"></exception> public void ProcessObjectSlot(DefragmentServicesImpl services, ClassMetadata classMetadata , int id) { ByteArrayBuffer sourceBuffer = services.SourceBufferByID(id); DefragmentContextImpl.ProcessCopy(services, id, new _ISlotCopyHandler_43(this, services ), sourceBuffer); }
public void ProcessCopy(DefragmentContextImpl context) { int acceptedClasses = 0; int numClassesOffset = context.TargetBuffer().Offset(); acceptedClasses = this.CopyAcceptedClasses(context, acceptedClasses); this.WriteIntAt(context.TargetBuffer(), numClassesOffset, acceptedClasses); }
public void ProcessCopy(DefragmentContextImpl context) { var acceptedClasses = 0; var numClassesOffset = context.TargetBuffer().Offset(); acceptedClasses = CopyAcceptedClasses(context, acceptedClasses); WriteIntAt(context.TargetBuffer(), numClassesOffset, acceptedClasses); }
private static void DefragUnindexed(DefragmentServicesImpl services) { IdSource unindexedIDs = services.UnindexedIDs(); while (unindexedIDs.HasMoreIds()) { int origID = unindexedIDs.NextId(); DefragmentContextImpl.ProcessCopy(services, origID, new _ISlotCopyHandler_208()); } }
/// <exception cref="Db4objects.Db4o.CorruptionException"></exception> /// <exception cref="System.IO.IOException"></exception> public void ProcessClass(DefragmentServicesImpl services, ClassMetadata classMetadata , int id, int classIndexID) { if (services.MappedID(id, -1) == -1) { Sharpen.Runtime.Err.WriteLine("MAPPING NOT FOUND: " + id); } DefragmentContextImpl.ProcessCopy(services, id, new _ISlotCopyHandler_34(classMetadata , classIndexID)); }
public _IProcedure4_136(ClassMarshaller _enclosing, IntByRef processedAspectCount , int aspectCount, ClassMetadata classMetadata, LatinStringIO sio, DefragmentContextImpl context) { this._enclosing = _enclosing; this.processedAspectCount = processedAspectCount; this.aspectCount = aspectCount; this.classMetadata = classMetadata; this.sio = sio; this.context = context; }
public virtual void DefragIndexEntry(DefragmentContextImpl context) { try { Read1(context.SourceBuffer()); Read1(context.TargetBuffer()); } catch (CorruptionException) { Exceptions4.VirtualException(); } }
public void ProcessCopy(DefragmentContextImpl context) { ClassMetadata.DefragObject(context); if (this._enclosing._objectCommitFrequency > 0) { this._enclosing._objectCount++; if (this._enclosing._objectCount == this._enclosing._objectCommitFrequency) { services.TargetCommit(); services.Mapping().Commit(); this._enclosing._objectCount = 0; } } }
public static ObjectHeader Defrag(DefragmentContextImpl context) { var source = context.SourceBuffer(); var target = context.TargetBuffer(); var header = new ObjectHeader (context.Services().SystemTrans().Container(), null, source); var newID = context.Mapping().StrictMappedID(header.ClassMetadata().GetID()); var slotFormat = header.SlotFormat(); slotFormat.WriteObjectClassID(target, newID); slotFormat.SkipMarshallerInfo(target); slotFormat.ReadHeaderAttributes(target); return header; }
public static ObjectHeader Defrag(DefragmentContextImpl context) { var source = context.SourceBuffer(); var target = context.TargetBuffer(); var header = new ObjectHeader (context.Services().SystemTrans().Container(), null, source); var newID = context.Mapping().StrictMappedID(header.ClassMetadata().GetID()); var slotFormat = header.SlotFormat(); slotFormat.WriteObjectClassID(target, newID); slotFormat.SkipMarshallerInfo(target); slotFormat.ReadHeaderAttributes(target); return(header); }
public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO sio, DefragmentContextImpl context) { context.IncrementStringOffset(sio); if (!(aspect is FieldMetadata)) { return; } if (((FieldMetadata)aspect).IsVirtual()) { return; } // handler ID context.CopyID(); // skip primitive/array/narray attributes context.IncrementOffset(1); }
private int CopyAcceptedClasses(DefragmentContextImpl context, int acceptedClasses ) { int numClasses = context.ReadInt(); for (int classIdx = 0; classIdx < numClasses; classIdx++) { int classId = context.SourceBuffer().ReadInt(); if (!this.Accept(classId)) { continue; } ++acceptedClasses; context.WriteMappedID(classId); } return(acceptedClasses); }
public virtual void Defrag(ClassMetadata classMetadata, LatinStringIO sio, DefragmentContextImpl context, int classIndexID) { ReadName(sio, context.SourceBuffer()); ReadName(sio, context.TargetBuffer()); int metaClassID = 0; context.WriteInt(metaClassID); // ancestor ID context.CopyID(); context.WriteInt((classMetadata.HasClassIndex() ? IndexIDForWriting(classIndexID) : 0)); int aspectCount = context.ReadInt(); if (aspectCount > classMetadata.DeclaredAspectCount()) { throw new InvalidOperationException(); } IntByRef processedAspectCount = new IntByRef(0); classMetadata.TraverseDeclaredAspects(new _IProcedure4_136(this, processedAspectCount , aspectCount, classMetadata, sio, context)); }
private int CopyDependentSlot(IDefragmentContext context, int sourceId) { try { ByteArrayBuffer sourceBuffer = context.SourceBufferById(sourceId); Slot targetPayloadSlot = context.AllocateTargetSlot(sourceBuffer.Length()); int targetId = context.Services().TargetNewId(); context.Services().MapIDs(sourceId, targetId, false); context.Services().Mapping().MapId(targetId, targetPayloadSlot); DefragmentContextImpl payloadContext = new DefragmentContextImpl(sourceBuffer, (DefragmentContextImpl )context); int clazzId = payloadContext.CopyIDReturnOriginalID(); ITypeHandler4 payloadHandler = payloadContext.TypeHandlerForId(clazzId); ITypeHandler4 versionedPayloadHandler = HandlerRegistry.CorrectHandlerVersion(payloadContext , payloadHandler); versionedPayloadHandler.Defragment(payloadContext); payloadContext.WriteToTarget(targetPayloadSlot.Address()); return(targetId); } catch (IOException ioexc) { throw new Db4oIOException(ioexc); } }
public static void DefragIndex(DefragmentContextImpl context, IIndexable4 keyHandler ) { // count int count = context.ReadInt(); // leafByte byte leafByte = context.ReadByte(); bool isLeaf = (leafByte == 1); context.CopyID(); // parent ID context.CopyID(); // previous ID context.CopyID(); // next ID for (int i = 0; i < count; i++) { keyHandler.DefragIndexEntry(context); if (!isLeaf) { context.CopyID(); } } }
public void ProcessCopy(DefragmentContextImpl context) { _enclosing._enclosing.DefragIndexNode(context); }
public override void DefragIndexEntry(DefragmentContextImpl context) { context.IncrementIntSize(); }
/// <exception cref="Db4objects.Db4o.CorruptionException"></exception> /// <exception cref="System.IO.IOException"></exception> public void ProcessClassCollection(DefragmentServicesImpl services) { DefragmentContextImpl.ProcessCopy(services, services.SourceClassCollectionID(), new _ISlotCopyHandler_59(services)); }
public virtual void DefragIndexEntry(DefragmentContextImpl context) { throw new NotImplementedException(); }
public virtual void DefragIndexEntry(DefragmentContextImpl context) { context.CopyAddress(); // length context.IncrementIntSize(); }
public override void DefragIndex(DefragmentContextImpl context) { _btreeIndex.DefragIndex(context); }
public static void Defragment(IDefragmentContext context, ArrayHandler handler) { var sourceAddress = context.SourceBuffer().ReadInt(); var length = context.SourceBuffer().ReadInt(); if (sourceAddress == 0 && length == 0) { context.TargetBuffer().WriteInt(0); context.TargetBuffer().WriteInt(0); return; } var slot = context.AllocateMappedTargetSlot(sourceAddress, length); ByteArrayBuffer sourceBuffer = null; try { sourceBuffer = context.SourceBufferByAddress(sourceAddress, length); } catch (IOException exc) { throw new Db4oIOException(exc); } var payloadContext = new DefragmentContextImpl(sourceBuffer, (DefragmentContextImpl ) context); handler.DefragmentSlot(payloadContext); payloadContext.WriteToTarget(slot.Address()); context.TargetBuffer().WriteInt(slot.Address()); context.TargetBuffer().WriteInt(length); }
public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO sio, DefragmentContextImpl context) { context.ReadByte(); base.Defrag(classMetadata, aspect, sio, context); }
public void ProcessCopy(DefragmentContextImpl context) { ClassMetadata.DefragObject(context); }
public virtual void DefragIndex(DefragmentContextImpl context) { context.IncrementOffset(DefragmentIncrementOffset); context.CopyID(); }
public void DefragIndexEntry(DefragmentContextImpl context) { context.IncrementOffset(Const4.LongLength); }
public virtual void DefragIndexEntry(DefragmentContextImpl context) { _parentIdHandler.DefragIndexEntry(context); _valueHandler.DefragIndexEntry(context); }
private int CopyDependentSlot(IDefragmentContext context, int sourceId) { try { var sourceBuffer = context.SourceBufferById(sourceId); var targetPayloadSlot = context.AllocateTargetSlot(sourceBuffer.Length()); var targetId = context.Services().TargetNewId(); context.Services().MapIDs(sourceId, targetId, false); context.Services().Mapping().MapId(targetId, targetPayloadSlot); var payloadContext = new DefragmentContextImpl(sourceBuffer, (DefragmentContextImpl ) context); var clazzId = payloadContext.CopyIDReturnOriginalID(); var payloadHandler = payloadContext.TypeHandlerForId(clazzId); var versionedPayloadHandler = HandlerRegistry.CorrectHandlerVersion(payloadContext , payloadHandler); versionedPayloadHandler.Defragment(payloadContext); payloadContext.WriteToTarget(targetPayloadSlot.Address()); return targetId; } catch (IOException ioexc) { throw new Db4oIOException(ioexc); } }
public void ProcessCopy(DefragmentContextImpl context) { classMetadata.DefragClass(context, classIndexID); }
public override void DefragReference(ClassMetadata classMetadata, DefragmentContextImpl context, int classIndexID) { var newID = -classIndexID; context.WriteInt(newID); }
public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO sio, DefragmentContextImpl context) { base.Defrag(classMetadata, aspect, sio, context); if (!(aspect is FieldMetadata)) { return; } var field = (FieldMetadata) aspect; if (field.IsVirtual()) { return; } if (field.HasIndex()) { var index = field.GetIndex(context.SystemTrans()); var targetIndexID = context.CopyID(); if (targetIndexID != 0) { index.DefragBTree(context.Services()); } } else { context.WriteInt(0); } }
void IIndexable4.DefragIndexEntry(DefragmentContextImpl context) { IncrementOffset(context); }
public static void DefragIndex(DefragmentContextImpl context, IIndexable4 keyHandler ) { // count var count = context.ReadInt(); // leafByte var leafByte = context.ReadByte(); var isLeaf = (leafByte == 1); context.CopyID(); // parent ID context.CopyID(); // previous ID context.CopyID(); // next ID for (var i = 0; i < count; i++) { keyHandler.DefragIndexEntry(context); if (!isLeaf) { context.CopyID(); } } }
public void DefragIndexEntry(DefragmentContextImpl context) { context.CopyID(); }
public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO sio, DefragmentContextImpl context) { context.IncrementStringOffset(sio); if (!(aspect is FieldMetadata)) { return; } if (((FieldMetadata) aspect).IsVirtual()) { return; } // handler ID context.CopyID(); // skip primitive/array/narray attributes context.IncrementOffset(1); }
public abstract void Defrag(ClassMetadata arg1, ClassAspect arg2, LatinStringIO arg3 , DefragmentContextImpl arg4);
public virtual void DefragIndexNode(DefragmentContextImpl context) { BTreeNode.DefragIndex(context, _keyHandler); }
public abstract void DefragIndex(DefragmentContextImpl arg1);
public abstract void DefragReference(ClassMetadata arg1, DefragmentContextImpl arg2 , int arg3);
public virtual void Defrag(ClassMetadata classMetadata, LatinStringIO sio, DefragmentContextImpl context, int classIndexID) { ReadName(sio, context.SourceBuffer()); ReadName(sio, context.TargetBuffer()); var metaClassID = 0; context.WriteInt(metaClassID); // ancestor ID context.CopyID(); context.WriteInt((classMetadata.HasClassIndex() ? IndexIDForWriting(classIndexID) : 0)); var aspectCount = context.ReadInt(); if (aspectCount > classMetadata.DeclaredAspectCount()) { throw new InvalidOperationException(); } var processedAspectCount = new IntByRef(0); classMetadata.TraverseDeclaredAspects(new _IProcedure4_136(this, processedAspectCount , aspectCount, classMetadata, sio, context)); }