예제 #1
0
		public virtual void Put(Db4oDatabase db)
		{
			Db4oDatabase existing = (Db4oDatabase)_identities.Get(db.GetSignature());
			if (existing == null)
			{
				_identities.Put(db.GetSignature(), db);
			}
		}
		public FrozenObjectInfo(object @object, long id, Db4oDatabase sourceDatabase, long
			 uuidLongPart, long commitTimestamp)
		{
			_sourceDatabase = sourceDatabase;
			_uuidLongPart = uuidLongPart;
			_id = id;
			_commitTimestamp = commitTimestamp;
			_object = @object;
		}
예제 #3
0
		internal virtual Db4oDatabase Produce(byte[] signature, long creationTime)
		{
			Db4oDatabase db = (Db4oDatabase)_identities.Get(signature);
			if (db != null)
			{
				return db;
			}
			db = new Db4oDatabase(signature, creationTime);
			db.Bind(_stream.Transaction);
			_identities.Put(signature, db);
			return db;
		}
		public Db4oReplicationReferenceImpl(object myObject, Db4oDatabase db, long longPart
			, long version)
		{
			SetObject(myObject);
			Ref_init();
			Db4objects.Db4o.Internal.VirtualAttributes va = new Db4objects.Db4o.Internal.VirtualAttributes
				();
			va.i_database = db;
			va.i_uuid = longPart;
			va.i_version = version;
			SetVirtualAttributes(va);
		}
예제 #5
0
		public Db4oReplicationReferenceImpl(object obj, Db4oDatabase db, long longPart, long
			 version)
		{
			if (obj == null)
			{
				throw new InvalidOperationException("obj may not be null");
			}
			SetObject(obj);
			Ref_init();
			Db4objects.Db4o.Internal.VirtualAttributes va = new Db4objects.Db4o.Internal.VirtualAttributes
				();
			va.i_database = db;
			va.i_uuid = longPart;
			va.i_version = version;
			_version = version;
			SetVirtualAttributes(va);
		}
예제 #6
0
		public override Db4oDatabase Identity()
		{
			if (i_db == null)
			{
				Write(Msg.Identity);
				ByteArrayBuffer reader = ExpectedBufferResponse(Msg.IdList);
				ShowInternalClasses(true);
				try
				{
					i_db = (Db4oDatabase)GetByID(SystemTransaction(), reader.ReadInt());
					Activate(SystemTransaction(), i_db, new FixedActivationDepth(3));
				}
				finally
				{
					ShowInternalClasses(false);
				}
			}
			return i_db;
		}
예제 #7
0
		public ReplicationRecord(Db4oDatabase younger, Db4oDatabase older)
		{
			_youngerPeer = younger;
			_olderPeer = older;
		}
예제 #8
0
		public static Db4objects.Drs.Db4o.ReplicationRecord QueryForReplicationRecord(ObjectContainerBase
			 container, Transaction trans, Db4oDatabase younger, Db4oDatabase older)
		{
			container.ShowInternalClasses(true);
			try
			{
				IQuery q = container.Query(trans);
				q.Constrain(typeof(Db4objects.Drs.Db4o.ReplicationRecord));
				q.Descend("_youngerPeer").Constrain(younger).Identity();
				q.Descend("_olderPeer").Constrain(older).Identity();
				IObjectSet objectSet = q.Execute();
				if (objectSet.HasNext())
				{
					Db4objects.Drs.Db4o.ReplicationRecord replicationRecord = (Db4objects.Drs.Db4o.ReplicationRecord
						)objectSet.Next();
					container.Activate(replicationRecord, int.MaxValue);
					return replicationRecord;
				}
				return null;
			}
			finally
			{
				container.ShowInternalClasses(false);
			}
		}
예제 #9
0
 public virtual bool IsOlderThan(Db4oDatabase peer)
 {
     if (peer == this)
     {
         throw new ArgumentException();
     }
     if (i_uuid != peer.i_uuid)
     {
         return i_uuid < peer.i_uuid;
     }
     // the above logic has failed, both are the same
     // age but we still want to distinguish in some 
     // way, to have an order in the ReplicationRecord
     // The following is arbitrary, it only needs to
     // be repeatable.
     // Let's distinguish by signature length 
     if (i_signature.Length != peer.i_signature.Length)
     {
         return i_signature.Length < peer.i_signature.Length;
     }
     for (var i = 0; i < i_signature.Length; i++)
     {
         if (i_signature[i] != peer.i_signature[i])
         {
             return i_signature[i] < peer.i_signature[i];
         }
     }
     // This should never happen.
     // FIXME: Add a message and move to Messages.
     // 
     throw new Exception();
 }
예제 #10
0
파일: SystemData.cs 프로젝트: erdincay/db4o
		public virtual void Identity(Db4oDatabase identityObject)
		{
			_identity = identityObject;
		}
		public Db4oReplicationProviderSignature(Db4oDatabase delegate_)
		{
			_delegate = delegate_;
		}
예제 #12
0
		public virtual void SetIdentity(Db4oDatabase identity)
		{
			lock (Lock())
			{
				_systemData.Identity(identity);
				// The dirty TimeStampIdGenerator triggers writing of
				// the variable part of the systemdata. We need to
				// make it dirty here, so the new identity is persisted:
				_timeStampIdGenerator.Generate();
				_fileHeader.WriteVariablePart(this);
			}
		}