Пример #1
0
        protected override void Read(LocalObjectContainer container, ByteArrayBuffer reader
                                     )
        {
            NewTimerFileLock(container);
            OldEncryptionOff(container);
            CheckThreadFileLock(container, reader);
            reader.Seek(BlocksizeOffset);
            container.BlockSizeReadFromFile(reader.ReadInt());
            SystemData systemData = container.SystemData();

            systemData.ClassCollectionID(reader.ReadInt());
            container.SystemData().IdSystemType(reader.ReadByte());
            _variablePart = CreateVariablePart(container);
            int variablePartAddress = reader.ReadInt();
            int variablePartLength  = reader.ReadInt();

            _variablePart.Read(variablePartAddress, variablePartLength);
            _transactionPointerAddress = reader.ReadInt();
            if (_transactionPointerAddress != 0)
            {
                ByteArrayBuffer buffer = new ByteArrayBuffer(TransactionPointerLength);
                buffer.Read(container, _transactionPointerAddress, 0);
                systemData.TransactionPointer1(buffer.ReadInt());
                systemData.TransactionPointer2(buffer.ReadInt());
            }
        }
Пример #2
0
        public override void WriteFixedPart(LocalObjectContainer file, bool startFileLockingThread
                                            , bool shuttingDown, StatefulBuffer writer, int blockSize)
        {
            SystemData systemData = file.SystemData();

            writer.Append(Signature);
            writer.WriteByte(Version());
            writer.WriteInt((int)TimeToWrite(_timerFileLock.OpenTime(), shuttingDown));
            writer.WriteLong(TimeToWrite(_timerFileLock.OpenTime(), shuttingDown));
            writer.WriteLong(TimeToWrite(Runtime.CurrentTimeMillis(), shuttingDown));
            writer.WriteInt(blockSize);
            writer.WriteInt(systemData.ClassCollectionID());
            writer.WriteByte(systemData.IdSystemType());
            writer.WriteInt(((FileHeaderVariablePart2)_variablePart).Address());
            writer.WriteInt(((FileHeaderVariablePart2)_variablePart).Length());
            writer.WriteInt(_transactionPointerAddress);
            writer.Write();
            if (shuttingDown)
            {
                WriteVariablePart(file, true);
            }
            else
            {
                file.SyncFiles();
            }
            if (startFileLockingThread)
            {
                file.ThreadPool().Start("db4o lock thread", _timerFileLock);
            }
        }
Пример #3
0
        protected override void Read(LocalObjectContainer file, ByteArrayBuffer reader)
        {
            NewTimerFileLock(file);
            OldEncryptionOff(file);
            CheckThreadFileLock(file, reader);
            reader.Seek(TransactionPointerOffset);
            file.SystemData().TransactionPointer1(reader.ReadInt());
            file.SystemData().TransactionPointer2(reader.ReadInt());
            reader.Seek(BlocksizeOffset);
            file.BlockSizeReadFromFile(reader.ReadInt());
            SystemData systemData = file.SystemData();

            systemData.ClassCollectionID(reader.ReadInt());
            reader.ReadInt();
            // was freespace ID, can no longer be read
            _variablePart = CreateVariablePart(file);
            int variablePartId = reader.ReadInt();

            _variablePart.Read(variablePartId, 0);
        }