36 lines
1.2 KiB
C
36 lines
1.2 KiB
C
#ifndef FSYNC_FILE_FETCHER_H
|
|
#define FSYNC_FILE_FETCHER_H
|
|
|
|
#include "queue_manager.h"
|
|
#include "redis_client.h"
|
|
|
|
/* Fetcher context */
|
|
typedef struct {
|
|
redis_conn_t *redis;
|
|
char local_cache_dir[4096];
|
|
int fetch_timeout_sec;
|
|
int max_retries;
|
|
} fetcher_config_t;
|
|
|
|
/* Initialize fetcher */
|
|
int fetcher_init(fetcher_config_t *config, const char *cache_dir);
|
|
|
|
/* Fetch file from remote host (stub for distributed systems) */
|
|
int fetcher_fetch_file(const file_update_t *update, const char *local_path,
|
|
fetcher_config_t *config);
|
|
|
|
/* Verify fetched file against checksum */
|
|
int fetcher_verify_checksum(const char *file_path, const char *expected_checksum);
|
|
|
|
/* Process queue item - fetch and verify */
|
|
int fetcher_process_update(const file_update_t *update, fetcher_config_t *config);
|
|
|
|
/* Record successful fetch in Redis */
|
|
int fetcher_record_success(redis_conn_t *redis, const file_update_t *update,
|
|
const char *local_path);
|
|
|
|
/* Record failed fetch attempt */
|
|
int fetcher_record_failure(redis_conn_t *redis, const file_update_t *update,
|
|
const char *reason);
|
|
|
|
#endif /* FSYNC_FILE_FETCHER_H */ |