Example #1
0
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		internal override object Read1(ByteArrayBuffer a_bytes)
		{
			int offset = a_bytes._offset;
			object ret = Read(a_bytes._buffer, a_bytes._offset);
			a_bytes._offset = offset + LinkLength();
			return ret;
		}
Example #2
0
		private byte[] ReadName(LatinStringIO sio, ByteArrayBuffer reader)
		{
			byte[] nameBytes = sio.Bytes(reader);
			reader.IncrementOffset(nameBytes.Length);
			nameBytes = Platform4.UpdateClassName(nameBytes);
			return nameBytes;
		}
		public CacheContributingObjectReader(ClientTransaction transaction, IClientSlotCache
			 slotCache, ByteArrayBuffer reader)
		{
			_reader = reader;
			_transaction = transaction;
			_slotCache = slotCache;
		}
		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();
		}
Example #5
0
		public MockMarshallingContext(IObjectContainer objectContainer)
		{
			_objectContainer = objectContainer;
			_header = new ByteArrayBuffer(1000);
			_payLoad = new ByteArrayBuffer(1000);
			_current = _header;
		}
		protected override void WriteBuffer(ByteArrayBuffer buffer, bool shuttingDown)
		{
			base.WriteBuffer(buffer, shuttingDown);
			SystemData systemData = SystemData();
			buffer.WriteInt(systemData.IdToTimestampIndexId());
			buffer.WriteInt(systemData.TimestampToIdIndexId());
		}
Example #7
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);
		}
Example #8
0
		public Msg ReplyFromServer()
		{
			ByteArrayBuffer bytes = null;
			// readWriterByID may fail in certain cases, for instance if
			// and object was deleted by another client
			try
			{
				lock (ContainerLock())
				{
					bytes = Container().ReadBufferById(Transaction(), _payLoad.ReadInt(), _payLoad.ReadInt
						() == 1);
				}
				if (bytes == null)
				{
					bytes = new ByteArrayBuffer(0);
				}
			}
			catch (Db4oRecoverableException exc)
			{
				throw;
			}
			catch (Exception exc)
			{
				throw new Db4oRecoverableException(exc);
			}
			return Msg.ReadBytes.GetWriter(Transaction(), bytes);
		}
		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));
		}
		public virtual void WriteIndexEntry(IContext context, ByteArrayBuffer reader, object
			 obj)
		{
			MappedIDPair mappedIDs = (MappedIDPair)obj;
			_origHandler.WriteIndexEntry(context, reader, mappedIDs.Orig());
			_mappedHandler.WriteIndexEntry(context, reader, mappedIDs.Mapped());
		}
			public _IRunnable_65(FileHeaderVariablePart2 _enclosing, int length, ByteArrayBuffer
				 buffer)
			{
				this._enclosing = _enclosing;
				this.length = length;
				this.buffer = buffer;
			}
		public TreeReader(ByteArrayBuffer a_bytes, IReadable a_template, bool a_orderOnRead
			)
		{
			i_template = a_template;
			i_bytes = a_bytes;
			i_orderOnRead = a_orderOnRead;
		}
		public UnmarshallingContext(Transaction transaction, ByteArrayBuffer buffer, ObjectReference
			 @ref, int addToIDTree, bool checkIDTree) : base(transaction, buffer, null, @ref
			)
		{
			_addToIDTree = addToIDTree;
			_checkIDTree = checkIDTree;
		}
Example #14
0
		public virtual void WriteIndexEntry(IContext context, ByteArrayBuffer writer, object
			 obj)
		{
			Slot slot = (Slot)obj;
			writer.WriteInt(slot.Address());
			writer.WriteInt(slot.Length());
		}
		protected override void ReadBuffer(ByteArrayBuffer buffer, bool versionsAreConsistent
			)
		{
			base.ReadBuffer(buffer, versionsAreConsistent);
			SystemData systemData = SystemData();
			systemData.IdToTimestampIndexId(buffer.ReadInt());
			systemData.TimestampToIdIndexId(buffer.ReadInt());
		}
Example #16
0
		private void AppendPayLoad(StatefulBuffer target, Pointer4 pointer, ByteArrayBuffer
			 payLoad)
		{
			target.WriteInt(payLoad.Length());
			target.WriteInt(pointer.Id());
			target.WriteInt(pointer.Address());
			target.Append(payLoad._buffer);
		}
 public bool ContainsTheSame(Db4objects.Db4o.Internal.ByteArrayBuffer other)
 {
     if (other != null)
     {
         return(Arrays4.Equals(_buffer, other._buffer));
     }
     return(false);
 }
Example #18
0
		public Db4objects.Db4o.CS.Internal.Messages.MsgD GetWriterForBuffer(Transaction trans
			, ByteArrayBuffer buffer)
		{
			Db4objects.Db4o.CS.Internal.Messages.MsgD writer = GetWriterForLength(trans, buffer
				.Length());
			writer.WriteBytes(buffer._buffer);
			return writer;
		}
		internal override object Read1(ByteArrayBuffer a_bytes)
		{
			byte b1 = a_bytes.ReadByte();
			byte b2 = a_bytes.ReadByte();
			char ret = (char)((b1 & unchecked((int)(0xff))) | ((b2 & unchecked((int)(0xff))) 
				<< 8));
			return ret;
		}
Example #20
0
		internal static void WriteShort(int a_short, ByteArrayBuffer a_bytes)
		{
			for (int i = 0; i < Const4.ShortBytes; i++)
			{
				a_bytes._buffer[a_bytes._offset++] = (byte)(a_short >> ((Const4.ShortBytes - 1 - 
					i) * 8));
			}
		}
Example #21
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;
		}
 protected virtual void ProduceSomeFreeSpace()
 {
     var length = 300;
     var slot = LocalContainer().AllocateSlot(length);
     var buffer = new ByteArrayBuffer(length);
     LocalContainer().WriteBytes(buffer, slot.Address(), 0);
     LocalContainer().Free(slot);
 }
Example #23
0
		public override void WriteThis(Transaction trans, ByteArrayBuffer writer)
		{
			writer.WriteInt(Size());
			for (int i = 0; i < _ints.Length; i++)
			{
				writer.WriteInt(_ints[i]);
			}
		}
Example #24
0
			public _IProcedure4_39(ClassMarshaller _enclosing, Transaction trans, ClassMetadata
				 clazz, ByteArrayBuffer writer)
			{
				this._enclosing = _enclosing;
				this.trans = trans;
				this.clazz = clazz;
				this.writer = writer;
			}
Example #25
0
		public DefragmentContextImpl(Db4objects.Db4o.Internal.DefragmentContextImpl parentContext
			, ObjectHeader header)
		{
			_source = parentContext._source;
			_target = parentContext._target;
			_services = parentContext._services;
			_objectHeader = header;
		}
Example #26
0
 public MsgD GetWriter(Transaction trans, Pointer4 pointer, ClassMetadata classMetadata
     , int param, ByteArrayBuffer buffer)
 {
     return GetWriter(trans, pointer, buffer, new[]
     {
         classMetadata.GetID(), param
     });
 }
 public virtual Db4objects.Db4o.Internal.ByteArrayBuffer ReadPayloadReader(int offset
                                                                           , int length)
 {
     Db4objects.Db4o.Internal.ByteArrayBuffer payLoad = new Db4objects.Db4o.Internal.ByteArrayBuffer
                                                            (length);
     System.Array.Copy(_buffer, offset, payLoad._buffer, 0, length);
     return(payLoad);
 }
Example #28
0
 public MsgD GetWriterForBuffer(Transaction trans
     , ByteArrayBuffer buffer)
 {
     var writer = GetWriterForLength(trans, buffer
         .Length());
     writer.WriteBytes(buffer._buffer);
     return writer;
 }
Example #29
0
		protected override FileHeader NewOnSignatureMatch(LocalObjectContainer file, ByteArrayBuffer
			 reader)
		{
			if (SignatureMatches(reader, Signature, Version()))
			{
				return CreateNew();
			}
			return null;
		}
Example #30
0
		public override object ReadShort(ByteArrayBuffer buffer)
		{
			short value = UnmarshallShort(buffer);
			if (value == short.MaxValue)
			{
				return null;
			}
			return value;
		}
Example #31
0
		public static short UnmarshallShort(ByteArrayBuffer buffer)
		{
			int ret = 0;
			for (int i = 0; i < Const4.ShortBytes; i++)
			{
				ret = (ret << 8) + (buffer._buffer[buffer._offset++] & unchecked((int)(0xff)));
			}
			return (short)ret;
		}
Example #32
0
		public override object ReadLong(ByteArrayBuffer buffer)
		{
			long value = buffer.ReadLong();
			if (value == long.MaxValue)
			{
				return null;
			}
			return value;
		}
Example #33
0
 public static void Write(ByteArrayBuffer buffer, Db4objects.Db4o.Internal.TreeInt
                          tree)
 {
     Write(buffer, tree, tree == null ? 0 : tree.Size());
 }
Example #34
0
 public static void Write(ByteArrayBuffer buffer, TreeInt
                          tree)
 {
     Write(buffer, tree, tree == null ? 0 : tree.Size());
 }
 public void ReadThis(Db4objects.Db4o.Internal.Transaction trans, ByteArrayBuffer
                      buffer)
 {
 }
