mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-27 22:11:47 -07:00
formalize file/folder evaluations; use set-types for files/folders so that we can evaluate both file metadata & contents, rather than just assuming the contents; adjust slice view rule to just expand to the contents, rather than achieving the slice with a changed type
This commit is contained in:
@@ -189,11 +189,11 @@ fs_key_from_path_range(String8 path, Rng1U64 range)
|
||||
return key;
|
||||
}
|
||||
|
||||
internal U64
|
||||
fs_timestamp_from_path(String8 path)
|
||||
internal FileProperties
|
||||
fs_properties_from_path(String8 path)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 result = 0;
|
||||
FileProperties result = {0};
|
||||
path = path_normalized_from_string(scratch.arena, path);
|
||||
U64 path_hash = fs_little_hash_from_string(path);
|
||||
U64 slot_idx = path_hash%fs_shared->slots_count;
|
||||
@@ -206,33 +206,7 @@ fs_timestamp_from_path(String8 path)
|
||||
{
|
||||
if(str8_match(path, n->path, 0))
|
||||
{
|
||||
result = n->timestamp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
fs_size_from_path(String8 path)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 result = 0;
|
||||
path = path_normalized_from_string(scratch.arena, path);
|
||||
U64 path_hash = fs_little_hash_from_string(path);
|
||||
U64 slot_idx = path_hash%fs_shared->slots_count;
|
||||
U64 stripe_idx = slot_idx%fs_shared->stripes_count;
|
||||
FS_Slot *slot = &fs_shared->slots[slot_idx];
|
||||
FS_Stripe *stripe = &fs_shared->stripes[stripe_idx];
|
||||
OS_MutexScopeR(stripe->rw_mutex)
|
||||
{
|
||||
for(FS_Node *n = slot->first; n != 0; n = n->next)
|
||||
{
|
||||
if(str8_match(path, n->path, 0))
|
||||
{
|
||||
result = n->size;
|
||||
result = n->props;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -333,7 +307,7 @@ ASYNC_WORK_DEF(fs_stream_work)
|
||||
B32 read_good = (pre_props.modified == post_props.modified &&
|
||||
pre_props.size == post_props.size &&
|
||||
read_size == data.size &&
|
||||
file_handle_is_valid);
|
||||
(file_handle_is_valid || pre_props.flags & FilePropertyFlag_IsFolder));
|
||||
if(!read_good)
|
||||
{
|
||||
ProfScope("abort")
|
||||
@@ -367,12 +341,11 @@ ASYNC_WORK_DEF(fs_stream_work)
|
||||
}
|
||||
if(node != 0 && read_good)
|
||||
{
|
||||
if(node->timestamp != 0)
|
||||
if(node->props.modified != 0)
|
||||
{
|
||||
ins_atomic_u64_inc_eval(&fs_shared->change_gen);
|
||||
}
|
||||
node->timestamp = post_props.modified;
|
||||
node->size = post_props.size;
|
||||
node->props = post_props;
|
||||
}
|
||||
}
|
||||
os_condition_variable_broadcast(path_stripe->cv);
|
||||
@@ -403,7 +376,7 @@ fs_detector_thread__entry_point(void *p)
|
||||
for(FS_Node *n = slot->first; n != 0; n = n->next)
|
||||
{
|
||||
FileProperties props = os_properties_from_file_path(n->path);
|
||||
if(props.modified != n->timestamp)
|
||||
if(props.modified != n->props.modified)
|
||||
{
|
||||
for(U64 range_slot_idx = 0; range_slot_idx < n->slots_count; range_slot_idx += 1)
|
||||
{
|
||||
|
||||
@@ -31,8 +31,7 @@ struct FS_Node
|
||||
|
||||
// rjf: file metadata
|
||||
String8 path;
|
||||
U64 timestamp;
|
||||
U64 size;
|
||||
FileProperties props;
|
||||
|
||||
// rjf: sub-table of per-requested-file-range info
|
||||
U64 slots_count;
|
||||
@@ -108,8 +107,7 @@ internal U64 fs_change_gen(void);
|
||||
internal U128 fs_hash_from_path_range(String8 path, Rng1U64 range, U64 endt_us);
|
||||
internal U128 fs_key_from_path_range(String8 path, Rng1U64 range);
|
||||
|
||||
internal U64 fs_timestamp_from_path(String8 path);
|
||||
internal U64 fs_size_from_path(String8 path);
|
||||
internal FileProperties fs_properties_from_path(String8 path);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Streaming Work
|
||||
|
||||
Reference in New Issue
Block a user