示例#1
0
        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);
            }
        }
示例#2
0
 public virtual void ProcessAspect(ClassAspect aspect, int currentSlot)
 {
     if (aspect is FieldMetadata)
     {
         Process((FieldMetadata) aspect);
     }
 }
示例#3
0
        public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
                                   , ByteArrayBuffer writer)
        {
            writer.WriteShortString(trans, aspect.GetName());
            if (!(aspect is FieldMetadata))
            {
                return;
            }
            var field = (FieldMetadata)aspect;

            field.Alive();
            if (field.IsVirtual())
            {
                return;
            }
            var handler = field.GetHandler();

            if (handler is StandardReferenceTypeHandler)
            {
                // TODO: ensure there is a test case, to make this happen
                if (((StandardReferenceTypeHandler)handler).ClassMetadata().GetID() == 0)
                {
                    trans.Container().NeedsUpdate(clazz);
                }
            }
            writer.WriteInt(field.FieldTypeID());
            var bitmap = new BitMap4(3);

            bitmap.Set(0, field.IsPrimitive());
            bitmap.Set(1, Handlers4.HandlesArray(handler));
            bitmap.Set(2, Handlers4.HandlesMultidimensionalArray(handler));
            // keep the order
            writer.WriteByte(bitmap.GetByte(0));
        }
 public _MarshallingInfoTraverseAspectCommand_456(ClassAspect aspect, BooleanByRef
                                                  found, ObjectHeaderContext context, IMarshallingInfo baseArg1) : base(baseArg1)
 {
     this.aspect  = aspect;
     this.found   = found;
     this.context = context;
 }
示例#5
0
 public virtual void ProcessAspect(ClassAspect aspect, int currentSlot)
 {
     if (aspect is FieldMetadata)
     {
         Process((FieldMetadata)aspect);
     }
 }
示例#6
0
 public virtual void ProcessAspect(ClassAspect aspect, int currentSlot)
 {
     if (Accept(aspect))
     {
         ProcessAspect(aspect, currentSlot, _marshallingInfo.IsNull(currentSlot));
     }
     _marshallingInfo.BeginSlot();
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (!isNull)
     {
         aspect.DefragAspect(context);
     }
 }
 public virtual void ProcessAspect(ClassAspect aspect, int currentSlot)
 {
     if (Accept(aspect))
     {
         ProcessAspect(aspect, currentSlot, _marshallingInfo.IsNull(currentSlot));
     }
     _marshallingInfo.BeginSlot();
 }
示例#9
0
 public virtual void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
                                                 )
 {
     if (_marshallingInfo.IsNull(currentSlot))
     {
         return;
     }
     aspect.IncrementOffset(_marshallingInfo.Buffer());
 }
        public virtual bool SeekToField(ObjectHeaderContext context, ClassAspect aspect)
        {
            BooleanByRef           found   = new BooleanByRef(false);
            ITraverseAspectCommand command = new _MarshallingInfoTraverseAspectCommand_456(aspect
                                                                                           , found, context, EnsureFieldList(context));

            TraverseAllAspects(context, command);
            return(found.value);
        }
        private bool IsCollectIdTypehandlerAspect(ClassAspect aspect)
        {
            if (!(aspect is TypeHandlerAspect))
            {
                return(false);
            }
            ITypeHandler4 typehandler = ((TypeHandlerAspect)aspect)._typeHandler;

            return(Handlers4.IsCascading(typehandler));
        }
 public virtual void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
     )
 {
     if (_marshallingInfo.IsNull(currentSlot))
     {
         return;
     }
     aspect.IncrementOffset(_marshallingInfo.Buffer(), (IHandlerVersionContext) _marshallingInfo
         );
 }
            protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                                  )
            {
                FieldMetadata field = (FieldMetadata)aspect;

                if (!isNull)
                {
                    field.AttemptUpdate(context);
                }
            }
示例#14
0
            public void Apply(object arg)
            {
                if (processedAspectCount.value >= aspectCount)
                {
                    return;
                }
                ClassAspect aspect = (ClassAspect)arg;

                this._enclosing._family._field.Defrag(classMetadata, aspect, sio, context);
                processedAspectCount.value++;
            }
示例#15
0
            public void Apply(object arg)
            {
                aspectCount.value++;
                Assert.IsSmaller(2, aspectCount.value);
                ClassAspect aspect = (ClassAspect)arg;

                Assert.IsInstanceOf(typeof(TypeHandlerAspect), aspect);
                TypeHandlerAspect typeHandlerAspect = (TypeHandlerAspect)aspect;

                Assert.IsInstanceOf(typeHandlerClass, typeHandlerAspect._typeHandler);
            }
示例#16
0
 private ClassAspect[] ReadAspects(ObjectContainerBase stream, ByteArrayBuffer reader
                                   , ClassMetadata clazz)
 {
     ClassAspect[] aspects = new ClassAspect[reader.ReadInt()];
     for (int i = 0; i < aspects.Length; i++)
     {
         aspects[i] = _family._field.Read(stream, clazz, reader);
         aspects[i].SetHandle(i);
     }
     return(aspects);
 }
 protected override void ProcessAspect(ClassAspect curField, int currentSlot, bool
                                       isNull)
 {
     if (curField == aspect)
     {
         found.value = !isNull;
         this.Cancel();
         return;
     }
     if (!isNull)
     {
         curField.IncrementOffset(this._marshallingInfo.Buffer(), context);
     }
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (isNull)
     {
         if (aspect is FieldMetadata)
         {
             FieldMetadata field = (FieldMetadata)aspect;
             field.RemoveIndexEntry(context.Transaction(), context.ObjectId(), null);
         }
         return;
     }
     aspect.Delete(context, isUpdate);
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (!isNull)
     {
         if (aspect is VirtualFieldMetadata)
         {
             ((VirtualFieldMetadata)aspect).ReadVirtualAttribute(context);
         }
         else
         {
             aspect.IncrementOffset(context, context);
         }
     }
 }
示例#20
0
 public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
     , ByteArrayBuffer writer)
 {
     base.Write(trans, clazz, aspect, writer);
     if (!(aspect is FieldMetadata))
     {
         return;
     }
     var field = (FieldMetadata) aspect;
     if (!HasBTreeIndex(field))
     {
         return;
     }
     writer.WriteIDOf(trans, field.GetIndex(trans));
 }
示例#21
0
 public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
     )
 {
     var len = base.MarshalledLength(stream, aspect);
     if (!(aspect is FieldMetadata))
     {
         return len;
     }
     var field = (FieldMetadata) aspect;
     if (!HasBTreeIndex(field))
     {
         return len;
     }
     return len + Const4.IdLength;
 }
示例#22
0
        public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
                                   , ByteArrayBuffer writer)
        {
            base.Write(trans, clazz, aspect, writer);
            if (!(aspect is FieldMetadata))
            {
                return;
            }
            var field = (FieldMetadata)aspect;

            if (!HasBTreeIndex(field))
            {
                return;
            }
            writer.WriteIDOf(trans, field.GetIndex(trans));
        }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (isNull)
     {
         return;
     }
     if (predicate.Match(aspect))
     {
         aspect.CollectIDs(context);
     }
     else
     {
         aspect.IncrementOffset(context, context);
     }
 }
示例#24
0
 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);
 }
示例#25
0
        public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
                                             )
        {
            var len = base.MarshalledLength(stream, aspect);

            if (!(aspect is FieldMetadata))
            {
                return(len);
            }
            var field = (FieldMetadata)aspect;

            if (!HasBTreeIndex(field))
            {
                return(len);
            }
            return(len + Const4.IdLength);
        }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (isNull)
     {
         return;
     }
     if (this._enclosing.IsCollectIdTypehandlerAspect(aspect))
     {
         aspectFound.value = true;
         aspect.CollectIDs(subContext);
     }
     else
     {
         aspect.IncrementOffset(subContext, subContext);
     }
 }
            protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                                  )
            {
                object marshalledObject = obj;

                if (aspect is FieldMetadata)
                {
                    FieldMetadata field = (FieldMetadata)aspect;
                    marshalledObject = field.GetOrCreate(trans, obj);
                    if (marshalledObject == null)
                    {
                        context.IsNull(currentSlot, true);
                        field.AddIndexEntry(trans, context.ObjectID(), null);
                        return;
                    }
                }
                aspect.Marshall(context, marshalledObject);
            }