Example #36
0
        /// <exception cref="System.IO.IOException"></exception>
        public ByteArrayBuffer SourceBufferById(int sourceId)
        {
            ByteArrayBuffer sourceBuffer = _services.SourceBufferByID(sourceId);

            return(sourceBuffer);
        }
 public virtual void CopyTo(Db4objects.Db4o.Internal.ByteArrayBuffer to, int fromOffset
                            , int toOffset, int length)
 {
     System.Array.Copy(_buffer, fromOffset, to._buffer, toOffset, length);
 }
Example #38
0
 public virtual void TransferContentTo(ByteArrayBuffer buffer)
 {
     TransferContentTo(buffer, Length());
 }
Example #39
0
 public virtual void WriteIndexEntry(IContext context, ByteArrayBuffer a_writer, object
                                     a_object)
 {
 }
 public void WriteEncrypt(ByteArrayBuffer buffer, int address, int addressOffset)
 {
     _handlers.Encrypt(buffer);
     WriteBytes(buffer, address, addressOffset);
     _handlers.Decrypt(buffer);
 }
 public override void WriteBytes(ByteArrayBuffer buffer, int address, int addressOffset
                                 )
 {
     _memoryBin.Write(address + addressOffset, buffer._buffer, buffer.Length());
 }
Example #42
0
 public virtual void Read(ByteArrayBuffer buffer, IReadable template)
 {
     Clear();
     _tree = new TreeReader(buffer, template).Read();
     Changed();
 }
Example #43
0
 public TreeReader(ByteArrayBuffer a_bytes, IReadable a_template) : this(a_bytes,
                                                                         a_template, false)
 {
 }
Example #44
0
 public virtual void WriteOwnID(Transaction trans, ByteArrayBuffer writer)
 {
     Write(trans);
     writer.WriteInt(GetID());
 }
 public virtual void WriteThis(Db4objects.Db4o.Internal.Transaction trans, ByteArrayBuffer
                               buffer)
 {
 }
Example #46
0
 public virtual void Write(ByteArrayBuffer buffer)
 {
     buffer.WriteInt(_key);
 }
Example #47
0
 public virtual object Read(ByteArrayBuffer buffer)
 {
     return(new Db4objects.Db4o.Internal.TreeInt(buffer.ReadInt()));
 }
 public abstract void WriteBytes(ByteArrayBuffer buffer, int blockedAddress, int addressOffset
                                 );
Example #49
0
 public virtual object ReadIndexEntry(IContext context, ByteArrayBuffer a_reader)
 {
     return(null);
 }
Example #50
0
 public virtual object ReadIndexEntry(IContext context, ByteArrayBuffer reader)
 {
     return(new CommitTimestampSupport.TimestampEntry(reader.ReadInt(), reader.ReadLong
                                                          ()));
 }
Example #51
0
 public DefragmentContextImpl(ByteArrayBuffer source, IDefragmentServices services
                              ) : this(source, services, null)
 {
 }
Example #52
0
 private void IncrementStringOffset(LatinStringIO sio, ByteArrayBuffer buffer)
 {
     sio.ReadLengthAndString(buffer);
 }
Example #53
0
 public DefragmentContextImpl(ByteArrayBuffer source, Db4objects.Db4o.Internal.DefragmentContextImpl
                              context) : this(source, context._services, context._objectHeader)
 {
 }
Example #54
0
 public virtual object Read(ByteArrayBuffer buffer)
 {
     return(new TreeInt(buffer.ReadInt()));
 }
Example #55
0
 public void TargetWriteBytes(int address, ByteArrayBuffer buffer)
 {
     _services.TargetWriteBytes(buffer, address);
 }
        public virtual object ReadPrefetch(Db4objects.Db4o.Internal.Transaction trans, ByteArrayBuffer
                                           buffer, int addToIDTree)
        {
            UnmarshallingContext context = new UnmarshallingContext(trans, buffer, this, addToIDTree
                                                                    , false);

            context.ActivationDepth(new FixedActivationDepth(1, ActivationMode.Prefetch));
            return(context.Read());
        }
Example #57
0
 public virtual void Write(ByteArrayBuffer buffer)
 {
     buffer.WriteInt(_id);
     buffer.WriteInt(Length());
     buffer.Append(_bytes);
 }
Example #58
0
 public _IVisitor4_97(ByteArrayBuffer buffer)
 {
     this.buffer = buffer;
 }
Example #59
0
 protected virtual void Read(Transaction trans, ByteArrayBuffer reader)
 {
     ReadThis(trans, reader);
     SetStateOnRead(reader);
 }
Example #60
0
 public abstract void WriteThis(Transaction arg1, ByteArrayBuffer arg2);