All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.arbjerg.lavalink.client.loadbalancing.ILoadBalancer.kt Maven / Gradle / Ivy

There is a newer version: 3.1.0
Show newest version
package dev.arbjerg.lavalink.client.loadbalancing

import dev.arbjerg.lavalink.client.LavalinkNode
import dev.arbjerg.lavalink.client.loadbalancing.builtin.IPenaltyProvider

interface ILoadBalancer {
    /**
     * Selects a node based on the criteria of the load balancer.
     *
     * @return The best node that matches the criteria
     * @throws RuntimeException when no nodes are available
     *
     * @see #selectNode(VoiceRegion)
     */
    fun selectNode(): LavalinkNode {
        return selectNode(null, null)
    }

    /**
     * Selects a node based on the criteria of the load balancer.
     * @param region A voice region may be provided to filter on the closest region to this node
     * @param guildId The ID of the guild to be associated with the returned node
     *
     * @return The best node that matches the criteria
     * @throws RuntimeException when no nodes are available
     */
    fun selectNode(region: VoiceRegion?, guildId: Long?): LavalinkNode

    /**
     * Adds a penalty provider to the load balancer.
     */
    fun addPenaltyProvider(penaltyProvider: IPenaltyProvider)

    /**
     * Removes a penalty provider from the load balancer.
     */
    fun removePenaltyProvider(penaltyProvider: IPenaltyProvider)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy