Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
namespace CheatEngine.Client.Events;

/// <summary>Configures bounded, non-blocking materialization of host callback events.</summary>
/// <summary>
/// Configures bounded materialization of copied host callback observations for one active asynchronous reader.
/// </summary>
public readonly record struct EventStreamOptions
{
/// <summary>Creates bounded stream options.</summary>
Expand All @@ -20,7 +22,7 @@ public EventStreamOptions(
OverflowPolicy = overflowPolicy;
}

/// <summary>Gets the mandatory maximum number of events buffered for a consumer.</summary>
/// <summary>Gets the mandatory maximum number of copied observations buffered for the one active reader.</summary>
public int Capacity
{
get;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ namespace CheatEngine.Client.Events;
/// <summary>Specifies the bounded-admission policy for a copied Client event stream.</summary>
public enum EventStreamOverflowPolicy
{
/// <summary>Evicts the oldest buffered event before admitting the newest event.</summary>
/// <summary>Evicts the oldest buffered observation before admitting the newest observation.</summary>
DropOldest,

/// <summary>Rejects the newly raised event while retaining the buffered events.</summary>
/// <summary>Rejects the newly raised observation while retaining the buffered observations.</summary>
DropNewest,

/// <summary>Terminates the subscription when its bounded buffer cannot admit an event.</summary>
/// <summary>
/// Terminates observation delivery when its bounded buffer cannot admit an observation. This does not select a
/// native callback disposition.
/// </summary>
FailSubscription
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
namespace CheatEngine.Client.Events;

/// <summary>Owns a bounded stream of copied callback events for one Client activation.</summary>
/// <summary>Owns a bounded, unicast stream of copied callback observations for one Client activation.</summary>
/// <typeparam name="TEvent">The copied event snapshot type.</typeparam>
/// <remarks>
/// Implementations must never wait for a stream consumer on a Cheat Engine or Lua callback thread. Disposing a
/// lease closes admission, detaches its callback, completes <see cref="Events" />, and releases host state.
/// The stream has one active reader at a time; a concurrent reader is rejected and observations are never
/// broadcast. Implementations must not wait for a stream consumer on a Cheat Engine or Lua callback thread,
/// although admission may use a bounded synchronization primitive. Cancelling or disposing an enumerator ends
/// that observation read only; it neither cancels nor decides the native callback. Disposing a lease closes
/// admission, detaches its callback, completes <see cref="Events" />, and releases host state. Activation teardown
/// follows the same release contract, so an expired lease cannot admit later observations.
/// </remarks>
public interface IEventStreamLease<TEvent> : IDisposable
{
/// <summary>Gets the bounded stream of copied events.</summary>
/// <summary>
/// Gets the bounded, single-active-reader stream of copied observations. Buffered observations are delivered in
/// FIFO order to that reader; overflow is reported through <see cref="DroppedEventCount" /> and does not provide
/// a native callback decision.
/// </summary>
public IAsyncEnumerable<TEvent> Events
{
get;
}

/// <summary>Gets the number of events that were not admitted to the stream.</summary>
/// <summary>
/// Gets the number of observations not delivered because the bounded stream overflowed or terminal processing
/// discarded buffered observations.
/// </summary>
public long DroppedEventCount
{
get;
Expand Down
Loading