org.apache.ignite.internal.processors.cache

## Interface GridCachePreloader<K,V>

All Known Implementing Classes:
  GridCachePreloaderAdapter, GridDhtPreloader

    public interface GridCachePreloader<K,V>

Cache preloader that is responsible for loading cache entries either from remote nodes (for distributed cache) or anywhere else at cache startup.

### Method Summary

Methods
`void` `addAssignments(GridDhtPreloaderAssignments<K,V> assignments, boolean forcePreload)` Adds assignments to preloader.
`GridDhtPreloaderAssignments<K,V>` `assign(GridDhtPartitionsExchangeFuture exchFut)`
`void` `forcePreload()` Force preload process.
`void` `onExchangeFutureAdded()` Callback by exchange manager when new exchange future is added to worker.
`void` `onInitialExchangeComplete(Throwable err)` Callback by exchange manager when initial partition exchange is complete.
`void` `onKernalStart()` Kernal start callback.
`void` `onKernalStop()` Kernal stop callback.
`IgnitePredicate<GridCacheEntryInfo>` `preloadPredicate()`
`void` `preloadPredicate(IgnitePredicate<GridCacheEntryInfo> p)`
`IgniteInternalFuture<Object>` `request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer)` Requests that preloader sends the request for the key.
`void` `start()` Starts preloading.
`IgniteInternalFuture<Object>` `startFuture()`
`void` `stop()` Stops preloading.
`IgniteInternalFuture<?>` `syncFuture()`
`void` `unwindUndeploys()` Unwinds undeploys.
`void` `updateLastExchangeFuture(GridDhtPartitionsExchangeFuture lastFut)` Updates last exchange future.

### Method Detail

#### start

    void start()
               throws IgniteCheckedException

Starts preloading.

Throws:
  `IgniteCheckedException` - If start failed.

#### stop

    void stop()

Stops preloading.

#### onKernalStart

    void onKernalStart()
                       throws IgniteCheckedException

Kernal start callback.

Throws:
  `IgniteCheckedException` - If failed.

#### onKernalStop

    void onKernalStop()

Kernal stop callback.

#### onInitialExchangeComplete

    void onInitialExchangeComplete(@Nullable
                                 Throwable err)

Callback by exchange manager when initial partition exchange is complete.

Parameters:
  `err` - Error, if any happened on initial exchange.

#### onExchangeFutureAdded

    void onExchangeFutureAdded()

Callback by exchange manager when new exchange future is added to worker.

#### updateLastExchangeFuture

    void updateLastExchangeFuture(GridDhtPartitionsExchangeFuture lastFut)

Updates last exchange future.

Parameters:
  `lastFut` - Last future.

#### assign

    GridDhtPreloaderAssignments<K,V> assign(GridDhtPartitionsExchangeFuture exchFut)

Parameters:
  `exchFut` - Exchange future to assign.
Returns:
  Assignments.

#### addAssignments

    void addAssignments(GridDhtPreloaderAssignments<K,V> assignments,
                      boolean forcePreload)

Adds assignments to preloader.

Parameters:
  `assignments` - Assignments to add.
  `forcePreload` - Force preload flag.

#### preloadPredicate

    void preloadPredicate(IgnitePredicate<GridCacheEntryInfo> p)

Parameters:
  `p` - Preload predicate.

#### preloadPredicate

    IgnitePredicate<GridCacheEntryInfo> preloadPredicate()

Returns:
  Preload predicate. If not `null`, will evaluate each preloaded entry during send and receive, and if predicate evaluates to `false`, entry will be skipped.

#### startFuture

    IgniteInternalFuture<Object> startFuture()

Returns:
  Future which will complete when preloader is safe to use.

#### syncFuture

    IgniteInternalFuture<?> syncFuture()

Returns:
  Future which will complete when preloading is finished.

#### request

    IgniteInternalFuture<Object> request(Collection<KeyCacheObject> keys,
                                       AffinityTopologyVersion topVer)

Requests that preloader sends the request for the key.

Parameters:
  `keys` - Keys to request.
  `topVer` - Topology version, `-1` if not required.
Returns:
  Future to complete when all keys are preloaded.

#### forcePreload

    void forcePreload()

Force preload process.

#### unwindUndeploys

    void unwindUndeploys()

Unwinds undeploys.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.0.0
Release Date | : March 31 2015