public ServiceInstanceId(string serviceInstanceId) { if (ServiceInstanceId.IsValidServiceInstanceId(serviceInstanceId)) { this.InstanceId = serviceInstanceId; return; } throw new InvalidServiceInstanceIdException(serviceInstanceId); }
internal static ObjectFullSyncPageToken Parse(byte[] tokenBytes) { if (tokenBytes == null) { throw new ArgumentNullException("tokenBytes"); } Exception innerException; try { using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(tokenBytes, typeof(ObjectFullSyncPageToken))) { int num = (int)backSyncCookieReader.GetNextAttributeValue(); ServiceInstanceId serviceInstanceId = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue()); long dateData = (long)backSyncCookieReader.GetNextAttributeValue(); long dateData2 = (long)backSyncCookieReader.GetNextAttributeValue(); Guid invocationId = (Guid)backSyncCookieReader.GetNextAttributeValue(); BackSyncOptions syncOptions = (BackSyncOptions)((int)backSyncCookieReader.GetNextAttributeValue()); string[] array = (string[])backSyncCookieReader.GetNextAttributeValue(); byte[] array2 = (byte[])backSyncCookieReader.GetNextAttributeValue(); string[] errorObjects = (string[])backSyncCookieReader.GetNextAttributeValue(); Dictionary <string, int> errorObjectsAndCount = BackSyncCookie.ParseErrorObjectsAndFailureCounts(errorObjects); DateTime sequenceStartTimestamp = DateTime.FromBinary((long)backSyncCookieReader.GetNextAttributeValue()); Guid sequenceId = (Guid)backSyncCookieReader.GetNextAttributeValue(); HashSet <SyncObjectId> hashSet = new HashSet <SyncObjectId>(); if (array != null) { foreach (string identity in array) { hashSet.Add(SyncObjectId.Parse(identity)); } } FullSyncObjectCookie objectCookie = (array2 == null) ? null : FullSyncObjectCookie.Parse(array2); return(new ObjectFullSyncPageToken(invocationId, hashSet, syncOptions, DateTime.FromBinary(dateData), DateTime.FromBinary(dateData2), objectCookie, errorObjectsAndCount, serviceInstanceId, sequenceId, sequenceStartTimestamp)); } } catch (ArgumentException ex) { innerException = ex; } catch (IOException ex2) { innerException = ex2; } catch (FormatException ex3) { innerException = ex3; } catch (InvalidCookieException ex4) { innerException = ex4; } throw new InvalidCookieException(innerException); }
// Token: 0x060061E2 RID: 25058 RVA: 0x0014E6C0 File Offset: 0x0014C8C0 public static BackSyncCookie Parse(byte[] binaryCookie) { if (binaryCookie == null) { ExTraceGlobals.BackSyncTracer.TraceError((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse input binaryCookie is NULL"); throw new ArgumentNullException("binaryCookie"); } ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse Read BackSync binary cookie \"{0}\"", Convert.ToBase64String(binaryCookie)); Exception ex2; try { using (BackSyncCookieReader backSyncCookieReader = BackSyncCookieReader.Create(binaryCookie, typeof(BackSyncCookie))) { int num = (int)backSyncCookieReader.GetNextAttributeValue(); ServiceInstanceId serviceInstanceId = new ServiceInstanceId((string)backSyncCookieReader.GetNextAttributeValue()); long dateData = (long)backSyncCookieReader.GetNextAttributeValue(); long dateData2 = (long)backSyncCookieReader.GetNextAttributeValue(); Guid invocationId = (Guid)backSyncCookieReader.GetNextAttributeValue(); bool moreData = (bool)backSyncCookieReader.GetNextAttributeValue(); byte[] array = (byte[])backSyncCookieReader.GetNextAttributeValue(); if (array != null) { ADDirSyncCookie.Parse(array); } string[] errorObjects = (string[])backSyncCookieReader.GetNextAttributeValue(); Dictionary <string, int> errorObjects2 = BackSyncCookie.ParseErrorObjectsAndFailureCounts(errorObjects); long dateData3 = (long)backSyncCookieReader.GetNextAttributeValue(); byte[] lastDirSyncCookieWithReplicationVectors = (byte[])backSyncCookieReader.GetNextAttributeValue(); long dateData4 = (long)backSyncCookieReader.GetNextAttributeValue(); Guid sequenceId = (Guid)backSyncCookieReader.GetNextAttributeValue(); return(new BackSyncCookie(DateTime.FromBinary(dateData), DateTime.FromBinary(dateData2), DateTime.FromBinary(dateData3), invocationId, moreData, array, errorObjects2, lastDirSyncCookieWithReplicationVectors, serviceInstanceId, sequenceId, DateTime.FromBinary(dateData4))); } } catch (ArgumentException ex) { ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse ArgumentException {0}", ex.ToString()); ex2 = ex; } catch (IOException ex3) { ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse IOException {0}", ex3.ToString()); ex2 = ex3; } catch (FormatException ex4) { ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse FormatException {0}", ex4.ToString()); ex2 = ex4; } ExTraceGlobals.BackSyncTracer.TraceError <string>((long)SyncConfiguration.TraceId, "BackSyncCookie.Parse throw InvalidCookieException {0}", ex2.ToString()); throw new InvalidCookieException(ex2); }
// Token: 0x060061E8 RID: 25064 RVA: 0x0014F19C File Offset: 0x0014D39C private static void ReadCookieVersion(byte[] binaryCookie, out int cookieVersion, out ServiceInstanceId cookieServiceInstanceId) { int num = 0; string serviceInstanceId; using (MemoryStream memoryStream = new MemoryStream(binaryCookie)) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { num = binaryReader.ReadInt32(); serviceInstanceId = binaryReader.ReadString(); } } cookieVersion = num; cookieServiceInstanceId = new ServiceInstanceId(serviceInstanceId); }
public ObjectFullSyncPageToken(Guid invocationId, ICollection <SyncObjectId> objectIds, BackSyncOptions syncOptions, ServiceInstanceId serviceInstanceId) : this(invocationId, objectIds, syncOptions, DateTime.UtcNow, DateTime.MinValue, null, null, serviceInstanceId, Guid.NewGuid(), DateTime.UtcNow) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "New ObjectFullSyncPageToken"); }
public ObjectFullSyncPageToken(Guid invocationId, ICollection <SyncObjectId> objectIds, BackSyncOptions syncOptions, DateTime timestamp, DateTime lastReadFailureStartTime, FullSyncObjectCookie objectCookie, Dictionary <string, int> errorObjectsAndCount, ServiceInstanceId serviceInstanceId, Guid sequenceId, DateTime sequenceStartTimestamp) { this.Version = 2; ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "Version {0}", this.Version); this.Timestamp = timestamp; ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "Timestamp {0}", this.Timestamp); this.LastReadFailureStartTime = lastReadFailureStartTime; ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "LastReadFailureStartTime {0}", this.LastReadFailureStartTime); this.InvocationId = invocationId; ExTraceGlobals.BackSyncTracer.TraceDebug <Guid>((long)SyncConfiguration.TraceId, "InvocationId {0}", this.InvocationId); this.ObjectIds = new HashSet <SyncObjectId>(objectIds); ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "ObjectIds count = {0}", this.ObjectIds.Count); this.SyncOptions = syncOptions; ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "SyncOptions {0}", this.SyncOptions.ToString()); this.ServiceInstanceId = serviceInstanceId; ExTraceGlobals.BackSyncTracer.TraceDebug <ServiceInstanceId>((long)SyncConfiguration.TraceId, "SyncServiceInstanceId {0}", this.ServiceInstanceId); this.ObjectCookie = objectCookie; this.ErrorObjectsAndFailureCounts = (errorObjectsAndCount ?? new Dictionary <string, int>()); this.SequenceId = sequenceId; this.SequenceStartTimestamp = sequenceStartTimestamp; ExTraceGlobals.BackSyncTracer.TraceDebug <Guid, DateTime>((long)SyncConfiguration.TraceId, "BackSyncCookie this.SequenceId = {0} this.SequenceStartTimestamp = {1} ", this.SequenceId, this.SequenceStartTimestamp); }
// Token: 0x060061C8 RID: 25032 RVA: 0x0014E59C File Offset: 0x0014C79C public BackSyncCookie(ServiceInstanceId serviceInstanceId) : this(DateTime.MinValue, DateTime.MinValue, DateTime.MinValue, Guid.Empty, true, null, null, null, serviceInstanceId, Guid.NewGuid(), DateTime.UtcNow) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "Create BackSyncCookie for NULL cookie input"); }
// Token: 0x060061C7 RID: 25031 RVA: 0x0014E3C4 File Offset: 0x0014C5C4 public BackSyncCookie(DateTime timestamp, DateTime lastReadFailureStartTime, DateTime lastWhenChanged, Guid invocationId, bool moreData, byte[] rawCookie, Dictionary <string, int> errorObjects, byte[] lastDirSyncCookieWithReplicationVectors, ServiceInstanceId serviceInstanceId, Guid sequenceId, DateTime sequenceStartTimestamp) { ExTraceGlobals.BackSyncTracer.TraceDebug((long)SyncConfiguration.TraceId, "New BackSyncCookie"); this.MoreDirSyncData = moreData; ExTraceGlobals.BackSyncTracer.TraceDebug <bool>((long)SyncConfiguration.TraceId, "BackSyncCookie moreData {0}", moreData); this.Timestamp = timestamp; ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "BackSyncCookie timestamp {0}", timestamp); this.InvocationId = invocationId; ExTraceGlobals.BackSyncTracer.TraceDebug <Guid>((long)SyncConfiguration.TraceId, "BackSyncCookie invocationId {0}", invocationId); this.DirSyncCookie = rawCookie; ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "BackSyncCookie rawCookie {0}", (rawCookie != null) ? Convert.ToBase64String(rawCookie) : "NULL"); this.Version = 4; ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "BackSyncCookie version {0}", 4); this.LastReadFailureStartTime = lastReadFailureStartTime; ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "BackSyncCookie lastReadFailureStartTime {0}", lastReadFailureStartTime); this.LastWhenChanged = lastWhenChanged; ExTraceGlobals.BackSyncTracer.TraceDebug <DateTime>((long)SyncConfiguration.TraceId, "BackSyncCookie lastWhenChanged {0}", lastWhenChanged); this.ServiceInstanceId = serviceInstanceId; ExTraceGlobals.BackSyncTracer.TraceDebug <ServiceInstanceId>((long)SyncConfiguration.TraceId, "BackSyncCookie serviceInstanceId {0}", serviceInstanceId); if (errorObjects != null) { this.ErrorObjectsAndFailureCounts = errorObjects; } else { this.ErrorObjectsAndFailureCounts = new Dictionary <string, int>(); } ExTraceGlobals.BackSyncTracer.TraceDebug <int>((long)SyncConfiguration.TraceId, "BackSyncCookie ErrorObjectsAndFailureCounts count = {0}", this.ErrorObjectsAndFailureCounts.Count); this.LastDirSyncCookieWithReplicationVectors = lastDirSyncCookieWithReplicationVectors; ExTraceGlobals.BackSyncTracer.TraceDebug <string>((long)SyncConfiguration.TraceId, "BackSyncCookie lastDirSyncCookieWithReplicationVectors {0}", (lastDirSyncCookieWithReplicationVectors != null) ? Convert.ToBase64String(lastDirSyncCookieWithReplicationVectors) : "NULL"); this.SequenceId = (moreData ? sequenceId : Guid.NewGuid()); this.SequenceStartTimestamp = (moreData ? sequenceStartTimestamp : DateTime.UtcNow); ExTraceGlobals.BackSyncTracer.TraceDebug <Guid, DateTime>((long)SyncConfiguration.TraceId, "BackSyncCookie this.SequenceId = {0} this.SequenceStartTimestamp = {1} ", this.SequenceId, this.SequenceStartTimestamp); }
// Token: 0x060063F2 RID: 25586 RVA: 0x0015B164 File Offset: 0x00159364 public CompoundSyncObjectId(SyncObjectId syncObjectId, ServiceInstanceId serviceInstanceId) { this.SyncObjectId = syncObjectId; this.ServiceInstanceId = serviceInstanceId; }
public bool Equals(ServiceInstanceId other) { return(!object.ReferenceEquals(null, other) && (object.ReferenceEquals(this, other) || this.InstanceId.Equals(other.InstanceId, StringComparison.OrdinalIgnoreCase))); }
internal FullSyncObjectCookie(SyncObjectId objectId, LinkMetadata overlapLink, int nextRangeStart, long usnChanged, ServiceInstanceId serviceInstanceid) : this() { this.ReadRestartsCount = 0; this.SetNextPageData(objectId, overlapLink, nextRangeStart, usnChanged); this.ServiceInstanceId = serviceInstanceid; }
public TenantFullSyncPageToken(Guid invocationId, Guid tenantExternalDirectoryId, ADObjectId tenantOuId, ServiceInstanceId serviceInstanceId, bool useDirSyncBasedTfs = false) { ExTraceGlobals.TenantFullSyncTracer.TraceDebug((long)this.TenantExternalDirectoryId.GetHashCode(), "New TenantFullSyncPageToken"); this.Version = 3; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <int>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken this.Version = {0}", this.Version); this.TenantExternalDirectoryId = tenantExternalDirectoryId; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <Guid>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken this.TenantExternalDirectoryId = {0}", this.TenantExternalDirectoryId); this.TenantObjectGuid = tenantOuId.ObjectGuid; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <Guid>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken this.TenantObjectGuid = {0}", this.TenantObjectGuid); this.State = TenantFullSyncState.EnumerateLiveObjects; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <string>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken this.State = {0}", this.State.ToString()); this.ServiceInstanceId = serviceInstanceId; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <ServiceInstanceId>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken this.ServiceInstanceId = {0}", this.ServiceInstanceId); this.ErrorObjectsAndFailureCounts = new Dictionary <string, int>(); this.SequenceId = Guid.NewGuid(); this.SequenceStartTimestamp = DateTime.UtcNow; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <Guid, DateTime>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken Starting a new sequence this.SequenceId = {0} this.SequenceStartTimestamp = {1} ", this.SequenceId, this.SequenceStartTimestamp); this.TenantScopedBackSyncCookie = (useDirSyncBasedTfs ? new BackSyncCookie(this.ServiceInstanceId) : null); this.InvocationId = (useDirSyncBasedTfs ? this.TenantScopedBackSyncCookie.InvocationId : invocationId); ExTraceGlobals.TenantFullSyncTracer.TraceDebug <Guid>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken this.InvocationId = {0}", this.InvocationId); this.UseContainerizedUsnChangedIndex = false; if (SyncConfiguration.EnableContainerizedUsnChangedOptimization()) { Guid preferredDCWithContainerizedUsnChanged = SyncConfiguration.GetPreferredDCWithContainerizedUsnChanged(this.ServiceInstanceId.InstanceId); if (preferredDCWithContainerizedUsnChanged != Guid.Empty) { this.InvocationId = preferredDCWithContainerizedUsnChanged; this.UseContainerizedUsnChangedIndex = true; ExTraceGlobals.TenantFullSyncTracer.TraceDebug <Guid>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken overwriting this.InvocationId = {0} and this.UseContainerizedUsnChangedIndex = true", this.InvocationId); } else { ExTraceGlobals.TenantFullSyncTracer.TraceDebug <ServiceInstanceId>((long)this.TenantExternalDirectoryId.GetHashCode(), "TenantFullSyncPageToken: Could not find preferred DC for service instance {0}. Containerized USN index will NOT be used.", this.ServiceInstanceId); } } if (this.UseContainerizedUsnChangedIndex && useDirSyncBasedTfs) { throw new InvalidOperationException("Invalid configuration - cannot use Containerized UsnChanged Index and Dirsync based TFS simultaneously."); } if (this.UseContainerizedUsnChangedIndex) { this.PreviousState = this.State; } }