当前位置: 首页>>代码示例>>C#>>正文


C# Internal.StatefulBuffer类代码示例

本文整理汇总了C#中Db4objects.Db4o.Internal.StatefulBuffer的典型用法代码示例。如果您正苦于以下问题:C# StatefulBuffer类的具体用法?C# StatefulBuffer怎么用?C# StatefulBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StatefulBuffer类属于Db4objects.Db4o.Internal命名空间,在下文中一共展示了StatefulBuffer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Generate

		/// <summary>generates a new Db4oDatabase object with a unique signature.</summary>
		/// <remarks>generates a new Db4oDatabase object with a unique signature.</remarks>
		public static Db4objects.Db4o.Ext.Db4oDatabase Generate()
		{
			StatefulBuffer writer = new StatefulBuffer(null, 300);
			new LatinStringIO().Write(writer, SignatureGenerator.GenerateSignature());
			return new Db4objects.Db4o.Ext.Db4oDatabase(writer.GetWrittenBytes(), Runtime.CurrentTimeMillis
				());
		}
开发者ID:erdincay,项目名称:db4o,代码行数:9,代码来源:Db4oDatabase.cs

示例2: WriteFixedPart

		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);
			}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:29,代码来源:FileHeader2.cs

示例3: ApplySlotChanges

		public override void ApplySlotChanges(IVisitable slotChangeTree, int slotChangeCount
			, Slot reservedSlot)
		{
			if (slotChangeCount > 0)
			{
				Slot transactionLogSlot = SlotLongEnoughForLog(slotChangeCount, reservedSlot) ? reservedSlot
					 : AllocateSlot(true, slotChangeCount);
				StatefulBuffer buffer = new StatefulBuffer(_container.SystemTransaction(), transactionLogSlot
					);
				buffer.WriteInt(transactionLogSlot.Length());
				buffer.WriteInt(slotChangeCount);
				AppendSlotChanges(buffer, slotChangeTree);
				buffer.Write();
				IRunnable commitHook = _container.CommitHook();
				FlushDatabaseFile();
				_container.WriteTransactionPointer(transactionLogSlot.Address());
				FlushDatabaseFile();
				if (WriteSlots(slotChangeTree))
				{
					FlushDatabaseFile();
				}
				_container.WriteTransactionPointer(0);
				commitHook.Run();
				FlushDatabaseFile();
				if (transactionLogSlot != reservedSlot)
				{
					FreeSlot(transactionLogSlot);
				}
			}
			FreeSlot(reservedSlot);
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:31,代码来源:EmbeddedTransactionLogHandler.cs

示例4: AppendPayLoad

		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);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:8,代码来源:MsgObject.cs

