loadData

abstract fun loadData(priority: Any, callback: DataFetcher.DataCallback<out Any>)

Fetch data from which a resource can be decoded.

This will always be called on background thread so it is safe to perform long running tasks here. Any third party libraries called must be thread safe (or move the work to another thread) since this method will be called from a thread in a that may have more than one background thread. You MUST use the DataCallback once the request is complete.

You are free to move the fetch work to another thread and call the callback from there.

This method will only be called when the corresponding resource is not in the cache.

Note - this method will be run on a background thread so blocking I/O is safe.

See also

where the data retuned will be cleaned up

Parameters

priority

The priority with which the request should be completed.

callback

The callback to use when the request is complete