Пример #1
0
        public InstanceSnapshotInfo GetSnapshot(string keyName = null, bool isCompress = true)
        {
            keyName = this.NormalizeKeyName(keyName);
            ExTraceGlobals.StoreReadTracer.TraceDebug <string, string, bool>((long)this.identityHash, "{0}: Entering GetSnapshot - Key: {1} IsCompress: {2}", this.identity, keyName, isCompress);
            InstanceSnapshotInfo instanceSnapshotInfo = new InstanceSnapshotInfo
            {
                FullKeyName        = keyName,
                RetrievalStartTime = DateTimeOffset.Now
            };
            int      num;
            XElement xelementSnapshot = this.GetXElementSnapshot(keyName, out num);

            if (xelementSnapshot == null)
            {
                throw new DxStoreInstanceKeyNotFoundException(keyName);
            }
            instanceSnapshotInfo.Snapshot = xelementSnapshot.ToString();
            if (isCompress)
            {
                instanceSnapshotInfo.Compress();
            }
            instanceSnapshotInfo.LastInstanceExecuted = num;
            instanceSnapshotInfo.RetrievalFinishTime  = DateTimeOffset.Now;
            ExTraceGlobals.StoreReadTracer.TraceDebug <string, int, int>((long)this.identityHash, "{0}: [1] Exiting GetSnapshot (Length: {2})", this.identity, num, instanceSnapshotInfo.Snapshot.Length);
            return(instanceSnapshotInfo);
        }
        // Token: 0x06000EB7 RID: 3767 RVA: 0x0003F048 File Offset: 0x0003D248
        public void CopyClusdbSnapshotToDxStore()
        {
            InstanceSnapshotInfo instanceSnapshotInfo = new InstanceSnapshotInfo();

            instanceSnapshotInfo.FullKeyName = "Public";
            instanceSnapshotInfo.Snapshot    = this.ClusdbSnapshot.ToString();
            instanceSnapshotInfo.Compress();
            using (InstanceClientFactory defaultGroupInstanceClientFactory = this.GetDefaultGroupInstanceClientFactory())
            {
                DxStoreInstanceClient localClient = defaultGroupInstanceClientFactory.LocalClient;
                localClient.ApplySnapshot(instanceSnapshotInfo, false, null);
            }
        }
Пример #3
0
 public void ApplySnapshot(InstanceSnapshotInfo snapshot, bool isForce = false)
 {
     this.EventLogger.Log(isForce ? DxEventSeverity.Warning : DxEventSeverity.Info, 0, "{0}: Applying snapshot (isForce={1})", new object[]
     {
         this.Identity,
         isForce
     });
     if (isForce)
     {
         this.LocalDataStore.ApplySnapshot(snapshot, null);
         return;
     }
     this.EnsureInstanceIsReady();
     snapshot.Compress();
     DxStoreCommand.ApplySnapshot command = new DxStoreCommand.ApplySnapshot
     {
         SnapshotInfo = snapshot
     };
     this.StateMachine.ReplicateCommand(command, null);
 }