/// <summary> /// Performs undo of the storage operation that is pending. /// </summary> /// <param name="logEntry">Log entry for the pending operation.</param> protected override void UndoPendingStoreOperations(IStoreLogEntry logEntry) { using (IStoreOperation op = _shardMapManager.StoreOperationFactory.FromLogEntry(_shardMapManager, logEntry)) { op.Undo(); } }
/// <summary> /// Sets the stub of StoreOperationGlobal.UndoPendingStoreOperationsAsync(IStoreLogEntry logEntry) /// </summary> protected override Task UndoPendingStoreOperationsAsync(IStoreLogEntry logEntry) { Func <IStoreLogEntry, Task> func1 = this.UndoPendingStoreOperationsAsyncIStoreLogEntry; if (func1 != null) { return(func1(logEntry)); } if (this.___callBase) { return(base.UndoPendingStoreOperationsAsync(logEntry)); } return(this.InstanceBehavior.Result <StubFindMappingByKeyGlobalOperation, Task>(this, "UndoPendingStoreOperationsAsync")); }
/// <summary> /// Sets the stub of StoreOperationGlobal.UndoPendingStoreOperations(IStoreLogEntry logEntry) /// </summary> protected override void UndoPendingStoreOperations(IStoreLogEntry logEntry) { Action <IStoreLogEntry> action1 = this.UndoPendingStoreOperationsIStoreLogEntry; if (action1 != null) { action1(logEntry); } else if (this.___callBase) { base.UndoPendingStoreOperations(logEntry); } else { this.InstanceBehavior.VoidResult <StubFindMappingByKeyGlobalOperation>(this, "UndoPendingStoreOperations"); } }
/// <summary> /// Performs undo of the storage operation that is pending. /// </summary> /// <param name="logEntry">Log entry for the pending operation.</param> protected override void UndoPendingStoreOperations(IStoreLogEntry logEntry) { using (IStoreOperation op = _shardMapManager.StoreOperationFactory.FromLogEntry(_shardMapManager, logEntry)) { op.Undo(); } }
/// <summary> /// Create operation corresponding to the <see cref="IStoreLogEntry"/> information. /// </summary> /// <param name="shardMapManager">ShardMapManager instance for undo operation.</param> /// <param name="so">Store operation information.</param> /// <returns>The operation to be undone.</returns> public virtual IStoreOperation FromLogEntry(ShardMapManager shardMapManager, IStoreLogEntry so) { XElement root; using (XmlReader reader = so.Data.CreateReader()) { root = XElement.Load(reader); } switch (so.OpCode) { case StoreOperationCode.AddShard: return(this.CreateAddShardOperation( shardMapManager, so.Id, so.UndoStartState, root)); case StoreOperationCode.RemoveShard: return(this.CreateRemoveShardOperation( shardMapManager, so.Id, so.UndoStartState, root)); case StoreOperationCode.UpdateShard: return(this.CreateUpdateShardOperation( shardMapManager, so.Id, so.UndoStartState, root)); case StoreOperationCode.AddPointMapping: case StoreOperationCode.AddRangeMapping: return(this.CreateAddMappingOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionAdds)); case StoreOperationCode.RemovePointMapping: case StoreOperationCode.RemoveRangeMapping: return(this.CreateRemoveMappingOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionRemoves)); case StoreOperationCode.UpdatePointMapping: case StoreOperationCode.UpdateRangeMapping: case StoreOperationCode.UpdatePointMappingWithOffline: case StoreOperationCode.UpdateRangeMappingWithOffline: return(this.CreateUpdateMappingOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionRemoves, so.OriginalShardVersionAdds)); case StoreOperationCode.SplitMapping: case StoreOperationCode.MergeMappings: return(this.CreateReplaceMappingsOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionAdds)); default: Debug.Fail("Unexpected operation code."); return(null); } }
/// <summary> /// Create operation corresponding to the <see cref="IStoreLogEntry"/> information. /// </summary> /// <param name="shardMapManager">ShardMapManager instance for undo operation.</param> /// <param name="so">Store operation information.</param> /// <returns>The operation to be undone.</returns> public virtual IStoreOperation FromLogEntry(ShardMapManager shardMapManager, IStoreLogEntry so) { XElement root; using (XmlReader reader = so.Data.CreateReader()) { root = XElement.Load(reader); } switch (so.OpCode) { case StoreOperationCode.AddShard: return this.CreateAddShardOperation( shardMapManager, so.Id, so.UndoStartState, root); case StoreOperationCode.RemoveShard: return this.CreateRemoveShardOperation( shardMapManager, so.Id, so.UndoStartState, root); case StoreOperationCode.UpdateShard: return this.CreateUpdateShardOperation( shardMapManager, so.Id, so.UndoStartState, root); case StoreOperationCode.AddPointMapping: case StoreOperationCode.AddRangeMapping: return this.CreateAddMappingOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionAdds); case StoreOperationCode.RemovePointMapping: case StoreOperationCode.RemoveRangeMapping: return this.CreateRemoveMappingOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionRemoves); case StoreOperationCode.UpdatePointMapping: case StoreOperationCode.UpdateRangeMapping: case StoreOperationCode.UpdatePointMappingWithOffline: case StoreOperationCode.UpdateRangeMappingWithOffline: return this.CreateUpdateMappingOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionRemoves, so.OriginalShardVersionAdds); case StoreOperationCode.SplitMapping: case StoreOperationCode.MergeMappings: return this.CreateReplaceMappingsOperation( so.OpCode, shardMapManager, so.Id, so.UndoStartState, root, so.OriginalShardVersionAdds); default: Debug.Fail("Unexpected operation code."); return null; } }
/// <summary> /// Performs undo of the storage operation that is pending. /// </summary> /// <param name="logEntry">Log entry for the pending operation.</param> protected virtual void UndoPendingStoreOperations(IStoreLogEntry logEntry) { // Will only be implemented by LockOrUnLockMapping operation // which will actually perform the undo operation. throw new NotImplementedException(); }
/// <summary> /// Asynchronously performs undo of the storage operation that is pending. /// </summary> /// <param name="logEntry">Log entry for the pending operation.</param> /// <returns>Task to await Undo of the operation</returns> /// <remarks>Currently not used anywhere since the Async APIs were added /// in support of the look-up operations</remarks> protected virtual Task UndoPendingStoreOperationsAsync(IStoreLogEntry logEntry) { // Currently async APIs are only used by FindMappingByKeyGlobalOperation // which doesn't require Undo throw new NotImplementedException(); }
/// <summary> /// Sets the stub of StoreOperationFactory.FromLogEntry(ShardMapManager shardMapManager, IStoreLogEntry so) /// </summary> public override IStoreOperation FromLogEntry(ShardMapManager shardMapManager, IStoreLogEntry so) { Func<ShardMapManager, IStoreLogEntry, IStoreOperation> func1 = this.FromLogEntryShardMapManagerIStoreLogEntry; if (func1 != null) return func1(shardMapManager, so); if (this.___callBase) return base.FromLogEntry(shardMapManager, so); return this.InstanceBehavior.Result<StubStoreOperationFactory, IStoreOperation>(this, "FromLogEntry"); }
/// <summary> /// Sets the stub of StoreOperationGlobal.UndoPendingStoreOperationsAsync(IStoreLogEntry logEntry) /// </summary> protected override Task UndoPendingStoreOperationsAsync(IStoreLogEntry logEntry) { Func<IStoreLogEntry, Task> func1 = this.UndoPendingStoreOperationsAsyncIStoreLogEntry; if (func1 != null) return func1(logEntry); if (this.___callBase) return base.UndoPendingStoreOperationsAsync(logEntry); return this.InstanceBehavior.Result<StubFindMappingByKeyGlobalOperation, Task>(this, "UndoPendingStoreOperationsAsync"); }
/// <summary> /// Sets the stub of StoreOperationGlobal.UndoPendingStoreOperations(IStoreLogEntry logEntry) /// </summary> protected override void UndoPendingStoreOperations(IStoreLogEntry logEntry) { Action<IStoreLogEntry> action1 = this.UndoPendingStoreOperationsIStoreLogEntry; if (action1 != null) action1(logEntry); else if (this.___callBase) base.UndoPendingStoreOperations(logEntry); else this.InstanceBehavior.VoidResult<StubFindMappingByKeyGlobalOperation>(this, "UndoPendingStoreOperations"); }
/// <summary> /// Asynchronously performs undo of the storage operation that is pending. /// </summary> /// <param name="logEntry">Log entry for the pending operation.</param> /// <returns>Task to await Undo of the operation</returns> /// <remarks>Currently not used anywhere since the Async APIs were added /// in support of the look-up operations</remarks> protected virtual Task UndoPendingStoreOperationsAsync(IStoreLogEntry logEntry) { // Currently async APIs are only used by FindMappingByKeyGlobalOperation // which doesn't require Undo throw new NotImplementedException(); }
/// <summary> /// Performs undo of the storage operation that is pending. /// </summary> /// <param name="logEntry">Log entry for the pending operation.</param> protected virtual void UndoPendingStoreOperations(IStoreLogEntry logEntry) { // Will only be implemented by LockOrUnLockMapping operation // which will actually perform the undo operation. throw new NotImplementedException(); }