001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.data.cache;
003
004/**
005 * Cache loader listener.
006 * @since 8168
007 * @since 10600 (functional interface)
008 */
009@FunctionalInterface
010public interface ICachedLoaderListener {
011
012    /**
013     * Result of download
014     */
015    enum LoadResult {
016        SUCCESS,
017        FAILURE,
018        CANCELED
019    }
020
021    /**
022     * Will be called when K object processed. The result might be:
023     * LoadResult.SUCCESS when object was fetched
024     * LoadResult.FAILURE when there was a failure during download
025     * LoadResult.REJECTED when job was rejected because of full queue
026     *
027     * @param data cache entry contents
028     * @param attributes cache entry attributes
029     * @param result load result (success, failure, canceled)
030     */
031    void loadingFinished(CacheEntry data, CacheEntryAttributes attributes, LoadResult result);
032}