public override byte[] GetResultCookie() { byte[] resultCookie = base.GetResultCookie(); if (resultCookie != null) { this.FullSyncPageToken.TenantScopedBackSyncCookie = BackSyncCookie.Parse(resultCookie); } return(this.FullSyncPageToken.ToByteArray()); }
private MergePageToken(MergeState mergeState, byte[] tenantFullSyncPageTokenBytes, byte[] incrementalSyncCookieBytes, Dictionary <string, int> errorObjectsAndFailureCounts) : base(tenantFullSyncPageTokenBytes) { ExTraceGlobals.MergeTracer.TraceDebug((long)base.TenantExternalDirectoryId.GetHashCode(), "New MergePageToken"); this.MergeState = mergeState; ExTraceGlobals.MergeTracer.TraceDebug <string>((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken this.MergeState = {0}", this.MergeState.ToString()); this.BackSyncCookie = BackSyncCookie.Parse(incrementalSyncCookieBytes); if (!this.BackSyncCookie.ServiceInstanceId.Equals(base.ServiceInstanceId)) { ExTraceGlobals.MergeTracer.TraceError((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken serviceInstanceId != tenantFullSyncPageTokenBytes.ServiceInstanceId"); throw new InvalidCookieException(new ArgumentException("serviceInstanceId")); } this.MergeVersion = 2; ExTraceGlobals.MergeTracer.TraceDebug <int>((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken this.MergeVersion = {0}", this.MergeVersion); this.dirSyncCookie = ADDirSyncCookie.Parse(this.BackSyncCookie.DirSyncCookie); base.ErrorObjectsAndFailureCounts = (errorObjectsAndFailureCounts ?? new Dictionary <string, int>()); if (!this.BackSyncCookie.ReadyToMerge || this.dirSyncCookie.MoreData) { ExTraceGlobals.MergeTracer.TraceError((long)base.TenantExternalDirectoryId.GetHashCode(), "MergePageToken !this.BackSyncCookie.ReadyToMerge || dirSyncCookie.MoreData"); throw new InvalidCookieException(new ArgumentException("incrementalSyncCookieBytes")); } }
protected TenantFullSyncPageToken(byte[] tokenBytes) { Exception ex = null; try { using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(tokenBytes, typeof(TenantFullSyncPageToken))) { this.Version = (int)backSyncCookieReader.GetNextAttributeValue(); this.ServiceInstanceId = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue()); this.Timestamp = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue()); this.LastReadFailureStartTime = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue()); this.InvocationId = (Guid)backSyncCookieReader.GetNextAttributeValue(); this.TenantExternalDirectoryId = (Guid)backSyncCookieReader.GetNextAttributeValue(); this.TenantObjectGuid = (Guid)backSyncCookieReader.GetNextAttributeValue(); this.State = (TenantFullSyncState)backSyncCookieReader.GetNextAttributeValue(); this.ObjectUpdateSequenceNumber = (long)backSyncCookieReader.GetNextAttributeValue(); this.TombstoneUpdateSequenceNumber = (long)backSyncCookieReader.GetNextAttributeValue(); byte[] array = (byte[])backSyncCookieReader.GetNextAttributeValue(); if (array != null) { this.PendingWatermarks = WatermarkMap.Parse(array); } this.PendingWatermarksInvocationId = (Guid)backSyncCookieReader.GetNextAttributeValue(); byte[] array2 = (byte[])backSyncCookieReader.GetNextAttributeValue(); if (array2 != null) { this.Watermarks = WatermarkMap.Parse(array2); } this.WatermarksInvocationId = (Guid)backSyncCookieReader.GetNextAttributeValue(); this.LinkPageStart = (long)backSyncCookieReader.GetNextAttributeValue(); this.LinkPageEnd = (long)backSyncCookieReader.GetNextAttributeValue(); this.LinkRangeStart = (int)backSyncCookieReader.GetNextAttributeValue(); this.ObjectsInLinkPage = (int)backSyncCookieReader.GetNextAttributeValue(); string[] array3 = (string[])backSyncCookieReader.GetNextAttributeValue(); this.ErrorObjectsAndFailureCounts = ((array3 != null) ? BackSyncCookie.ParseErrorObjectsAndFailureCounts(array3) : new Dictionary <string, int>()); this.SequenceStartTimestamp = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue()); this.SequenceId = (Guid)backSyncCookieReader.GetNextAttributeValue(); byte[] array4 = (byte[])backSyncCookieReader.GetNextAttributeValue(); if (array4 != null) { this.TenantScopedBackSyncCookie = BackSyncCookie.Parse(array4); this.InvocationId = this.TenantScopedBackSyncCookie.InvocationId; } this.UseContainerizedUsnChangedIndex = (bool)backSyncCookieReader.GetNextAttributeValue(); this.SoftDeletedObjectUpdateSequenceNumber = (long)backSyncCookieReader.GetNextAttributeValue(); this.PreviousState = (TenantFullSyncState)backSyncCookieReader.GetNextAttributeValue(); } } catch (ArgumentException ex2) { ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken ArgumentException {0}", ex2.ToString()); ex = ex2; } catch (IOException ex3) { ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken IOException {0}", ex3.ToString()); ex = ex3; } catch (FormatException ex4) { ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken FormatException {0}", ex4.ToString()); ex = ex4; } catch (InvalidCookieException ex5) { ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken InvalidCookieException {0}", ex5.ToString()); ex = ex5; } if (ex != null) { ExTraceGlobals.TenantFullSyncTracer.TraceError <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken throw InvalidCookieException {0}", ex.ToString()); throw new InvalidCookieException(ex); } }