Exemplo n.º 1
0
 public virtual void StartReplicationTransaction(IReadonlyReplicationProviderSignature
                                                 peerSignature)
 {
     ClearAllReferences();
     lock (Lock())
     {
         Transaction  trans      = _container.Transaction;
         Db4oDatabase myIdentity = _container.Identity();
         _signatureMap.Put(myIdentity);
         Db4oDatabase otherIdentity = _signatureMap.Produce(peerSignature.GetSignature(),
                                                            peerSignature.GetCreated());
         Db4oDatabase younger = null;
         Db4oDatabase older   = null;
         if (myIdentity.IsOlderThan(otherIdentity))
         {
             younger = otherIdentity;
             older   = myIdentity;
         }
         else
         {
             younger = myIdentity;
             older   = otherIdentity;
         }
         _replicationRecord = ReplicationRecord.QueryForReplicationRecord(_container, trans
                                                                          , younger, older);
         if (_replicationRecord == null)
         {
             _replicationRecord = new ReplicationRecord(younger, older);
             _replicationRecord.Store(_container);
         }
     }
 }
		public virtual void StartReplicationTransaction(IReadonlyReplicationProviderSignature
			 peerSignature)
		{
			ClearAllReferences();
			lock (Lock())
			{
				Transaction trans = _container.Transaction;
				Db4oDatabase myIdentity = _container.Identity();
				_signatureMap.Put(myIdentity);
				Db4oDatabase otherIdentity = _signatureMap.Produce(peerSignature.GetSignature(), 
					peerSignature.GetCreated());
				Db4oDatabase younger = null;
				Db4oDatabase older = null;
				if (myIdentity.IsOlderThan(otherIdentity))
				{
					younger = otherIdentity;
					older = myIdentity;
				}
				else
				{
					younger = myIdentity;
					older = otherIdentity;
				}
				_replicationRecord = ReplicationRecord.QueryForReplicationRecord(_container, trans
					, younger, older);
				if (_replicationRecord == null)
				{
					_replicationRecord = new ReplicationRecord(younger, older);
					_replicationRecord.Store(_container);
				}
				else
				{
					_container.RaiseCommitTimestamp(_replicationRecord._version + 1);
				}
				_commitTimestamp = _container.GenerateTransactionTimestamp(0);
			}
		}