#pragma once #include "utils.h" #include "config.h" /// @brief Checks whether the specified image identifier is valid. This call will return an error with a message describing the problem if the identifier is invalid. /// @param identifier The identifier to check. /// @return The result of the operation. result_t check_image_identifier(const char* identifier); /// @brief Checks whether the specified image exists. /// @param _exists The pointer to where the result should be stored. /// @param config The program configuration to use. /// @param identifier The identifier of the image to check. /// @return The result of the operation. result_t check_image_exists(bool* _exists, const config_t* config, const char* identifier); /// @brief Returns the path of the image pool directory. /// @param _path The pointer to where the path should be stored. The caller is responsible for freeing the memory. /// @param config The program configuration to use. /// @return The result of the operation. result_t get_image_pool_path(char** _path, const config_t* config); /// @brief Returns the path of the specified image. /// @param _path The pointer to where the path should be stored. The caller is responsible for freeing the memory. /// @param config The program configuration to use. /// @param identifier The identifier of the image. /// @return The result of the operation. result_t get_image_path(char** _path, const config_t* config, const char* identifier); /// @brief Returns the path of the file containing the default image identifier. /// @param _path The pointer to where the path should be stored. The caller is responsible for freeing the memory. /// @param config The program configuration to use. /// @return The result of the operation. result_t get_default_image_path(char** _path, const config_t* config); /// @brief Returns the path of the temporary file used to store the disk before it is moved to the image pool. /// @param _path The pointer to where the path should be stored. The caller is responsible for freeing the memory. /// @param config The program configuration to use. /// @return The result of the operation. result_t get_temporary_image_path(char** _path, const config_t* config); /// @brief Returns the identifier of the default image. /// @param _identifier The pointer to where the identifier should be stored. The caller is responsible for freeing the memory. /// @param config The program configuration to use. /// @return The result of the operation. result_t get_default_image(char** _identifier, const config_t* config); /// @brief Sets the identifier of the default image. /// @param config The program configuration to use. /// @param identifier The identifier of the image to set as default. /// @return The result of the operation. result_t set_default_image(const config_t* config, const char* identifier); /// @brief Adds a new image to the pool, using the specified container as the source. /// @param _identifier The pointer to where the identifier should be stored. The caller is responsible for freeing the memory. /// @param config The program configuration to use. /// @param container The identifier of the container to use as the source. /// @return The result of the operation. result_t add_image(char** _identifier, const config_t* config, const char* container); /// @brief Removes the specified image from the pool. /// @param config The program configuration to use. /// @param identifier The identifier of the image to remove. /// @return The result of the operation. result_t remove_image(const config_t* config, const char* identifier); /// @brief Lists the images in the pool. /// @param _identifiers The pointer to where the list of identifiers should be stored. The caller is responsible for freeing the strings and the array. /// @param _count The pointer to where the count of identifiers should be stored. /// @param config The program configuration to use. /// @return The result of the operation. result_t list_images(char*** _identifiers, size_t* _count, const config_t* config);