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
54 lines
1.4 KiB
C
54 lines
1.4 KiB
C
#ifndef ARTIFACT_SCANNER_H
|
|
#define ARTIFACT_SCANNER_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Opaque handle for scanner
|
|
typedef struct as_scanner as_scanner_t;
|
|
|
|
// Artifact structure
|
|
typedef struct as_artifact {
|
|
char path[256]; // Relative path from run directory
|
|
int64_t size_bytes; // File size
|
|
int64_t mtime; // Modification time (Unix timestamp)
|
|
uint32_t mode; // File permissions
|
|
} as_artifact_t;
|
|
|
|
// Scan result
|
|
typedef struct as_result {
|
|
as_artifact_t* artifacts; // Array of artifacts
|
|
size_t count; // Number of artifacts
|
|
int64_t total_size; // Sum of all sizes
|
|
int64_t discovery_time_ms; // Scan duration
|
|
} as_result_t;
|
|
|
|
// Scanner operations
|
|
as_scanner_t* as_create(const char** exclude_patterns, size_t pattern_count);
|
|
void as_destroy(as_scanner_t* scanner);
|
|
|
|
// Add exclude patterns
|
|
void as_add_exclude(as_scanner_t* scanner, const char* pattern);
|
|
|
|
// Scan directory
|
|
// Uses platform-optimized traversal (fts on BSD, getdents64 on Linux, getattrlistbulk on macOS)
|
|
as_result_t* as_scan_directory(as_scanner_t* scanner, const char* run_dir);
|
|
|
|
// Memory management
|
|
void as_free_result(as_result_t* result);
|
|
|
|
// Error handling
|
|
const char* as_last_error(as_scanner_t* scanner);
|
|
|
|
// Utility
|
|
uint64_t as_get_scan_count(as_scanner_t* scanner); // Total files scanned (including excluded)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // ARTIFACT_SCANNER_H
|