#pragma once #include "utils.h" #define CONTAINER_IDENTIFIER_MAX_LENGTH 64 /// @brief Checks whether the given string is a valid container identifier. If the string is not a valid container identifier, the call will return a failure result with an error message. /// @param container The string to check. /// @return The result of the operation. result_t check_container_identifier(const char* container); /// @brief Checks whether the given container exists. If the container does not exist, the call will return a failure result with an error message. /// @param container The container to check. /// @return The result of the operation. result_t check_container_exists(const char* container); /// @brief Gets the container pool path. /// @param _path The string pointer to store the resulting path in. The caller is responsible for freeing the string. /// @return The result of the operation. result_t get_container_pool_path(char** _path); /// @brief Gets the container path. /// @param _path The string pointer to store the resulting path in. The caller is responsible for freeing the string. /// @param container The container to get the path of. /// @return The result of the operation. result_t get_container_path(char** _path, const char* container); /// @brief Adds a root (empty) container to the pool, with the given size. If the container already exists, the call will return a failure result with an error message. /// @param container The container to add. /// @param size The size of the container to add, in bytes. /// @return The result of the operation. result_t add_root_container(const char* container, uint64_t size); /// @brief Adds a backed container to the pool, with the given backing. If the container already exists, or the backing does not, the call will return a failure result with an error message. /// @param container The container to add. /// @param backing The backing to use for the container. /// @return The result of the operation. result_t add_backed_container(const char* container, const char* backing); /// @brief Removes the given container from the pool. If the container does not exist, the call will return a failure result with an error message. /// @param container The container to remove. /// @return The result of the operation. result_t remove_container(const char* container); /// @brief Trims (removes unused space) the given container. /// @param container The container to trim. /// @return The result of the operation. result_t trim_container(const char* container); /// @brief Resets the given container to its initial state. /// @param container The container to reset. /// @return The result of the operation. result_t reset_container(const char* container); /// @brief Checks that the given file is a container. This function is used as a filter for listing containers. /// @param file The file to check. /// @return Whether the file is a container. bool container_filter(const char* file); /// @brief Lists the containers in the pool. /// @param _containers The string pointer array to store the resulting array in. The caller is responsible for freeing the strings and the array. /// @return The result of the operation. result_t list_containers(char*** _containers);