Added some more unimplemented functions
This commit is contained in:
parent
07e04889a5
commit
7d826ccb99
@ -63,4 +63,9 @@ bool backing_exists(const char* backing) {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t get_backing_creation_time(const char* backing) {
|
||||||
|
// A valid backing name is a number, corresponding to the timestamp of the backing disk creation
|
||||||
|
return strtoull(backing, NULL, 10);
|
||||||
|
}
|
||||||
|
@ -26,6 +26,11 @@ bool backing_exists(const char* backing);
|
|||||||
/// @return The list of backing disks. The caller is responsible for freeing the returned array and strings. This function can return NULL.
|
/// @return The list of backing disks. The caller is responsible for freeing the returned array and strings. This function can return NULL.
|
||||||
char** list_backings(void);
|
char** list_backings(void);
|
||||||
|
|
||||||
|
/// @brief Get the creation time of the specified backing disk.
|
||||||
|
/// @param backing The valid backing disk name.
|
||||||
|
/// @return The creation time of the specified backing disk. If the backing disk does not exist, this function returns 0.
|
||||||
|
uint64_t get_backing_creation_time(const char* backing);
|
||||||
|
|
||||||
/// @brief Finds the latest backing disk.
|
/// @brief Finds the latest backing disk.
|
||||||
/// @return The latest backing disk. The caller is responsible for freeing the returned string. This function can return NULL.
|
/// @return The latest backing disk. The caller is responsible for freeing the returned string. This function can return NULL.
|
||||||
char* find_latest_backing(void);
|
char* find_latest_backing(void);
|
||||||
|
@ -20,6 +20,12 @@ bool create_backed_disk(const char* disk, const char* backing);
|
|||||||
/// @return true if the disk is packed, otherwise false.
|
/// @return true if the disk is packed, otherwise false.
|
||||||
bool pack_disk(const char* disk);
|
bool pack_disk(const char* disk);
|
||||||
|
|
||||||
|
/// @brief Moves the backing file of a disk.
|
||||||
|
/// @param disk The path to the disk, which exists.
|
||||||
|
/// @param backing The path to the new backing file, which exists.
|
||||||
|
/// @return true if the backing file is moved, otherwise false.
|
||||||
|
bool move_backing_file(const char* disk, const char* backing);
|
||||||
|
|
||||||
/// @brief Gets the backing file of a disk.
|
/// @brief Gets the backing file of a disk.
|
||||||
/// @param disk The path to the disk, which exists.
|
/// @param disk The path to the disk, which exists.
|
||||||
/// @return The backing file of the disk. The caller is responsible for freeing the returned string. This function can return NULL.
|
/// @return The backing file of the disk. The caller is responsible for freeing the returned string. This function can return NULL.
|
||||||
|
19
src/entry.h
19
src/entry.h
@ -26,6 +26,11 @@ bool entry_exists(const char* entry);
|
|||||||
/// @return The list of entries. The caller is responsible for freeing the returned array and strings. This function can return NULL.
|
/// @return The list of entries. The caller is responsible for freeing the returned array and strings. This function can return NULL.
|
||||||
char** list_entries(void);
|
char** list_entries(void);
|
||||||
|
|
||||||
|
/// @brief Get the last access time of the specified entry.
|
||||||
|
/// @param entry The valid entry name, which must exist.
|
||||||
|
/// @return The last access time of the specified entry. If the entry does not exist, this function returns 0.
|
||||||
|
uint64_t get_entry_last_access(const char* entry);
|
||||||
|
|
||||||
/// @brief Finds the oldest entry (based on last access time).
|
/// @brief Finds the oldest entry (based on last access time).
|
||||||
/// @return The oldest entry. The caller is responsible for freeing the returned string. This function can return NULL.
|
/// @return The oldest entry. The caller is responsible for freeing the returned string. This function can return NULL.
|
||||||
char* find_oldest_entry(void);
|
char* find_oldest_entry(void);
|
||||||
@ -39,3 +44,17 @@ bool create_entry(const char* entry);
|
|||||||
/// @param entry The valid entry name.
|
/// @param entry The valid entry name.
|
||||||
/// @return true if the entry was deleted, otherwise false.
|
/// @return true if the entry was deleted, otherwise false.
|
||||||
bool delete_entry(const char* entry);
|
bool delete_entry(const char* entry);
|
||||||
|
|
||||||
|
/// @brief Updates the last access time of the specified entry.
|
||||||
|
/// @param entry The valid entry name, which must exist.
|
||||||
|
/// @return true if the last access time was updated, otherwise false.
|
||||||
|
bool update_entry_last_access(const char* entry);
|
||||||
|
|
||||||
|
/// @brief Returns the available space in the entries directory.
|
||||||
|
/// @return The available space in the entries directory. If the entries directory does not exist, this function returns 0.
|
||||||
|
uint64_t get_available_space(void);
|
||||||
|
|
||||||
|
/// @brief Reserves the specified space in the entries directory, by deleting the oldest entries.
|
||||||
|
/// @param space The space to reserve, in bytes.
|
||||||
|
/// @return true if the space was fully reserved, otherwise false.
|
||||||
|
bool reserve_space(uint64_t space);
|
||||||
|
Loading…
Reference in New Issue
Block a user