#ifndef ENTROPYFS_H
#define ENTROPYFS_H
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define EFS_ABI_VERSION 1u
#define EFS_ENGINE_OPEN 0
#define EFS_ENGINE_CREATE 1
#define EFS_ENGINE_OPEN_RO 2
enum entropyfs_error {
EFS_OK = 0,
EFS_NOT_FOUND = 1,
EFS_INVALID_ARGUMENT = 2,
EFS_CORRUPT_STORE = 3,
EFS_INCOMPATIBLE_FORMAT = 4,
EFS_RESOURCE_LIMIT = 5,
EFS_IO = 6,
EFS_BUSY = 7,
EFS_UNSUPPORTED = 8,
EFS_INTERNAL = 9,
EFS_CLOSED = 10,
};
typedef struct entropyfs_engine entropyfs_engine;
#define EFS_BLOB_ID_LEN 32
uint32_t entropyfs_abi_version(void);
int entropyfs_engine_open(const char *path, int mode,
entropyfs_engine **out_handle);
int entropyfs_engine_close(entropyfs_engine *handle);
int entropyfs_blob_put(entropyfs_engine *handle, const uint8_t *data,
size_t len, uint8_t *id );
int entropyfs_blob_get(entropyfs_engine *handle,
const uint8_t *id ,
uint8_t **out_buf, size_t *out_len);
int entropyfs_blob_read_range(entropyfs_engine *handle,
const uint8_t *id ,
uint64_t offset, size_t len, uint8_t **out_buf,
size_t *out_len);
int entropyfs_contains(entropyfs_engine *handle,
const uint8_t *id , int *out);
int entropyfs_sync(entropyfs_engine *handle);
int entropyfs_compact(entropyfs_engine *handle, uint64_t *out_reclaimed,
uint64_t *out_physical);
int entropyfs_metrics_json(entropyfs_engine *handle, uint8_t **out_buf,
size_t *out_len);
int entropyfs_last_error(char *buf, size_t cap);
void entropyfs_free(uint8_t *ptr);
#ifdef __cplusplus
}
#endif
#endif