Apache Ignite.NET
Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV > Interface Template Reference

Data streamer is responsible for loading external data into cache. It achieves it by properly buffering updates and properly mapping keys to nodes responsible for the data to make sure that there is the least amount of data movement possible and optimal network and memory utilization. More...

Inheritance diagram for Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >:

Public Member Functions

Task AddData (TK key, TV val)
 Adds single key-value pair for loading. Passing null as value will be interpreted as removal. More...
 
Task AddData (KeyValuePair< TK, TV > pair)
 Adds single key-value pair for loading. Passing null as pair's value will be interpreted as removal. More...
 
Task AddData (ICollection< KeyValuePair< TK, TV >> entries)
 Adds collection of key-value pairs for loading. More...
 
Task RemoveData (TK key)
 Adds key for removal. More...
 
void TryFlush ()
 Makes an attempt to load remaining data. This method is mostly similar to IDataStreamer<K,V>.Flush() with the difference that it won't wait and will exit immediately. More...
 
void Flush ()
 Loads any remaining data, but doesn't close the streamer. Data can be still added after flush is finished. This method blocks and doesn't allow to add any data until all data is loaded. More...
 
void Close (bool cancel)
 Closes this streamer optionally loading any remaining data. More...
 
IDataStreamer< TK1, TV1 > WithKeepBinary< TK1, TV1 > ()
 Gets streamer instance with binary mode enabled, changing key and/or value types if necessary. In binary mode stream receiver gets data in binary format. You can only change key/value types when transitioning from non-binary to binary streamer; Changing type of binary streamer is not allowed and will throw an InvalidOperationException More...
 

Properties

string CacheName [get]
 Name of the cache to load data to. More...
 
bool AllowOverwrite [get, set]
 Flag value indicating that this data streamer assumes that there could be concurrent updates to the cache. More...
 
bool SkipStore [get, set]
 Flag indicating that write-through behavior should be disabled for data loading. More...
 
int PerNodeBufferSize [get, set]
 Size of per node key-value pairs buffer. More...
 
int PerNodeParallelOperations [get, set]
 Maximum number of parallel load operations for a single node. More...
 
long AutoFlushFrequency [get, set]
 Automatic flush frequency in milliseconds. Essentially, this is the time after which the streamer will make an attempt to submit all data added so far to remote nodes. Note that there is no guarantee that data will be delivered after this concrete attempt (e.g., it can fail when topology is changing), but it won't be lost anyway. More...
 
Task Task [get]
 Gets the task for this loading process. This task completes whenever method IDataStreamer<K,V>.Close(bool) completes. More...
 
IStreamReceiver< TK, TV > Receiver [get, set]
 Gets or sets custom stream receiver. More...
 

Detailed Description

Note that streamer will load data concurrently by multiple internal threads, so the data may get to remote nodes in different order from which it was added to the streamer.

Also note that IDataStreamer is not the only way to load data into cache. Alternatively you can use ICacheStore.LoadCache(Action<object, object>, object[]) method to load data from underlying data store. You can also use standard cache put and putAll operations as well, but they most likely will not perform as well as this class for loading data. And finally, data can be loaded from underlying data store on demand, whenever it is accessed - for this no explicit data loading step is needed.

IDataStreamer supports the following configuration properties:

  • PerNodeBufferSize When entries are added to data streamer they are not sent to Ignite right away and are buffered internally for better performance and network utilization. This setting controls the size of internal per-node buffer before buffered data is sent to remote node. Default value is 1024.
  • PerNodeParallelOperations Sometimes data may be added to the data streamer faster than it can be put in cache. In this case, new buffered load messages are sent to remote nodes before responses from previous ones are received. This could cause unlimited heap memory utilization growth on local and remote nodes. To control memory utilization, this setting limits maximum allowed number of parallel buffered load messages that are being processed on remote nodes. If this number is exceeded, then data streamer add/remove methods will block to control memory utilization. Default value is 16.
  • AutoFlushFrequency Automatic flush frequency in milliseconds. Essentially, this is the time after which the streamer will make an attempt to submit all data added so far to remote nodes. Note that there is no guarantee that data will be delivered after this concrete attempt (e.g., it can fail when topology is changing), but it won't be lost anyway. Disabled by default (default value is 0).
  • Isolated Defines if data streamer will assume that there are no other concurrent updates and allow data streamer choose most optimal concurrent implementation. Default value is false.

All members are thread-safe and may be used concurrently from multiple threads.

Member Function Documentation

Task Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.AddData ( TK  key,
TV  val 
)
Parameters
keyKey.
valValue.
Returns
Task for this operation.
Task Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.AddData ( KeyValuePair< TK, TV >  pair)
Parameters
pairKey-value pair.
Returns
Task for this operation.
Task Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.AddData ( ICollection< KeyValuePair< TK, TV >>  entries)
Parameters
entriesEntries.
Returns
Task for this operation.
void Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.Close ( bool  cancel)
Parameters
cancelWhether to cancel ongoing loading operations. When set to true there is not guarantees what data will be actually loaded to cache.
Task Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.RemoveData ( TK  key)
Parameters
keyKey.
Returns
Task for this operation.
void Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.TryFlush ( )
IDataStreamer<TK1, TV1> Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.WithKeepBinary< TK1, TV1 > ( )
Template Parameters
TK1Key type in binary mode.
TV1Value type in binary mode.
Returns
Streamer instance with binary mode enabled.

Property Documentation

bool Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.AllowOverwrite
getset

Default is false.

long Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.AutoFlushFrequency
getset

If set to 0, automatic flush is disabled.

Default is 0 (disabled).

string Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.CacheName
get
int Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.PerNodeBufferSize
getset

Setter must be called before any add/remove operation.

Default is 1024.

int Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.PerNodeParallelOperations
getset

Setter must be called before any add/remove operation.

Default is 16.

bool Apache.Ignite.Core.Datastream.IDataStreamer< TK, TV >.SkipStore
getset

Default is false.