• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Internal.StatefulBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: WriteTransactionPointer

		protected virtual void WriteTransactionPointer(Transaction systemTransaction, int
			 transactionPointer, int address, int offset)
		{
			StatefulBuffer bytes = new StatefulBuffer(systemTransaction, address, TransactionPointerLength
				);
			bytes.MoveForward(offset);
			bytes.WriteInt(transactionPointer);
			bytes.WriteInt(transactionPointer);
			// Dangerous write. 
			// On corruption transaction pointers will not be the same and nothing will happen.
			bytes.Write();
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:12,代码来源:FileHeader.cs


示例17: ArrayTypeFor

 private ArrayType ArrayTypeFor(StatefulBuffer buffer, object obj)
 {
     return buffer.Transaction().Container()._handlers.ArrayType(obj);
 }
开发者ID:masroore,项目名称:db4o,代码行数:4,代码来源:ClassMetadata.cs


示例18: Read

		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		public override object Read(MarshallerFamily mf, StatefulBuffer buffer, bool redirect
			)
		{
			return mf._primitive.ReadDouble(buffer);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:6,代码来源:DoubleHandler.cs


示例19: GetWriter

		public virtual Db4objects.Db4o.CS.Internal.Messages.MsgD GetWriter(StatefulBuffer
			 bytes)
		{
			Db4objects.Db4o.CS.Internal.Messages.MsgD message = GetWriterForLength(bytes.Transaction
				(), bytes.Length());
			message._payLoad.Append(bytes._buffer);
			return message;
		}
开发者ID:erdincay,项目名称:db4o,代码行数:8,代码来源:MsgD.cs


示例20: AddFieldIndices

 public void AddFieldIndices(StatefulBuffer buffer)
 {
     if (!StandardReferenceTypeHandlerIsUsed())
     {
         return;
     }
     if (HasClassIndex() || HasVirtualAttributes())
     {
         var oh = new ObjectHeader(this, buffer);
         var context = new ObjectIdContextImpl(buffer.Transaction(), buffer
             , oh, buffer.GetID());
         Handlers4.FieldAwareTypeHandler(CorrectHandlerVersion(context)).AddFieldIndices(context
             );
     }
 }
开发者ID:masroore,项目名称:db4o,代码行数:15,代码来源:ClassMetadata.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Internal.Transaction类代码示例发布时间:2022-05-24
下一篇:
C# Internal.ObjectReference类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap