Added space reservation

This commit is contained in:
2024-02-20 14:54:04 +01:00
parent a260002a6c
commit af34a9c260
6 changed files with 177 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include "utils.h"
#include "disk.h"
#define CONTAINER_IDENTIFIER_MAX_LENGTH 64
@@ -66,4 +67,25 @@ result_t list_containers(char*** _containers);
/// @param _backing The string pointer to store the resulting backing in.
/// @param container The container to get the backing of.
/// @return The result of the operation.
result_t get_container_backing(char** _backing, const char* container);
result_t get_container_backing(char** _backing, const char* container);
/// @brief Gets information about the given container. If the container does not exist, the call will return a failure result with an error message.
/// @param _info The string pointer to store the resulting disk information in. The caller is responsible for freeing the string.
/// @param container The container to get information about.
/// @return The result of the operation.
result_t get_container_info(disk_info_t* _info, const char* container);
/// @brief Gets the oldest container in the pool.
/// @param _container The string pointer to store the resulting container in. The caller is responsible for freeing the string.
/// @return The result of the operation.
result_t get_oldest_container(char** _container);
/// @brief Gets the available space in the pool.
/// @param _space The string pointer to store the resulting space in, in bytes. The caller is responsible for freeing the string.
/// @return The result of the operation.
result_t get_container_pool_space(uint64_t* _space);
/// @brief Reserves the given space in the pool. If the pool does not have enough space, the oldest containers will be removed to make space.
/// @param size The size to reserve, in bytes.
/// @return The result of the operation.
result_t reserve_container_pool_space(uint64_t size);