Public Member Functions | Properties | List of all members
GridGain.Datastream.IDataStreamer< K, V > 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...

Inherits IDisposable.

Public Member Functions

IFuture AddData (K key, V val)
 Adds single key-value pair for loading. Passing null as value will be interpreted as removal. More...
 
IFuture AddData (KeyValuePair< K, V > pair)
 Adds single key-value pair for loading. Passing null as pair's value will be interpreted as removal. More...
 
IFuture AddData (ICollection< KeyValuePair< K, V >> entries)
 Adds collection of key-value pairs for loading. More...
 
IFuture RemoveData (K 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< K1, V1 > WithKeepPortable< K1, V1 > ()
 Gets streamer instance with portable mode enabled, changing key and/or value types if necessary. In portable mode stream receiver gets data in portable format. You can only change key/value types when transitioning from non-portable to portable streamer; Changing type of portable 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...
 
IFuture Future [get]
 Gets future for this loading process. This future completes whenever method IDataStreamer<K,V>.Close(bool) completes. More...
 
IStreamReceiver< K, V > 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:

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

Member Function Documentation

IFuture GridGain.Datastream.IDataStreamer< K, V >.AddData ( K  key,
V  val 
)
Parameters
keyKey.
valValue.
Returns
Future for this operation.
IFuture GridGain.Datastream.IDataStreamer< K, V >.AddData ( KeyValuePair< K, V >  pair)
Parameters
pairKey-value pair.
Returns
Future for this operation.
IFuture GridGain.Datastream.IDataStreamer< K, V >.AddData ( ICollection< KeyValuePair< K, V >>  entries)
Parameters
entriesEntries.
Returns
Future for this operation.
void GridGain.Datastream.IDataStreamer< K, V >.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.
void GridGain.Datastream.IDataStreamer< K, V >.Flush ( )
IFuture GridGain.Datastream.IDataStreamer< K, V >.RemoveData ( K  key)
Parameters
keyKey.
Returns
Future for this operation.
void GridGain.Datastream.IDataStreamer< K, V >.TryFlush ( )
IDataStreamer<K1, V1> GridGain.Datastream.IDataStreamer< K, V >.WithKeepPortable< K1, V1 > ( )
Template Parameters
K1Key type in portable mode.
V1Value type in protable mode.
Returns
Streamer instance with portable mode enabled.

Property Documentation

bool GridGain.Datastream.IDataStreamer< K, V >.AllowOverwrite
getset

Default is false.

long GridGain.Datastream.IDataStreamer< K, V >.AutoFlushFrequency
getset

If set to 0, automatic flush is disabled.

Default is 0 (disabled).

string GridGain.Datastream.IDataStreamer< K, V >.CacheName
get
int GridGain.Datastream.IDataStreamer< K, V >.PerNodeBufferSize
getset

Setter must be called before any add/remove operation.

Default is 1024.

int GridGain.Datastream.IDataStreamer< K, V >.PerNodeParallelOperations
getset

Setter must be called before any add/remove operation.

Default is 16.

IStreamReceiver<K, V> GridGain.Datastream.IDataStreamer< K, V >.Receiver
getset
bool GridGain.Datastream.IDataStreamer< K, V >.SkipStore
getset

Default is false.