Some checks failed
Documentation / build-and-publish (push) Waiting to run
Test / test (push) Waiting to run
Checkout test / test (push) Successful in 5s
CI with Native Libraries / test-native (push) Has been cancelled
CI with Native Libraries / build-release (push) Has been cancelled
48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
#ifndef STREAMING_IO_H
|
|
#define STREAMING_IO_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Opaque handle for extractor
|
|
typedef struct sio_extractor sio_extractor_t;
|
|
|
|
// Progress callback
|
|
typedef void (*sio_progress_cb)(const char* path, uint64_t bytes_done, uint64_t bytes_total, void* user_data);
|
|
|
|
// Error callback
|
|
typedef void (*sio_error_cb)(const char* path, const char* error, void* user_data);
|
|
|
|
// Extractor operations
|
|
sio_extractor_t* sio_create_extractor(uint32_t num_threads);
|
|
void sio_destroy_extractor(sio_extractor_t* ex);
|
|
|
|
// Set callbacks
|
|
void sio_set_progress_cb(sio_extractor_t* ex, sio_progress_cb cb, void* user_data);
|
|
void sio_set_error_cb(sio_extractor_t* ex, sio_error_cb cb, void* user_data);
|
|
|
|
// Extract tar.gz
|
|
// Uses: mmap + parallel decompression + O_DIRECT for large files
|
|
// Returns: 0 on success, -1 on error
|
|
int sio_extract_tar_gz(sio_extractor_t* ex, const char* archive_path, const char* dst_dir);
|
|
|
|
// Extract with hash verification
|
|
int sio_extract_with_verification(sio_extractor_t* ex, const char* archive_path,
|
|
const char* dst_dir, const char* expected_sha256);
|
|
|
|
// Get last error
|
|
const char* sio_last_error(sio_extractor_t* ex);
|
|
|
|
// Utility
|
|
uint64_t sio_get_bytes_extracted(sio_extractor_t* ex);
|
|
uint64_t sio_get_bytes_written(sio_extractor_t* ex);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // STREAMING_IO_H
|