public byte[] GetChangeBatch(uint batchSize, byte[] rawDestinationKnowledge, out byte[] changeDataRetriever) { GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider(); byte[] retVal = null; try { SyncKnowledge destinationKnowledge = SyncKnowledge.Deserialize(provider.IdFormats, rawDestinationKnowledge); object dataRetriever; ChangeBatch changeBatch = provider.GetChangeBatch(batchSize, destinationKnowledge, out dataRetriever); CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever(dataRetriever as IChangeDataRetriever, changeBatch); string debugCachedRetr = SerializerHelper.XmlSerialize(cachedChangeDataRetriever); changeDataRetriever = SerializerHelper.BinarySerialize(cachedChangeDataRetriever); retVal = changeBatch.Serialize(); } catch (SyncException e) { throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(), new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncFramework, e), true); } catch (Exception e) { throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(), new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncProvider, e), true); } return(retVal); }
public byte[] ProcessFullEnumerationChangeBatch(int resolutionPolicy, byte[] sourceChanges, byte[] rawChangeDataRetriever, byte[] changeApplierInfo) { GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider(); byte[] retVal = null; try { FullEnumerationChangeBatch sourceChangeBatch = FullEnumerationChangeBatch.Deserialize(provider.IdFormats, sourceChanges); CachedChangeDataRetriever chachedDataRetriever = SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever); retVal = provider.ProcessRemoteFullEnumerationChangeBatch((ConflictResolutionPolicy)resolutionPolicy, sourceChangeBatch, chachedDataRetriever, changeApplierInfo); } catch (SyncException e) { throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(), new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncFramework, e), true); } catch (Exception e) { throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(), new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncProvider, e), true); } return(retVal); }
public byte[] ProcessChangeBatch( ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, CachedChangeDataRetriever changeDataRetriever, byte[] changeApplierInfo) { return(provider.ProcessRemoteChangeBatch( resolutionPolicy, sourceChanges, changeDataRetriever, changeApplierInfo)); }
/// <summary> /// When overridden in a derived class, gets a change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider. /// </summary> /// <param name="batchSize">The number of changes to include in the change batch.</param> /// <param name="destinationKnowledge">The knowledge from the destination provider. This knowledge must be mapped by calling <see cref="M:Microsoft.Synchronization.SyncKnowledge.MapRemoteKnowledgeToLocal(Microsoft.Synchronization.SyncKnowledge)"/> on the source knowledge before it can be used for change enumeration.</param> /// <param name="changeDataRetriever">Returns an object that can be used to retrieve change data. It can be an <see cref="T:Microsoft.Synchronization.IChangeDataRetriever"/> object or a provider-specific object.</param> /// <returns> /// A change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider. Cannot be a null. /// </returns> public override ChangeBatch GetChangeBatch(uint batchSize, SyncKnowledge destinationKnowledge, out object changeDataRetriever) { byte[] rawDestinationKnowledge = destinationKnowledge.Serialize(); byte[] rawChangeDataRetriever; byte[] rawChangeBatch = _syncService.GetChangeBatch(batchSize, rawDestinationKnowledge, out rawChangeDataRetriever); CachedChangeDataRetriever cachedRetriever = SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever); changeDataRetriever = cachedRetriever; return(ChangeBatch.Deserialize(IdFormats, rawChangeBatch)); }
/// <summary> /// When overridden in a derived class, processes a set of changes for a full enumeration by applying changes to the item store. /// </summary> /// <param name="resolutionPolicy">The conflict resolution policy to use when this method applies changes.</param> /// <param name="sourceChanges">A batch of changes from the source provider to be applied locally.</param> /// <param name="changeDataRetriever">An object that can be used to retrieve change data. It can be an <see cref="T:Microsoft.Synchronization.IChangeDataRetriever"/> object or a provider-specific object.</param> /// <param name="syncCallbacks">An object that receives event notifications during change application.</param> /// <param name="sessionStatistics">Tracks change statistics. For a provider that uses custom change application, this object must be updated with the results of the change application.</param> public override void ProcessFullEnumerationChangeBatch(ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics) { CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever( changeDataRetriever as IChangeDataRetriever, sourceChanges); byte[] rawSourceChanges = sourceChanges.Serialize(); byte[] rawCachedChangeDataRetriever = SerializerHelper.BinarySerialize(cachedChangeDataRetriever); byte[] newChangeApplierInfo = _syncService.ProcessFullEnumerationChangeBatch( (int)resolutionPolicy, rawSourceChanges, rawCachedChangeDataRetriever, _syncSessionContext.ChangeApplierInfo); _syncSessionContext.ChangeApplierInfo = newChangeApplierInfo; }
/// <summary> /// When overridden in a derived class, gets a change batch that contains item metadata for items that have IDs greater than the specified lower bound, as part of a full enumeration. /// </summary> /// <param name="batchSize">The number of changes to include in the change batch.</param> /// <param name="lowerEnumerationBound">The lower bound for item IDs. This method returns changes that have IDs greater than or equal to this ID value.</param> /// <param name="knowledgeForDataRetrieval">If an item change is contained in this knowledge object, data for that item already exists on the destination replica.</param> /// <param name="changeDataRetriever">Returns an object that can be used to retrieve change data. It can be an <see cref="T:Microsoft.Synchronization.IChangeDataRetriever"/> object or a be provider-specific object.</param> /// <returns> /// A change batch that contains item metadata for items that have IDs greater than the specified lower bound, as part of a full enumeration. /// </returns> public override FullEnumerationChangeBatch GetFullEnumerationChangeBatch(uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out object changeDataRetriever) { byte[] rawLowerEnumBound = lowerEnumerationBound.RawId; byte[] rawKnowledgeForDataRetrieval = knowledgeForDataRetrieval.Serialize(); byte[] rawChangeDataRetriever; byte[] rawFullEnumerationChangeBatch = _syncService.GetFullEnumerationChangeBatch(batchSize, rawLowerEnumBound, rawKnowledgeForDataRetrieval, out rawChangeDataRetriever); CachedChangeDataRetriever cachedRetriever = SerializerHelper.BinaryDeserialize <CachedChangeDataRetriever>(rawChangeDataRetriever); changeDataRetriever = cachedRetriever; return(FullEnumerationChangeBatch.Deserialize(IdFormats, rawFullEnumerationChangeBatch)); }
public ChangeBatch GetChangeBatch( uint batchSize, SyncKnowledge destinationKnowledge, out CachedChangeDataRetriever changeDataRetriever) { object dataRetriever; ChangeBatch changeBatch = provider.GetChangeBatch( batchSize, destinationKnowledge, out dataRetriever); changeDataRetriever = new CachedChangeDataRetriever( dataRetriever as IChangeDataRetriever, changeBatch); return(changeBatch); }
public override void ProcessFullEnumerationChangeBatch( ConflictResolutionPolicy resolutionPolicy, FullEnumerationChangeBatch sourceChanges, object changeDataRetriever, SyncCallbacks syncCallback, SyncSessionStatistics sessionStatistics) { CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever( changeDataRetriever as IChangeDataRetriever, sourceChanges); byte[] newChangeApplierInfo = this.client.ProcessFullEnumerationChangeBatch( resolutionPolicy, sourceChanges, cachedChangeDataRetriever, this.syncSessionContext.ChangeApplierInfo); this.syncSessionContext.ChangeApplierInfo = newChangeApplierInfo; }
public FullEnumerationChangeBatch GetFullEnumerationChangeBatch( uint batchSize, SyncId lowerEnumerationBound, SyncKnowledge knowledgeForDataRetrieval, out CachedChangeDataRetriever changeDataRetriever) { object dataRetriever; FullEnumerationChangeBatch changeBatch = provider.GetFullEnumerationChangeBatch( batchSize, lowerEnumerationBound, knowledgeForDataRetrieval, out dataRetriever); changeDataRetriever = new CachedChangeDataRetriever( dataRetriever as IChangeDataRetriever, changeBatch); return(changeBatch); }
public byte[] GetFullEnumerationChangeBatch(uint batchSize, byte[] lowerEnumerationBoundRaw, byte[] rawKnowledgeForDataRetrieval, out byte[] changeDataRetriever) { GenericRemoteSyncProvider <EntityObjectHierarchy> provider = GetSessionProvider(); byte[] retVal = null; try { SyncKnowledge knowledgeForDataRetrieval = SyncKnowledge.Deserialize(provider.IdFormats, rawKnowledgeForDataRetrieval); SyncId lowerEnumerationBound = new SyncId(lowerEnumerationBoundRaw, false); object dataRetriever; FullEnumerationChangeBatch changeBatch = provider.GetFullEnumerationChangeBatch(batchSize, lowerEnumerationBound, knowledgeForDataRetrieval, out dataRetriever); CachedChangeDataRetriever cachedChangeDataRetriever = new CachedChangeDataRetriever(dataRetriever as IChangeDataRetriever, changeBatch); changeDataRetriever = SerializerHelper.BinarySerialize(cachedChangeDataRetriever); retVal = changeBatch.Serialize(); } catch (SyncException e) { throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(), new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncFramework, e), true); } catch (Exception e) { throw SoapErrorCreator.RaiseException(HttpContext.Current.Request.Url.ToString(), new SyncronizationServiceError(SyncronizationServiceError.eServiceErrorType.SyncProvider, e), true); } return(retVal); }