示例#28
0
 public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
     )
 {
     var len = stream.StringIO().ShortLength(aspect.GetName());
     if (aspect is FieldMetadata)
     {
         var field = (FieldMetadata) aspect;
         if (field.NeedsArrayAndPrimitiveInfo())
         {
             len += 1;
         }
         if (!(field is VirtualFieldMetadata))
         {
             len += Const4.IdLength;
         }
     }
     return len;
 }
示例#29
0
        public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
                                             )
        {
            var len = stream.StringIO().ShortLength(aspect.GetName());

            if (aspect is FieldMetadata)
            {
                var field = (FieldMetadata)aspect;
                if (field.NeedsArrayAndPrimitiveInfo())
                {
                    len += 1;
                }
                if (!(field is VirtualFieldMetadata))
                {
                    len += Const4.IdLength;
                }
            }
            return(len);
        }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (aspect is FieldMetadata)
     {
         FieldMetadata field = (FieldMetadata)aspect;
         if (isNull)
         {
             field.AddIndexEntry(context.Transaction(), context.ObjectId(), null);
         }
         else
         {
             field.AddFieldIndex(context);
         }
     }
     else
     {
         aspect.IncrementOffset(context.Buffer(), context);
     }
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                       )
 {
     if (aspect is FieldMetadata)
     {
         FieldMetadata field = (FieldMetadata)aspect;
         if (field.Updating())
         {
             schemaUpdateDetected.value = true;
         }
         if (isNull)
         {
             if (field.GetStoredType() == null || !field.GetStoredType().IsPrimitive())
             {
                 field.Set(context.PersistentObject(), null);
             }
             return;
         }
     }
     aspect.Activate(context);
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (!isNull)
     {
         if (aspect is VirtualFieldMetadata)
         {
             ((VirtualFieldMetadata) aspect).ReadVirtualAttribute(context);
         }
         else
         {
             aspect.IncrementOffset(context, context);
         }
     }
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (aspect is FieldMetadata)
     {
         var field = (FieldMetadata) aspect;
         if (isNull)
         {
             field.AddIndexEntry(context.Transaction(), context.ObjectId(), null);
         }
         else
         {
             field.AddFieldIndex(context);
         }
     }
     else
     {
         aspect.IncrementOffset(context.Buffer(), context);
     }
 }
 public override bool Accept(ClassAspect aspect)
 {
     return(aspect.IsEnabledOn(this._marshallingInfo));
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (isNull)
     {
         return;
     }
     if (_enclosing.IsCollectIdTypehandlerAspect(aspect))
     {
         aspectFound.value = true;
         aspect.CollectIDs(subContext);
     }
     else
     {
         aspect.IncrementOffset(subContext, subContext);
     }
 }
 protected override void ProcessAspect(ClassAspect curField, int currentSlot, bool
     isNull)
 {
     if (curField == aspect)
     {
         found.value = !isNull;
         Cancel();
         return;
     }
     if (!isNull)
     {
         curField.IncrementOffset(_marshallingInfo.Buffer(), context);
     }
 }
示例#37
0
 public virtual void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
                                                 )
 {
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     var field = (FieldMetadata) aspect;
     if (!isNull)
     {
         field.AttemptUpdate(context);
     }
 }
 public _MarshallingInfoTraverseAspectCommand_456(ClassAspect aspect, BooleanByRef
     found, ObjectHeaderContext context, IMarshallingInfo baseArg1) : base(baseArg1)
 {
     this.aspect = aspect;
     this.found = found;
     this.context = context;
 }
示例#40
0
 public override void Write(Transaction trans, ClassMetadata clazz, ClassAspect aspect
                            , ByteArrayBuffer writer)
 {
     writer.WriteByte(aspect.AspectType()._id);
     base.Write(trans, clazz, aspect, writer);
 }
 public void Process(ITraverseAspectCommand command, ClassAspect currentAspect, int
     currentSlot)
 {
     command.ProcessAspectOnMissingClass(currentAspect, currentSlot);
 }
 protected abstract void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     );
示例#43
0
 public virtual void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
     )
 {
 }
示例#44
0
 public virtual bool SeekToField(ObjectHeaderContext context, ClassAspect aspect)
 {
     return false;
 }
 public override bool Accept(ClassAspect aspect)
 {
     return aspect.IsEnabledOn(context);
 }
 public override bool Accept(ClassAspect aspect)
 {
     return aspect is FieldMetadata;
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (isNull)
     {
         if (aspect is FieldMetadata)
         {
             var field = (FieldMetadata) aspect;
             field.RemoveIndexEntry(context.Transaction(), context.ObjectId(), null);
         }
         return;
     }
     aspect.Delete(context, isUpdate);
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     var marshalledObject = obj;
     if (aspect is FieldMetadata)
     {
         var field = (FieldMetadata) aspect;
         marshalledObject = field.GetOrCreate(trans, obj);
         if (marshalledObject == null)
         {
             context.IsNull(currentSlot, true);
             field.AddIndexEntry(trans, context.ObjectID(), null);
             return;
         }
     }
     aspect.Marshall(context, marshalledObject);
 }
 public override bool Accept(ClassAspect aspect)
 {
     return aspect.IsEnabledOn(_marshallingInfo);
 }
 public override void ProcessAspectOnMissingClass(ClassAspect aspect, int currentSlot
     )
 {
     context.IsNull(currentSlot, true);
 }
示例#51
0
 public abstract int MarshalledLength(ObjectContainerBase arg1, ClassAspect arg2);
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (isNull)
     {
         return;
     }
     if (predicate.Match(aspect))
     {
         aspect.CollectIDs(context);
     }
     else
     {
         aspect.IncrementOffset(context, context);
     }
 }
 public virtual bool SeekToField(ObjectHeaderContext context, ClassAspect aspect)
 {
     var found = new BooleanByRef(false);
     ITraverseAspectCommand command = new _MarshallingInfoTraverseAspectCommand_456(aspect
         , found, context, EnsureFieldList(context));
     TraverseAllAspects(context, command);
     return found.value;
 }
示例#54
0
 public abstract void Write(Transaction arg1, ClassMetadata arg2, ClassAspect arg3
     , ByteArrayBuffer arg4);
 public virtual bool Accept(ClassAspect aspect)
 {
     return true;
 }
 private bool IsCollectIdTypehandlerAspect(ClassAspect aspect)
 {
     if (!(aspect is TypeHandlerAspect))
     {
         return false;
     }
     var typehandler = ((TypeHandlerAspect) aspect)._typeHandler;
     return Handlers4.IsCascading(typehandler);
 }
示例#57
0
 public override int MarshalledLength(ObjectContainerBase stream, ClassAspect aspect
                                      )
 {
     return(base.MarshalledLength(stream, aspect) + AspectTypeTagLength);
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (!isNull)
     {
         aspect.DefragAspect(context);
     }
 }
示例#59
0
 public override void Defrag(ClassMetadata classMetadata, ClassAspect aspect, LatinStringIO
                             sio, DefragmentContextImpl context)
 {
     context.ReadByte();
     base.Defrag(classMetadata, aspect, sio, context);
 }
 protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
     )
 {
     if (aspect is FieldMetadata)
     {
         var field = (FieldMetadata) aspect;
         if (field.Updating())
         {
             schemaUpdateDetected.value = true;
         }
         if (isNull)
         {
             if (field.GetStoredType() == null || !field.GetStoredType().IsPrimitive())
             {
                 field.Set(context.PersistentObject(), null);
             }
             return;
         }
     }
     aspect.Activate(context);
 }