Show / Hide Table of Contents

# Interface IDataStreamerClient<TK, TV>

Thin client data streamer.

Data streamer is an efficient and fault-tolerant way to load data into cache. Updates are buffered and mapped to primary nodes to ensure minimal data movement and optimal resource utilization. Update failures caused by cluster topology changes are retried automatically.

Note that streamer send data to remote nodes asynchronously, so cache updates can be reordered.

Instances of the implementing class are thread-safe: data can be added from multiple threads.

Closing and disposing: System.IDisposable.Dispose() method calls Close(Boolean)`(false)`. This will flush any remaining data to the cache synchronously. To avoid blocking threads when exiting `using()` block, use CloseAsync(Boolean).

##### Inherited Members

System.IDisposable.Dispose()

###### Namespace: Apache.Ignite.Core.Client.Datastream

###### Assembly: Apache.Ignite.Core.dll

##### Syntax

    public interface IDataStreamerClient<TK, TV> : IDisposable

##### Type Parameters

Name | Description
--- | ---
TK |
TV |

### Properties

#### CacheName

Gets the cache name.

##### Declaration

    string CacheName { get; }

##### Property Value

Type | Description
--- | ---
System.String |

#### IsClosed

Gets a value indicating whether this streamer is closed.

##### Declaration

    bool IsClosed { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

#### Options

Gets the options.

##### Declaration

    DataStreamerClientOptions<TK, TV> Options { get; }

##### Property Value

Type | Description
--- | ---
DataStreamerClientOptions<TK, TV> |

### Methods

#### Add(TK, TV)

Adds an entry to the streamer.

This method adds an entry to the buffer. When the buffer gets full, it is scheduled for asynchronous background flush. This method will block when the number of active flush operations exceeds PerNodeParallelOperations.

##### Declaration

    void Add(TK key, TV val)

##### Parameters

Type | Name | Description
--- | --- | ---
TK | key | Key.
TV | val | Value. When null, cache entry will be removed.

#### Close(Boolean)

Closes this streamer, optionally loading any remaining data into the cache.

##### Declaration

    void Close(bool cancel)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Boolean | cancel | Whether to cancel ongoing loading operations. When set to `true`, there is no guarantee which part of remaining data will be actually loaded into the cache.

#### CloseAsync(Boolean)

Closes this streamer, optionally loading any remaining data into the cache.

##### Declaration

    Task CloseAsync(bool cancel)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Boolean | cancel | Whether to cancel ongoing loading operations. When set to `true`, there is no guarantee which part of remaining data will be actually loaded into the cache.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

#### Flush()

Flushes all buffered entries.

##### Declaration

    void Flush()

#### FlushAsync()

Flushes all buffered entries asynchronously.

##### Declaration

    Task FlushAsync()

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

#### Remove(TK)

Adds a removal entry to the streamer. Cache entry with the specified key will be removed.

Removal requires AllowOverwrite to be `true`.

This method adds an entry to the buffer. When the buffer gets full, it is scheduled for asynchronous background flush. This method will block when the number of active flush operations exceeds PerNodeParallelOperations.

##### Declaration

    void Remove(TK key)

##### Parameters

Type | Name | Description
--- | --- | ---
TK | key |