示例5: Test

		public virtual void Test()
		{
			StatefulBuffer writer = new StatefulBuffer(null, 300);
			string stringRepresentation = SignatureGenerator.GenerateSignature();
			new LatinStringIO().Write(writer, stringRepresentation);
			Signature signature = new Signature(writer.GetWrittenBytes());
			Assert.AreEqual(stringRepresentation, signature.ToString());
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:8,代码来源:SignatureTestCase.cs

示例6: GetWriter

		public sealed override MsgD GetWriter(StatefulBuffer bytes)
		{
			MsgD message = GetWriterForLength(bytes.Transaction(), bytes.Length() + Const4.IntLength
				);
			message._payLoad.WriteInt(bytes.GetAddress());
			message._payLoad.Append(bytes._buffer);
			return message;
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:8,代码来源:MReadSlot.cs

示例7: Marshall

		public static StatefulBuffer Marshall(Transaction ta, object obj)
		{
			SerializedGraph serialized = Marshall(ta.Container(), obj);
			StatefulBuffer buffer = new StatefulBuffer(ta, serialized.Length());
			buffer.Append(serialized._bytes);
			buffer.UseSlot(serialized._id, 0, serialized.Length());
			return buffer;
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:8,代码来源:Serializer.cs

示例8: ReadIndexEntryFromObjectSlot

		/// <summary>This readIndexEntry method reads from the parent slot.</summary>
		/// <remarks>This readIndexEntry method reads from the parent slot.</remarks>
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		public virtual object ReadIndexEntryFromObjectSlot(MarshallerFamily mf, StatefulBuffer
			 buffer)
		{
			int payLoadOffSet = buffer.ReadInt();
			int length = buffer.ReadInt();
			if (payLoadOffSet == 0)
			{
				return null;
			}
			return buffer.ReadPayloadWriter(payLoadOffSet, length);
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:15,代码来源:StringHandler.cs

示例9: DeleteMembers

		private void DeleteMembers(StatefulBuffer objectBytes)
		{
			ObjectHeader oh = new ObjectHeader(_clazz, objectBytes);
			DeleteInfo info = (DeleteInfo)TreeInt.Find(_transaction._delete, _id);
			if (info != null)
			{
				if (info._cascade > _cascade)
				{
					_cascade = info._cascade;
				}
			}
			objectBytes.SetCascadeDeletes(_cascade);
			DeleteContextImpl context = new DeleteContextImpl(objectBytes, oh, _clazz.ClassReflector
				(), null);
			_clazz.DeleteMembers(context, _typeInfo, true);
		}
开发者ID:Galigator,项目名称:db4o,代码行数:16,代码来源:WriteUpdateProcessor.cs

示例10: ReplyFromServer

		public Msg ReplyFromServer()
		{
			StatefulBuffer bytes = null;
			// readWriterByID may fail in certain cases, for instance if
			// and object was deleted by another client
			int id = _payLoad.ReadInt();
			int lastCommitted = _payLoad.ReadInt();
			lock (ContainerLock())
			{
				bytes = Container().ReadStatefulBufferById(Transaction(), id, lastCommitted == 1);
			}
			if (bytes == null)
			{
				bytes = new StatefulBuffer(Transaction(), 0, 0);
			}
			return Msg.ObjectToClient.GetWriter(bytes);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:17,代码来源:MReadObject.cs

示例11: ReplyFromServer

		public Msg ReplyFromServer()
		{
			int address = ReadInt();
			int length = ReadInt();
			lock (ContainerLock())
			{
				StatefulBuffer bytes = new StatefulBuffer(this.Transaction(), address, length);
				try
				{
					Container().ReadBytes(bytes._buffer, address, length);
					return GetWriter(bytes);
				}
				catch (Exception)
				{
					// TODO: not nicely handled on the client side yet
					return Msg.Null;
				}
			}
		}
开发者ID:bvangrinsven,项目名称:db4o-net,代码行数:19,代码来源:MReadSlot.cs

示例12: CompleteInterruptedTransaction

		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();
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:22,代码来源:EmbeddedTransactionLogHandler.cs

示例13: RebuildIndexForWriter

		protected virtual void RebuildIndexForWriter(LocalObjectContainer container, StatefulBuffer
			 buffer, int objectId)
		{
			ObjectHeader objectHeader = new ObjectHeader(container, buffer);
			ObjectIdContextImpl context = new ObjectIdContextImpl(container.SystemTransaction
				(), buffer, objectHeader, objectId);
			ClassMetadata classMetadata = context.ClassMetadata();
			if (classMetadata.IsStruct())
			{
				// We don't keep version information for structs.
				return;
			}
			if (classMetadata.SeekToField(container.SystemTransaction(), buffer, versionFieldMetadata
				) != HandlerVersion.Invalid)
			{
				long version = ((long)versionFieldMetadata.Read(context));
				if (version != 0)
				{
					LocalTransaction t = (LocalTransaction)container.SystemTransaction();
					t.CommitTimestampSupport().Put(container.SystemTransaction(), objectId, version);
				}
			}
		}
开发者ID:superyfwy,项目名称:db4o,代码行数:23,代码来源:VersionNumberToCommitTimestamp_8_0.cs

示例14: DeletePrimitiveEmbedded

		// FIXME: This code has not been called in any test case when the 
		//        new ArrayMarshaller was written.
		//        Apparently it only frees slots.
		//        For now the code simply returns without freeing.
		/// <param name="classPrimitive"></param>
		public void DeletePrimitiveEmbedded(StatefulBuffer buffer, PrimitiveTypeMetadata 
			classPrimitive)
		{
			buffer.ReadInt();
			//int address = a_bytes.readInt();
			buffer.ReadInt();
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:12,代码来源:ArrayHandler.cs

示例15: ReadFrom

		object IIndexableTypeHandler.ReadIndexEntryFromObjectSlot(MarshallerFamily mf, StatefulBuffer buffer)
		{
			return ReadFrom(buffer);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:4,代码来源:DateTimeOffsetTypeHandler.cs


注:本文中的Db4objects.Db4o.Internal.StatefulBuffer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。