rtengine/include/fio.h
2023-10-11 22:23:26 +02:00

50 lines
958 B
C

#ifndef VY_FIO_H
#define VY_FIO_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "voyage.h"
typedef struct {
void *data;
size_t size;
} vy_file_buffer;
/* used to identify a file (XXH3 hash of the path) */
typedef uint64_t vy_file_id;
typedef unsigned int vy_fio_handle;
typedef struct {
unsigned int queue_size;
unsigned int max_file_count;
} vy_fio_config;
bool vyInitFIO(const vy_fio_config *config);
void vyShutdownFIO(void);
vy_file_id vyGetFileId(const char *path);
vy_file_id vyGetFileIdFromSpan(vy_text_span path);
vy_file_id vyAddFile(const char *path);
vy_file_id vyAddFileFromSpan(vy_text_span path);
const char *vyGetFilePath(vy_file_id fid);
vy_fio_handle vyEnqueueRead(vy_file_id fid);
void vyAbortFIO(vy_fio_handle fio);
bool vyIsFIOFinished(vy_fio_handle fio);
bool vyRetrieveReadBuffer(vy_fio_handle fio, vy_file_buffer *buffer);
void vyFreeFileBuffer(vy_file_buffer buffer);
#endif