interface IviDataSource<E : Any, Q : Any>

Interface of all IVI data source implementations.

This type is supported in IVI service interfaces.

An IVI data source can be used to expose a data set to clients without requiring the full data set to be loaded in memory. It also allows querying and sorting data on the service side.

An IVI data source can be used to create one or more IviPagingSources. The IviPagingSources can be used to load data pages from the data source. Each IviPagingSource is bound to a query.

When the data of the IVI data source is modified, active IviPagingSources need to be invalidated. A new IviPagingSource instance needs to be created afterwards. To simplify the latter, at the client side various LiveData and Flow extensions exist to re-create IviPagingSources instances automatically and handle the invalidation, even while loading pages.

The IviPagingSource is designed to seamlessly integrate with the Android Paging library. This makes it possible to represent E elements in a RecyclerView. The platform_framework_api_ipc_iviserviceandroidpaging modules contains extensions functions for the integration.



Element type exposed by the data source. Any immutable type supported by the IVI service framework. See IviService annotation.


Query type. Any immutable type supported by the IVI service framework.



Link copied to clipboard

true if this IviDataSource supports jumping, false otherwise.

Link copied to clipboard

true if IviPagingSource created by createPagingSource or createPagingSourceFlow expects to re-use keys to load distinct pages without a call to invalidate, false otherwise. See PagingSource.keyReuseSupported for details.


Link copied to clipboard
abstract fun createPagingSource(query: Q, lifecycleOwner: LifecycleOwner): IviPagingSource<E>

Creates an IviPagingSource for the given query. The page source is invalidated when the given lifecycleOwner is destroyed.

Link copied to clipboard
abstract fun createPagingSourceFlow(query: Q): Flow<IviPagingSource<E>>

Same as createPagingSource except that this variant returns a Flow. The benefit of this variant is that it does not require a LifecycleOwner as we can use the Flow cancellation to invalidate the IviPagingSource. This variant is ideal for creating a Flow/LiveData transformation.