Skip to content

Commit

Permalink
Added more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Nov 12, 2024
1 parent 26b450b commit cb4091e
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,22 @@ class RetrievedProvider(val json: Provider) : Validatable {
}

/**
* This function fetches all directory indices referenced by this provider.
* This function fetches all directory indices referenced by this provider and sends them to a
* [ReceiveChannel].
*
* @param loader The instance of [CsafLoader] used for fetching of online resources.
* @param channelCapacity The capacity of the channels used to buffer parallel fetches. Defaults
* to [DEFAULT_CHANNEL_CAPACITY].
* @return The fetched [Result]s, representing index contents or fetch errors.
* @return A [ReceiveChannel] containing the fetched [Result]s, representing index contents or
* fetch errors.
*/
fun fetchDocumentIndices(
loader: CsafLoader = lazyLoader,
channelCapacity: Int = DEFAULT_CHANNEL_CAPACITY
): ReceiveChannel<Pair<String, Result<String>>> {
@Suppress("SimpleRedundantLet")
val directoryUrls =
(json.distributions ?: emptySet()).mapNotNull { distribution ->
@Suppress("SimpleRedundantLet")
distribution.directory_url?.let { it.toString().trimEnd('/') }
}
// This channel collects up to `channelCapacity` directory indices concurrently.
Expand All @@ -86,6 +88,16 @@ class RetrievedProvider(val json: Provider) : Validatable {
}
}

/**
* This function fetches all ROLIE feeds referenced by this provider and sends them to a
* [ReceiveChannel].
*
* @param loader The instance of [CsafLoader] used for fetching of online resources.
* @param channelCapacity The capacity of the channels used to buffer parallel fetches. Defaults
* to [DEFAULT_CHANNEL_CAPACITY].
* @return A [ReceiveChannel] containing the fetched [Result]s, representing ROLIE feeds'
* contents (as [ROLIEFeed]) or fetch errors.
*/
fun fetchRolieFeeds(
loader: CsafLoader = lazyLoader,
channelCapacity: Int = DEFAULT_CHANNEL_CAPACITY
Expand Down

0 comments on commit cb4091e

Please sign in to comment.