Class PersistentChannel<TInput, TOutput>
Represents persistent unbounded channel.
Implements
Inherited Members
Namespace: DotNext.Threading.Channels
Assembly: DotNext.Threading.dll
Syntax
public abstract class PersistentChannel<TInput, TOutput> : Channel<TInput, TOutput>, IDisposable where TInput : notnull where TOutput : notnull
Type Parameters
Name | Description |
---|---|
TInput | Specifies the type of data that may be written to the channel. |
TOutput | Specifies the type of data that may be read from the channel. |
Constructors
| Edit this page View SourcePersistentChannel(PersistentChannelOptions)
Initializes a new persistent channel with the specified options.
Declaration
protected PersistentChannel(PersistentChannelOptions options)
Parameters
Type | Name | Description |
---|---|---|
PersistentChannelOptions | options | The options of the channel. |
Properties
| Edit this page View SourceRemainingCount
Gets the number of unread messages.
Declaration
public long RemainingCount { get; }
Property Value
Type | Description |
---|---|
long | The number of unread messages. |
Throughput
Gets ratio between number of consumed and produced messages.
Declaration
public double Throughput { get; }
Property Value
Type | Description |
---|---|
double |
Methods
| Edit this page View SourceDeserializeAsync(Stream, CancellationToken)
Deserializes message from stream asynchronously.
Declaration
protected abstract ValueTask<TOutput> DeserializeAsync(Stream input, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
Stream | input | The stream containing serialized message. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask<TOutput> | Deserialized message. |
Dispose()
Releases all resources associated with this channel.
Declaration
public void Dispose()
Dispose(bool)
Releases managed and, optionally, unmanaged resources associated with this channel.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true to dispose all resources; false to release unmanaged resources only. |
~PersistentChannel()
Releases file handles associated with this channel.
Declaration
protected ~PersistentChannel()
SerializeAsync(TInput, Stream, CancellationToken)
Serializes message to stream asynchronously.
Declaration
protected abstract ValueTask SerializeAsync(TInput input, Stream output, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TInput | input | The message to serialize. |
Stream | output | The stream used to serialize object. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous state of operation. |