private static TcpPackage WrapDeleteStream(ClientMessage.DeleteStream msg) { var dto = new DeleteStream(msg.EventStreamId, msg.ExpectedVersion, msg.RequireLeader, msg.HardDelete); return(CreateWriteRequestPackage(TcpCommand.DeleteStream, msg, dto)); }
public void Handle(ClientMessage.DeleteStream message) { var manager = new DeleteStream( _bus, _commitTimeout, message.Envelope, message.InternalCorrId, message.CorrelationId, message.EventStreamId, message.ExpectedVersion, message.HardDelete, _commitSource); _currentRequests.Add(message.InternalCorrId, manager); _currentTimedRequests.Add(message.InternalCorrId, Stopwatch.StartNew()); manager.Start(); }
public bool Execute(CommandProcessorContext context, string[] args) { var eventStreamId = "test-stream"; var expectedVersion = ExpectedVersion.Any; if (args.Length > 0) { if (args.Length > 2) { return(false); } eventStreamId = args[0]; if (args.Length == 2) { expectedVersion = args[1].Trim().ToUpper() == "ANY" ? ExpectedVersion.Any : int.Parse(args[1]); } } context.IsAsync(); var sw = new Stopwatch(); context._tcpTestClient.CreateTcpConnection( context, connectionEstablished: conn => { context.Log.Information( "[{remoteEndPoint}, L{localEndPoint}]: Trying to delete event stream '{stream}'...", conn.RemoteEndPoint, conn.LocalEndPoint, eventStreamId); var corrid = Guid.NewGuid(); var deleteDto = new DeleteStream(eventStreamId, expectedVersion, false, true); var package = new TcpPackage(TcpCommand.DeleteStream, corrid, deleteDto.Serialize()).AsByteArray(); sw.Start(); conn.EnqueueSend(package); }, handlePackage: (conn, pkg) => { sw.Stop(); context.Log.Information("Delete request took: {elapsed}.", sw.Elapsed); if (pkg.Command != TcpCommand.DeleteStreamCompleted) { context.Fail(reason: string.Format("Unexpected TCP package: {0}.", pkg.Command)); return; } var dto = pkg.Data.Deserialize <DeleteStreamCompleted>(); if (dto.Result == OperationResult.Success) { context.Log.Information("DELETED event stream {stream}.", eventStreamId); PerfUtils.LogTeamCityGraphData(string.Format("{0}-latency-ms", Keyword), (int)Math.Round(sw.Elapsed.TotalMilliseconds)); context.Success(); } else { context.Log.Information("DELETION FAILED for event stream {stream}: {message} ({e}).", eventStreamId, dto.Message, dto.Result); context.Fail(); } conn.Close(); }, connectionClosed: (connection, error) => context.Fail(reason: "Connection was closed prematurely.")); context.WaitForCompletion(); return(true); }
protected override Expression <Func <IReactiveProxy, Task> > VisitDeleteStream(DeleteStream operation) { return(Reduce(s_this.Let(@this => Expression.Lambda <Func <IReactiveProxy, Task> >( Expression.Invoke( s_disposeStreamExpr, Expression.Constant(operation.TargetObjectUri), @this), @this)))); }