Beispiel #1
0
        public override void WriteThis(Transaction trans, ByteArrayBuffer buffer)
        {
            int      count       = 0;
            int      startOffset = buffer._offset;
            IContext context     = trans.Context();

            buffer.IncrementOffset(CountLeafAnd3LinkLength);
            if (_isLeaf)
            {
                for (int i = 0; i < _count; i++)
                {
                    object obj = InternalKey(trans, i);
                    if (obj != No4.Instance)
                    {
                        count++;
                        KeyHandler().WriteIndexEntry(context, buffer, obj);
                    }
                }
            }
            else
            {
                for (int i = 0; i < _count; i++)
                {
                    if (ChildCanSupplyFirstKey(i))
                    {
                        Db4objects.Db4o.Internal.Btree.BTreeNode child = (Db4objects.Db4o.Internal.Btree.BTreeNode
                                                                          )_children[i];
                        object childKey = child.FirstKey(trans);
                        if (childKey != No4.Instance)
                        {
                            count++;
                            KeyHandler().WriteIndexEntry(context, buffer, childKey);
                            buffer.WriteIDOf(trans, child);
                        }
                    }
                    else
                    {
                        count++;
                        KeyHandler().WriteIndexEntry(context, buffer, Key(i));
                        buffer.WriteIDOf(trans, _children[i]);
                    }
                }
            }
            int endOffset = buffer._offset;

            buffer._offset = startOffset;
            buffer.WriteInt(count);
            buffer.WriteByte(_isLeaf ? (byte)1 : (byte)0);
            buffer.WriteInt(_parentID);
            buffer.WriteInt(_previousID);
            buffer.WriteInt(_nextID);
            buffer._offset = endOffset;
        }
Beispiel #2
0
 public override void WriteThis(Transaction trans, ByteArrayBuffer a_writer)
 {
     a_writer.WriteByte(BtreeVersion);
     a_writer.WriteInt(_size);
     a_writer.WriteInt(NodeSize());
     a_writer.WriteIDOf(trans, _root);
 }
Beispiel #3
0
 public virtual void Write(Transaction trans, ClassMetadata clazz, ByteArrayBuffer
     writer)
 {
     writer.WriteShortString(trans, clazz.NameToWrite());
     var intFormerlyKnownAsMetaClassID = 0;
     writer.WriteInt(intFormerlyKnownAsMetaClassID);
     writer.WriteIDOf(trans, clazz._ancestor);
     WriteIndex(trans, clazz, writer);
     writer.WriteInt(clazz.DeclaredAspectCount());
     clazz.TraverseDeclaredAspects(new _IProcedure4_39(this, trans, clazz, writer));
 }
Beispiel #4
0
        public virtual void Write(Transaction trans, ClassMetadata clazz, ByteArrayBuffer
                                  writer)
        {
            writer.WriteShortString(trans, clazz.NameToWrite());
            var intFormerlyKnownAsMetaClassID = 0;

            writer.WriteInt(intFormerlyKnownAsMetaClassID);
            writer.WriteIDOf(trans, clazz._ancestor);
            WriteIndex(trans, clazz, writer);
            writer.WriteInt(clazz.DeclaredAspectCount());
            clazz.TraverseDeclaredAspects(new _IProcedure4_39(this, trans, clazz, writer));
        }
Beispiel #5
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));
 }
Beispiel #6
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));
        }
Beispiel #7
0
 public override void WriteThis(Transaction trans, ByteArrayBuffer a_writer)
 {
     a_writer.WriteByte(BtreeVersion);
     a_writer.WriteInt(_size);
     a_writer.WriteInt(NodeSize());
     a_writer.WriteIDOf(trans, _root);
 }
Beispiel #8
0
 public override void WriteThis(Transaction trans, ByteArrayBuffer buffer)
 {
     var count = 0;
     var startOffset = buffer._offset;
     var context = trans.Context();
     buffer.IncrementOffset(CountLeafAnd3LinkLength);
     if (_isLeaf)
     {
         for (var i = 0; i < _count; i++)
         {
             var obj = InternalKey(trans, i);
             if (obj != No4.Instance)
             {
                 count++;
                 KeyHandler().WriteIndexEntry(context, buffer, obj);
             }
         }
     }
     else
     {
         for (var i = 0; i < _count; i++)
         {
             if (ChildCanSupplyFirstKey(i))
             {
                 var child = (BTreeNode
                     ) _children[i];
                 var childKey = child.FirstKey(trans);
                 if (childKey != No4.Instance)
                 {
                     count++;
                     KeyHandler().WriteIndexEntry(context, buffer, childKey);
                     buffer.WriteIDOf(trans, child);
                 }
             }
             else
             {
                 count++;
                 KeyHandler().WriteIndexEntry(context, buffer, Key(i));
                 buffer.WriteIDOf(trans, _children[i]);
             }
         }
     }
     var endOffset = buffer._offset;
     buffer._offset = startOffset;
     buffer.WriteInt(count);
     buffer.WriteByte(_isLeaf ? (byte) 1 : (byte) 0);
     buffer.WriteInt(_parentID);
     buffer.WriteInt(_previousID);
     buffer.WriteInt(_nextID);
     buffer._offset = endOffset;
 }