BaseUrlExclusionList


@UnstableApi
class BaseUrlExclusionList


Holds the state of excluded base URLs to be used to select a base URL based on these exclusions.

Summary

Public constructors

Creates an instance.

Public functions

Unit
exclude(baseUrlToExclude: BaseUrl!, exclusionDurationMs: Long)

Excludes the given base URL.

java-static Int

Returns the number of priority levels of the given list of base URLs.

Int

Returns the number of priority levels for the given list of base URLs after exclusion.

Unit

Resets the state.

BaseUrl?

Selects the base URL to use from the given list.

Public constructors

BaseUrlExclusionList

BaseUrlExclusionList()

Creates an instance.

Public functions

exclude

fun exclude(baseUrlToExclude: BaseUrl!, exclusionDurationMs: Long): Unit

Excludes the given base URL.

Parameters
baseUrlToExclude: BaseUrl!

The base URL to exclude.

exclusionDurationMs: Long

The duration of exclusion, in milliseconds.

getPriorityCount

java-static fun getPriorityCount(baseUrls: (Mutable)List<BaseUrl!>!): Int

Returns the number of priority levels of the given list of base URLs.

Parameters
baseUrls: (Mutable)List<BaseUrl!>!

The list of base URLs.

Returns
Int

The number of priority levels before exclusion.

getPriorityCountAfterExclusion

fun getPriorityCountAfterExclusion(baseUrls: (Mutable)List<BaseUrl!>!): Int

Returns the number of priority levels for the given list of base URLs after exclusion.

Parameters
baseUrls: (Mutable)List<BaseUrl!>!

The list of base URLs.

Returns
Int

The number of priority levels after exclusion.

reset

fun reset(): Unit

Resets the state.

selectBaseUrl

fun selectBaseUrl(baseUrls: (Mutable)List<BaseUrl!>!): BaseUrl?

Selects the base URL to use from the given list.

The list is reduced by service location and priority of base URLs that have been passed to exclude. The base URL to use is then selected from the remaining base URLs by priority and weight.

Parameters
baseUrls: (Mutable)List<BaseUrl!>!

The list of base URLs to select from.

Returns
BaseUrl?

The selected base URL after exclusion or null if all elements have been excluded.