Class SynchronizedStreamDebouncer<TInstance, TKey>
A class that encapsulates synchronized read-write operations to timestamped records, and filters frequent occurrences of a similar event.
Inheritance
Namespace: Telerik.CallHome.Debouncing
Assembly: Telerik.Windows.Controls.dll
Syntax
public abstract class SynchronizedStreamDebouncer<TInstance, TKey> : Object, IDebouncer<TInstance>, IClearableDebouncer
Type Parameters
TInstance
|
TKey
|
Constructors
SynchronizedStreamDebouncer()
Declaration
protected SynchronizedStreamDebouncer()
Properties
Name
Gets the stream name.
Declaration
protected abstract string Name { get; }
Property Value
System.String
|
Now
Gets the current time.
Declaration
protected virtual DateTime Now { get; }
Property Value
System.DateTime
|
Timeout
Gets the debounce timeout for similar events.
Declaration
protected virtual TimeSpan Timeout { get; }
Property Value
System.TimeSpan
|
Methods
AcquireStream()
Tries to open the storage stream and lock exclusively for read/write. May throws if the stream is currently acquired elsewhere.
When using file or isolated storage stream, lock the file and use the AcquireSynchronizationLock() for file access synchronization.
Declaration
protected abstract Stream AcquireStream()
Returns
System.IO.Stream
|
AcquireSynchronizationLock()
Blocks the execution of the current thread until the synchronization lock can be acquired. Returns a System.IDisposable that will release the lock when disposed.
Declaration
protected abstract IDisposable AcquireSynchronizationLock()
Returns
System.IDisposable
|
Clear()
Clears all entries from the timetable.
Declaration
public void Clear()
Deserialize(Stream)
Deserialize the provided stream to lookup table.
Declaration
protected abstract IDictionary<TKey, DateTime> Deserialize(Stream stream)
Parameters
System.IO.Stream
stream
|
Returns
System.Collections.Generic.IDictionary<TKey, System.DateTime>
|
Key(TInstance)
Selects only the relevant key information from the instance.
Declaration
protected abstract TKey Key(TInstance instance)
Parameters
TInstance
instance
|
Returns
TKey
|
Open()
Opens the stream, reads time records, allows debounce checks to be performed, and upon disposal - writes back any new records to the stream.
Declaration
public IDebounceScope<TInstance> Open()
Returns
IDebounceScope<TInstance>
|
Serialize(Stream, IEnumerable<KeyValuePair<TKey, DateTime>>)
Serialize the lookup table to stream.
Declaration
protected abstract void Serialize(Stream stream, IEnumerable<KeyValuePair<TKey, DateTime>> table)
Parameters
System.IO.Stream
stream
|
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, System.DateTime>>
table
|