Exemplo n.º 1
0
        private void DebugCheckBuffer(ByteArrayBuffer buffer, Db4objects.Db4o.Internal.Freespace.FreeSlotNode
                                      node)
        {
            if (!(buffer is StatefulBuffer))
            {
                return;
            }
            Transaction trans = ((StatefulBuffer)buffer).Transaction();

            if (!(trans.Container() is IoAdaptedObjectContainer))
            {
                return;
            }
            StatefulBuffer checker = trans.Container().CreateStatefulBuffer(trans, node._peer
                                                                            ._key, node._key);

            checker.Read();
            for (int i = 0; i < node._key; i++)
            {
                if (checker.ReadByte() != (byte)'X')
                {
                    Sharpen.Runtime.Out.WriteLine("!!! Free space corruption at:" + node._peer._key);
                    break;
                }
            }
        }
 public override void CompleteInterruptedTransaction(int transactionId1, int transactionId2
     )
 {
     if (transactionId1 <= 0 || transactionId1 != transactionId2)
     {
         return;
     }
     var bytes = new StatefulBuffer(_container.SystemTransaction(), transactionId1
         , Const4.IntLength);
     bytes.Read();
     var length = bytes.ReadInt();
     if (length > 0)
     {
         bytes = new StatefulBuffer(_container.SystemTransaction(), transactionId1, length
             );
         bytes.Read();
         bytes.IncrementOffset(Const4.IntLength);
         ReadWriteSlotChanges(bytes);
     }
     _container.WriteTransactionPointer(0);
     FlushDatabaseFile();
 }
Exemplo n.º 3
0
        public override void CompleteInterruptedTransaction(int transactionId1, int transactionId2
                                                            )
        {
            if (transactionId1 <= 0 || transactionId1 != transactionId2)
            {
                return;
            }
            StatefulBuffer bytes = new StatefulBuffer(_container.SystemTransaction(), transactionId1
                                                      , Const4.IntLength);

            bytes.Read();
            int length = bytes.ReadInt();

            if (length > 0)
            {
                bytes = new StatefulBuffer(_container.SystemTransaction(), transactionId1, length
                                           );
                bytes.Read();
                bytes.IncrementOffset(Const4.IntLength);
                ReadWriteSlotChanges(bytes);
            }
            _container.WriteTransactionPointer(0);
            FlushDatabaseFile();
        }