eliminate old file stream cache, just use simplified cache for linting filesystem changes; otherwise switch everything to artifact cache

This commit is contained in:
Ryan Fleury committed 2025-09-24 15:40:11 -07:00
1 parent 684f6344c5
commit bdfd4c14ae
4 files changed
+132 -255

No files matched your search

+11 -74
View File
@@ -5,38 +5,17 @@
#define FILE_STREAM_H
////////////////////////////////
//~ rjf: Per-Path Info Cache Types
typedef struct FS_RangeNode FS_RangeNode;
struct FS_RangeNode
{
FS_RangeNode *next;
C_ID id;
U64 working_count;
};
typedef struct FS_RangeSlot FS_RangeSlot;
struct FS_RangeSlot
{
FS_RangeNode *first;
FS_RangeNode *last;
};
//~ rjf: Path Cache
typedef struct FS_Node FS_Node;
struct FS_Node
{
FS_Node *next;
// rjf: file metadata
FS_Node *prev;
String8 path;
FileProperties props;
// rjf: hash store root
C_Root root;
// rjf: sub-table of per-requested-file-range info
U64 slots_count;
FS_RangeSlot *slots;
U64 gen;
U64 last_modified_timestamp;
U64 size;
};
typedef struct FS_Slot FS_Slot;
@@ -46,54 +25,17 @@ struct FS_Slot
FS_Node *last;
};
typedef struct FS_Stripe FS_Stripe;
struct FS_Stripe
{
Arena *arena;
CondVar cv;
RWMutex rw_mutex;
};
////////////////////////////////
//~ rjf: Shared State Bundle
typedef struct FS_Request FS_Request;
struct FS_Request
{
FS_Request *next;
C_Key key;
String8 path;
Rng1U64 range;
};
typedef struct FS_RequestNode FS_RequestNode;
struct FS_RequestNode
{
FS_RequestNode *next;
FS_Request v;
};
typedef struct FS_Shared FS_Shared;
struct FS_Shared
{
Arena *arena;
U64 change_gen;
// rjf: path info cache
U64 slots_count;
U64 stripes_count;
FS_Slot *slots;
FS_Stripe *stripes;
// rjf: requests
Mutex req_mutex;
Arena *req_arena;
FS_RequestNode *first_req;
FS_RequestNode *last_req;
U64 req_count;
// rjf: request take counter
U64 lane_req_take_counter;
StripeArray stripes;
};
////////////////////////////////
@@ -101,12 +43,6 @@ struct FS_Shared
global FS_Shared *fs_shared = 0;
////////////////////////////////
//~ rjf: Basic Helpers
internal U64 fs_little_hash_from_string(String8 string);
internal U128 fs_big_hash_from_string_range(String8 string, Rng1U64 range);
////////////////////////////////
//~ rjf: Top-Level API
@@ -118,16 +54,17 @@ internal void fs_init(void);
internal U64 fs_change_gen(void);
////////////////////////////////
//~ rjf: Cache Interaction
//~ rjf: Artifact Cache Hooks / Accessing API
internal C_Key fs_content_key_from_artifact_key(String8 key);
internal AC_Artifact fs_artifact_create(String8 key, B32 *retry_out);
internal void fs_artifact_destroy(AC_Artifact artifact);
internal C_Key fs_key_from_path_range_new(String8 path, Rng1U64 range, U64 endt_us);
#define fs_key_from_path(path, endt_us) fs_key_from_path_range_new((path), r1u64(0, max_U64), (endt_us))
internal C_Key fs_key_from_path_range(String8 path, Rng1U64 range, U64 endt_us);
internal U128 fs_hash_from_path_range(String8 path, Rng1U64 range, U64 endt_us);
#define fs_key_from_path(path, endt_us) fs_key_from_path_range((path), r1u64(0, max_U64), (endt_us))
#define fs_hash_from_path(path, endt_us) fs_hash_from_path_range((path), r1u64(0, max_U64), (endt_us))
////////////////////////////////
//~ rjf: Asynchronous Tick