-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update node penalty naming to be more inline with function, break it …
…out into an interface to allow for overriding.
- Loading branch information
Showing
6 changed files
with
56 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/dev/arbjerg/lavalink/client/loadbalancing/builtin/INodeHealthProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package dev.arbjerg.lavalink.client.loadbalancing.builtin | ||
|
||
import dev.arbjerg.lavalink.client.loadbalancing.MAX_ERROR | ||
import dev.arbjerg.lavalink.protocol.v4.Message | ||
|
||
interface INodeHealthProvider { | ||
/** | ||
* Called for each event on the node. | ||
*/ | ||
fun handleTrackEvent(event: Message.EmittedEvent) | ||
|
||
/** | ||
* Calculate the penalty for the node based off of its health. | ||
* | ||
* Return value should never exceed [MAX_ERROR]. Lower means to take preference. | ||
* | ||
* @return A number between 0 and [MAX_ERROR] (inclusive), using numbers outside of this range may cause errors. | ||
*/ | ||
fun calculateTotalHealthPenalty(): Int | ||
|
||
/** | ||
* Gives a simple answer if the node is considered healthy. | ||
* | ||
* @return true if the node is in a healthy state | ||
*/ | ||
fun isHealthy() : Boolean | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters