public static Db4objects.Db4o.Internal.SerializedGraph Read(ByteArrayBuffer buffer
			)
		{
			int id = buffer.ReadInt();
			int length = buffer.ReadInt();
			return new Db4objects.Db4o.Internal.SerializedGraph(id, buffer.ReadBytes(length));
		}
Esempio n. 2
0
		// _key, _slot._address, _slot._length 
		public override object Read(ByteArrayBuffer buffer)
		{
			int id = buffer.ReadInt();
			Db4objects.Db4o.Internal.Slots.Slot slot = new Db4objects.Db4o.Internal.Slots.Slot
				(buffer.ReadInt(), buffer.ReadInt());
			return new Db4objects.Db4o.Internal.Ids.IdSlotTree(id, slot);
		}
		protected override void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent
			)
		{
			base.ReadBuffer(buffer, versionsAreConsistent);
			SystemData systemData = SystemData();
			systemData.IdToTimestampIndexId(buffer.ReadInt());
			systemData.TimestampToIdIndexId(buffer.ReadInt());
		}
Esempio n. 4
0
		public override void ReadThis(Transaction trans, ByteArrayBuffer reader)
		{
			int length = reader.ReadInt();
			_ints = new int[length];
			for (int i = 0; i < length; i++)
			{
				_ints[i] = reader.ReadInt();
			}
		}
Esempio n. 5
0
        public override void ReadThis(Transaction trans, ByteArrayBuffer reader)
        {
            int length = reader.ReadInt();

            _ints = new int[length];
            for (int i = 0; i < length; i++)
            {
                _ints[i] = reader.ReadInt();
            }
        }
Esempio n. 6
0
		public virtual void ReadThis(ByteArrayBuffer buffer)
		{
			SystemData().ConverterVersion(buffer.ReadInt());
			SystemData().FreespaceSystem(buffer.ReadByte());
			buffer.ReadInt();
			// was BTreeFreespaceId, converted to slot, can no longer be used
			SystemData().IdentityId(buffer.ReadInt());
			SystemData().LastTimeStampID(buffer.ReadLong());
			SystemData().UuidIndexId(buffer.ReadInt());
		}
Esempio n. 7
0
		public virtual RawClassSpec ReadSpec(Transaction trans, ByteArrayBuffer reader)
		{
			byte[] nameBytes = ReadName(trans, reader);
			string className = trans.Container().StringIO().Read(nameBytes);
			ReadMetaClassID(reader);
			// skip
			int ancestorID = reader.ReadInt();
			reader.IncrementOffset(Const4.IntLength);
			// index ID
			int numFields = reader.ReadInt();
			return new RawClassSpec(className, ancestorID, numFields);
		}
		public override void CompleteInterruptedTransaction(int transactionId1, int transactionId2
			)
		{
			if (!System.IO.File.Exists(LockFileName(_fileName)))
			{
				return;
			}
			if (!LockFileSignalsInterruptedTransaction())
			{
				return;
			}
			ByteArrayBuffer buffer = new ByteArrayBuffer(Const4.IntLength);
			OpenLogFile();
			Read(_logFile, buffer);
			int length = buffer.ReadInt();
			if (length > 0)
			{
				buffer = new ByteArrayBuffer(length);
				Read(_logFile, buffer);
				buffer.IncrementOffset(Const4.IntLength);
				ReadWriteSlotChanges(buffer);
			}
			DeleteLockFile();
			CloseLogFile();
			DeleteLogFile();
		}
        /// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
        private UUIDFieldMetadata.DatabaseIdentityIDAndUUID ReadDatabaseIdentityIDAndUUID
            (ObjectContainerBase container, ClassMetadata classMetadata, Slot oldSlot, bool
            checkClass)
        {
            if (DTrace.enabled)
            {
                DTrace.RereadOldUuid.LogLength(oldSlot.Address(), oldSlot.Length());
            }
            ByteArrayBuffer reader = container.DecryptedBufferByAddress(oldSlot.Address(), oldSlot
                                                                        .Length());

            if (checkClass)
            {
                ClassMetadata realClass = ClassMetadata.ReadClass(container, reader);
                if (realClass != classMetadata)
                {
                    return(null);
                }
            }
            if (classMetadata.SeekToField(container.Transaction, reader, this) == HandlerVersion
                .Invalid)
            {
                return(null);
            }
            return(new UUIDFieldMetadata.DatabaseIdentityIDAndUUID(reader.ReadInt(), reader.ReadLong
                                                                       ()));
        }
