Exemplo n.º 1
0
 /// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
 public override void AddFieldIndex(ObjectIdContextImpl context)
 {
     var transaction = (LocalTransaction) context.Transaction();
     var localContainer = (LocalObjectContainer) transaction.Container
         ();
     var oldSlot = transaction.IdSystem().CommittedSlot(context.ObjectId());
     var savedOffset = context.Offset();
     var db4oDatabaseIdentityID = context.ReadInt();
     var uuid = context.ReadLong();
     context.Seek(savedOffset);
     var isnew = (oldSlot.IsNull());
     if ((uuid == 0 || db4oDatabaseIdentityID == 0) && context.ObjectId() > 0 && !isnew)
     {
         var identityAndUUID = ReadDatabaseIdentityIDAndUUID
             (localContainer, context.ClassMetadata(), oldSlot, false);
         db4oDatabaseIdentityID = identityAndUUID.databaseIdentityID;
         uuid = identityAndUUID.uuid;
     }
     if (db4oDatabaseIdentityID == 0)
     {
         db4oDatabaseIdentityID = localContainer.Identity().GetID(transaction);
     }
     if (uuid == 0)
     {
         uuid = localContainer.GenerateTimeStampId();
     }
     var writer = (StatefulBuffer) context.Buffer();
     writer.WriteInt(db4oDatabaseIdentityID);
     writer.WriteLong(uuid);
     if (isnew)
     {
         AddIndexEntry(writer, uuid);
     }
 }
		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);
				}
			}
		}
Exemplo n.º 3
0
 public _MarshallingInfoTraverseAspectCommand_414(ObjectIdContextImpl context, IMarshallingInfo
     baseArg1) : base(baseArg1)
 {
     this.context = context;
 }
Exemplo n.º 4
0
 public virtual void AddFieldIndices(ObjectIdContextImpl context)
 {
     ITraverseAspectCommand command = new _MarshallingInfoTraverseAspectCommand_414(context
         , EnsureFieldList(context));
     TraverseAllAspects(context, command);
 }
Exemplo n.º 5
0
		/// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
		public abstract override void AddFieldIndex(ObjectIdContextImpl context);
Exemplo n.º 6
0
 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
             );
     }
 }
Exemplo n.º 7
0
		/// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
		public override void AddFieldIndex(ObjectIdContextImpl context)
		{
			StatefulBuffer buffer = (StatefulBuffer)context.Buffer();
			buffer.WriteLong(context.Transaction().Container().GenerateTimeStampId());
		}
Exemplo n.º 8
0
 public virtual void AddFieldIndices(ObjectIdContextImpl context)
 {
 }
Exemplo n.º 9
0
		private object ReadIndexEntryForRebuild(StatefulBuffer writer, ObjectHeader oh)
		{
			ClassMetadata classMetadata = oh.ClassMetadata();
			if (classMetadata == null)
			{
				return DefaultValueForFieldType();
			}
			ObjectIdContextImpl context = new ObjectIdContextImpl(writer.Transaction(), writer
				, oh, writer.GetID());
			if (!classMetadata.SeekToField(context, this))
			{
				return DefaultValueForFieldType();
			}
			try
			{
				return ReadIndexEntry(context);
			}
			catch (CorruptionException exc)
			{
				throw new FieldIndexException(exc, this);
			}
		}
Exemplo n.º 10
0
		/// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
		public virtual void AddFieldIndex(ObjectIdContextImpl context)
		{
			if (!HasIndex())
			{
				IncrementOffset(context);
				return;
			}
			try
			{
				AddIndexEntry(context.Transaction(), context.ObjectId(), ReadIndexEntry(context));
			}
			catch (CorruptionException exc)
			{
				throw new FieldIndexException(exc, this);
			}
		}
		/// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
		public override void AddFieldIndex(ObjectIdContextImpl context)
		{
		}