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

net.bjoernpetersen.musicbot.spi.loader.Resource.kt Maven / Gradle / Ivy

There is a newer version: 0.25.0
Show newest version
package net.bjoernpetersen.musicbot.spi.loader

/**
 * A resource that is allocated when a song is loaded and needs to be deallocated at some point.
 *
 * One resource object may be reused any number of times as long as it is [valid][isValid]
 */
interface Resource {

    /**
     * Free this resource.
     *
     * Future [isValid] calls should never return `true` again.
     * This means you should introduce an `isFreed` field to short-circuit [isValid].
     *
     */
    suspend fun free()

    /**
     * Checks whether this resource is still valid and can be used.
     *
     * For example: a file resource may check whether the file still exists
     */
    val isValid: Boolean
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy