//private void CatchUp() //{ // //var streamEvents = new List<ResolvedEvent>(); // StreamEventsSlice currentSlice; // var nextSliceStart = _checkpoint ?? 0; // do // { // currentSlice = Program.Connection.ReadStreamEventsForwardAsync(_streamName, nextSliceStart, 200, false).Result; // nextSliceStart = currentSlice.NextEventNumber; // foreach (var evt in currentSlice.Events) // { // EventAppeared(null, evt); // } // //streamEvents.AddRange(currentSlice.Events); // } while (!currentSlice.IsEndOfStream); //} private void LiveProcessingStarted(EventStoreCatchUpSubscription obj) { Console.WriteLine("CatchUp: Caught up"); if (_waitHandle != null && !_waitHandle.GetSafeWaitHandle().IsClosed) { _waitHandle.Set(); } SubscriptionUpToDate = true; }
public override void CloseWrite() { // The Docker daemon expects a write of zero bytes to signal the end of writes. Use native // calls to achieve this since CoreCLR ignores a zero-byte write. var overlapped = new NativeOverlapped(); var handle = _event.GetSafeWaitHandle(); // Set the low bit to tell Windows not to send the result of this IO to the // completion port. overlapped.EventHandle = (IntPtr)(handle.DangerousGetHandle().ToInt64() | 1); if (WriteFile(_stream.SafePipeHandle, IntPtr.Zero, 0, IntPtr.Zero, ref overlapped) == 0) { const int ERROR_IO_PENDING = 997; if (Marshal.GetLastWin32Error() == ERROR_IO_PENDING) { int written; if (GetOverlappedResult(_stream.SafePipeHandle, ref overlapped, out written, 1) == 0) { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } } else { Marshal.ThrowExceptionForHR(Marshal.GetHRForLastWin32Error()); } } }