Esempio n. 10
0
		public virtual byte[] Bytes(ByteArrayBuffer buffer)
		{
			int len = buffer.ReadInt();
			len = BytesPerChar() * len;
			byte[] res = new byte[len];
			System.Array.Copy(buffer._buffer, buffer._offset, res, 0, len);
			return res;
		}
Esempio n. 11
0
		public override object Read(ByteArrayBuffer buffer)
		{
			int size = buffer.ReadInt();
			int address = buffer.ReadInt();
			if (size > sizeLimit)
			{
				Db4objects.Db4o.Internal.Freespace.FreeSlotNode node = new Db4objects.Db4o.Internal.Freespace.FreeSlotNode
					(size);
				node.CreatePeer(address);
				if (Deploy.debug && Debug4.xbytes)
				{
					DebugCheckBuffer(buffer, node);
				}
				return node;
			}
			return null;
		}
Esempio n. 12
0
		public override object ReadInteger(ByteArrayBuffer bytes)
		{
			int value = bytes.ReadInt();
			if (value == int.MaxValue)
			{
				return null;
			}
			return value;
		}
 private int[] ReadMetadataIds(ByteArrayBuffer buffer, int classCount)
 {
     int[] ids = new int[classCount];
     for (int i = 0; i < classCount; ++i)
     {
         ids[i] = buffer.ReadInt();
     }
     return(ids);
 }
		protected override void ReadIndex(ObjectContainerBase stream, ClassMetadata clazz
			, ByteArrayBuffer reader)
		{
			int indexID = reader.ReadInt();
			if (indexID == 0)
			{
				return;
			}
			clazz.Index().Read(stream, indexID);
		}
Esempio n. 15
0
		public virtual object ReadIndexEntry(IContext context, ByteArrayBuffer buffer)
		{
			int parentID = buffer.ReadInt();
			object objPart = _valueHandler.ReadIndexEntry(context, buffer);
			if (parentID < 0)
			{
				objPart = null;
				parentID = -parentID;
			}
			return new FieldIndexKeyImpl(parentID, objPart);
		}
        private int CopyUnindexedId(bool doRegister)
        {
            int orig = _source.ReadInt();

            // TODO: There is no test case for the zero case
            if (orig == 0)
            {
                _target.WriteInt(0);
                return(0);
            }
            int mapped = -1;

            try
            {
                mapped = _services.StrictMappedID(orig);
            }
            catch (MappingNotFoundException)
            {
                mapped = _services.TargetNewId();
                _services.MapIDs(orig, mapped, false);
                if (doRegister)
                {
                    _services.RegisterUnindexed(orig);
                }
            }
            _target.WriteInt(mapped);
            return(mapped);
        }
		public override object Read(ByteArrayBuffer a_bytes)
		{
			int key = a_bytes.ReadInt();
			object obj = null;
			if (_object is TreeInt)
			{
				obj = new TreeReader(a_bytes, (IReadable)_object).Read();
			}
			else
			{
				obj = ((IReadable)_object).Read(a_bytes);
			}
			return new Db4objects.Db4o.Internal.TreeIntObject(key, obj);
		}
Esempio n. 18
0
        public override object Read(ByteArrayBuffer a_bytes)
        {
            var    key = a_bytes.ReadInt();
            object obj = null;

            if (_object is TreeInt)
            {
                obj = new TreeReader(a_bytes, (IReadable)_object).Read();
            }
            else
            {
                obj = ((IReadable)_object).Read(a_bytes);
            }
            return(new TreeIntObject(key, obj));
        }
Esempio n. 19
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());
			}
		}
Esempio n. 20
0
        public int CopyID()
        {
            // This code is slightly redundant.
            // The profiler shows it's a hotspot.
            // The following would be non-redudant.
            // return copy(false, false);
            var id = _source.ReadInt();

            return(WriteMappedID(id));
        }
