Ejemplo n.º 1
0
            private object ObjectFor(Transaction trans, IObjectInfo info)
            {
                int id = (int)info.GetInternalID();
                HardObjectReference @ref = HardObjectReference.PeekPersisted(trans, id, 1);

                return(@ref._object);
            }
 public void OnEvent(object sender, Db4objects.Db4o.Events.CommitEventArgs args)
 {
     lock (this._enclosing._updatesMonitor)
     {
         Transaction           trans   = ((IInternalObjectContainer)client).Transaction;
         IObjectInfoCollection updated = ((CommitEventArgs)args).Updated;
         IEnumerator           infos   = updated.GetEnumerator();
         while (infos.MoveNext())
         {
             IObjectInfo info = (IObjectInfo)infos.Current;
             object      obj  = trans.ObjectForIdFromCache((int)info.GetInternalID());
             if (obj == null)
             {
                 continue;
             }
             // DEPTH may need to be 2 for member collections
             // to be updated also.
             client.Refresh(obj, 1);
         }
         if (this._enclosing.IsNetworkingCS())
         {
             Sharpen.Runtime.NotifyAll(this._enclosing._updatesMonitor);
         }
     }
 }
Ejemplo n.º 3
0
			public void Encode(ByteArrayOutputStream os, IObjectInfo info)
			{
				PrimitiveCodec.WriteLong(os, info.GetInternalID());
				long sourceDatabaseId = ((FrozenObjectInfo)info).SourceDatabaseId(this._enclosing
					.Transaction());
				PrimitiveCodec.WriteLong(os, sourceDatabaseId);
				PrimitiveCodec.WriteLong(os, ((FrozenObjectInfo)info).UuidLongPart());
				PrimitiveCodec.WriteLong(os, info.GetCommitTimestamp());
			}
Ejemplo n.º 4
0
 private void AssertInfosAreConsistent(long[] ids, IObjectInfo[] infos)
 {
     for (int i = 0; i < infos.Length; i++)
     {
         IObjectInfo info = Db().GetObjectInfo(Db().GetByID(ids[i]));
         Assert.AreEqual(info.GetInternalID(), infos[i].GetInternalID());
         Assert.AreEqual(info.GetUUID().GetLongPart(), infos[i].GetUUID().GetLongPart());
         Assert.AreSame(info.GetObject(), infos[i].GetObject());
     }
 }
Ejemplo n.º 5
0
            public void Encode(ByteArrayOutputStream os, IObjectInfo info)
            {
                PrimitiveCodec.WriteLong(os, info.GetInternalID());
                long sourceDatabaseId = ((FrozenObjectInfo)info).SourceDatabaseId(this._enclosing
                                                                                  .Transaction());

                PrimitiveCodec.WriteLong(os, sourceDatabaseId);
                PrimitiveCodec.WriteLong(os, ((FrozenObjectInfo)info).UuidLongPart());
                PrimitiveCodec.WriteLong(os, info.GetCommitTimestamp());
            }
Ejemplo n.º 6
0
 public long GetLocalID()
 {
     try
     {
         IObjectInfo objInfo = Db4oClient.Client.Ext().GetObjectInfo(m_genObject);
         return(objInfo != null?objInfo.GetInternalID() : 0);
     }
     catch (Exception oEx)
     {
         LoggingHelper.HandleException(oEx);
         return(0);
     }
 }
Ejemplo n.º 7
0
 private void AddTimestamp(Transaction trans, IEnumerator it, long commitTimestamp
                           )
 {
     while (it.MoveNext())
     {
         IObjectInfo objInfo = (IObjectInfo)it.Current;
         CommitTimestampSupport.TimestampEntry te = new CommitTimestampSupport.TimestampEntry
                                                        ((int)objInfo.GetInternalID(), commitTimestamp);
         CommitTimestampSupport.TimestampEntry oldEntry = (CommitTimestampSupport.TimestampEntry
                                                           ) this._enclosing._idToTimestamp.Remove(trans, te);
         if (oldEntry != null)
         {
             this._enclosing._timestampToId.Remove(trans, oldEntry);
         }
         if (commitTimestamp != 0)
         {
             this._enclosing._idToTimestamp.Add(trans, te);
             this._enclosing._timestampToId.Add(trans, te);
         }
     }
 }
Ejemplo n.º 8
0
 public void Encode(ByteArrayOutputStream os, IObjectInfo info)
 {
     PrimitiveCodec.WriteLong(os, info.GetInternalID());
 }
Ejemplo n.º 9
0
 public void Encode(ByteArrayOutputStream os, IObjectInfo info)
 {
     PrimitiveCodec.WriteLong(os, info.GetInternalID());
 }
			private object ObjectFor(Transaction trans, IObjectInfo info)
			{
				int id = (int)info.GetInternalID();
				HardObjectReference @ref = HardObjectReference.PeekPersisted(trans, id, 1);
				return @ref._object;
			}