Esempio n. 21
0
		protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase
			 stream, ByteArrayBuffer reader)
		{
			RawFieldSpec spec = base.ReadSpec(aspectType, stream, reader);
			if (spec == null)
			{
				return null;
			}
			if (spec.IsVirtual())
			{
				return spec;
			}
			int indexID = reader.ReadInt();
			spec.IndexID(indexID);
			return spec;
		}
Esempio n. 22
0
		protected override RawFieldSpec ReadSpec(AspectType aspectType, ObjectContainerBase
			 stream, ByteArrayBuffer reader)
		{
			string name = StringHandler.ReadStringNoDebug(stream.Transaction.Context(), reader
				);
			if (!aspectType.IsFieldMetadata())
			{
				return new RawFieldSpec(aspectType, name);
			}
			if (name.IndexOf(Const4.VirtualFieldPrefix) == 0)
			{
				if (stream._handlers.VirtualFieldByName(name) != null)
				{
					return new RawFieldSpec(aspectType, name);
				}
			}
			int fieldTypeID = reader.ReadInt();
			byte attribs = reader.ReadByte();
			return new RawFieldSpec(aspectType, name, fieldTypeID, attribs);
		}
Esempio n. 23
0
		protected override void ReadIndex(ObjectContainerBase stream, ClassMetadata clazz
			, ByteArrayBuffer reader)
		{
			int indexID = reader.ReadInt();
			if (!stream.MaintainsIndices() || !(stream is LocalObjectContainer))
			{
				return;
			}
			if (Btree(clazz) != null)
			{
				return;
			}
			clazz.Index().Read(stream, ValidIndexId(indexID));
			if (IsOldClassIndex(indexID))
			{
				new ClassIndexesToBTrees_5_5().Convert((LocalObjectContainer)stream, indexID, Btree
					(clazz));
				stream.SetDirtyInSystemTransaction(clazz);
			}
		}
        public sealed override void ReadThis(Transaction trans, ByteArrayBuffer buffer)
        {
            int classCount = buffer.ReadInt();

            InitTables(classCount);
            ObjectContainerBase container = Container();

            int[]             ids           = ReadMetadataIds(buffer, classCount);
            ByteArrayBuffer[] metadataSlots = container.ReadSlotBuffers(trans, ids);
            for (int i = 0; i < classCount; ++i)
            {
                ClassMetadata classMetadata = new ClassMetadata(container, null);
                classMetadata.SetID(ids[i]);
                _classes.Add(classMetadata);
                _classMetadataByID.Put(ids[i], classMetadata);
                byte[] name = classMetadata.ReadName1(trans, metadataSlots[i]);
                if (name != null)
                {
                    _classMetadataByBytes.Put(name, classMetadata);
                }
            }
            ApplyReadAs();
        }
Esempio n. 25
0
        public override void ReadThis(Transaction trans, ByteArrayBuffer buffer)
        {
            var classCount = buffer.ReadInt();

            InitTables(classCount);
            var container     = Container();
            var ids           = ReadMetadataIds(buffer, classCount);
            var metadataSlots = container.ReadSlotBuffers(trans, ids);

            for (var i = 0; i < classCount; ++i)
            {
                var classMetadata = new ClassMetadata(container, null);
                classMetadata.SetID(ids[i]);
                _classes.Add(classMetadata);
                _classMetadataByID.Put(ids[i], classMetadata);
                var name = classMetadata.ReadName1(trans, metadataSlots[i]);
                if (name != null)
                {
                    _classMetadataByBytes.Put(name, classMetadata);
                }
            }
            ApplyReadAs();
        }
Esempio n. 26
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);
		}
Esempio n. 27
0
 public virtual object Read(ByteArrayBuffer buffer)
 {
     return(new TreeInt(buffer.ReadInt()));
 }
Esempio n. 28
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;
		}
Esempio n. 29
0
		public void Read(ObjectContainerBase stream, ClassMetadata clazz, ByteArrayBuffer
			 reader)
		{
			clazz.SetAncestor(stream.ClassMetadataForID(reader.ReadInt()));
			//        if(clazz.callConstructor()){
			//            // The logic further down checks the ancestor YapClass, whether
			//            // or not it is allowed, not to call constructors. The ancestor
			//            // YapClass may possibly have not been loaded yet.
			//            clazz.createConstructor(true);
			//        }
			clazz.CheckType();
			ReadIndex(stream, clazz, reader);
			clazz._aspects = ReadAspects(stream, reader, clazz);
		}
Esempio n. 30
0
		public override object Read(ByteArrayBuffer reader)
		{
			SlotChange change = new SlotChange(reader.ReadInt());
			Slot newSlot = new Slot(reader.ReadInt(), reader.ReadInt());
			change.NewSlot(newSlot);
			return change;
		}
Esempio n. 31
0
 public Tree Read()
 {
     return(Read(i_bytes.ReadInt()));
 }
Esempio n. 32
0
 public virtual object Read(ByteArrayBuffer buffer)
 {
     return(new Db4objects.Db4o.Internal.TreeInt(buffer.ReadInt()));
 }
Esempio n. 33
0
		internal sealed override Msg ReadPayLoad(IMessageDispatcher messageDispatcher, Transaction
			 a_trans, Socket4Adapter sock, ByteArrayBuffer reader)
		{
			int length = reader.ReadInt();
			a_trans = CheckParentTransaction(a_trans, reader);
			Db4objects.Db4o.CS.Internal.Messages.MsgD command = (Db4objects.Db4o.CS.Internal.Messages.MsgD
				)PublicClone();
			command.SetTransaction(a_trans);
			command.SetMessageDispatcher(messageDispatcher);
			command._payLoad = ReadMessageBuffer(a_trans, sock, length);
			return command;
		}
		public virtual IFixedSizeIntIterator4 Unmarshall(ClientTransaction transaction, IClientSlotCache
			 slotCache, ByteArrayBuffer reader)
		{
			int size = reader.ReadInt();
			return new _IFixedSizeIntIterator4_34(size, reader);
		}
		public sealed override void ReadThis(Transaction trans, ByteArrayBuffer buffer)
		{
			int classCount = buffer.ReadInt();
			InitTables(classCount);
			ObjectContainerBase container = Container();
			int[] ids = ReadMetadataIds(buffer, classCount);
			ByteArrayBuffer[] metadataSlots = container.ReadSlotBuffers(trans, ids);
			for (int i = 0; i < classCount; ++i)
			{
				ClassMetadata classMetadata = new ClassMetadata(container, null);
				classMetadata.SetID(ids[i]);
				_classes.Add(classMetadata);
				_classMetadataByID.Put(ids[i], classMetadata);
				byte[] name = classMetadata.ReadName1(trans, metadataSlots[i]);
				if (name != null)
				{
					_classMetadataByBytes.Put(name, classMetadata);
				}
			}
			ApplyReadAs();
		}
		private int[] ReadMetadataIds(ByteArrayBuffer buffer, int classCount)
		{
			int[] ids = new int[classCount];
			for (int i = 0; i < classCount; ++i)
			{
				ids[i] = buffer.ReadInt();
			}
			return ids;
		}
Esempio n. 37
0
		public int ReadMetaClassID(ByteArrayBuffer reader)
		{
			return reader.ReadInt();
		}
		public ObjectHeaderAttributes(ByteArrayBuffer reader)
		{
			_fieldCount = reader.ReadInt();
			_nullBitMap = reader.ReadBitMap(_fieldCount);
		}
		public static Db4objects.Db4o.Internal.Ids.IdSlotMapping Read(ByteArrayBuffer buffer
			)
		{
			return new Db4objects.Db4o.Internal.Ids.IdSlotMapping(buffer.ReadInt(), buffer.ReadInt
				(), buffer.ReadInt());
		}
		public override object ReadInteger(ByteArrayBuffer bytes)
		{
			return bytes.ReadInt();
		}
Esempio n. 41
0
		public virtual object Read(ByteArrayBuffer buffer)
		{
			return new Db4objects.Db4o.Internal.TreeInt(buffer.ReadInt());
		}
Esempio n. 42
0
 public virtual object ReadIndexEntry(IContext context, ByteArrayBuffer reader)
 {
     return(new CommitTimestampSupport.TimestampEntry(reader.ReadInt(), reader.ReadLong
                                                          ()));
 }