Continue work on DST framework

This commit is contained in:
2025-10-29 21:46:17 +01:00
parent 24c0134c03
commit 174f37c6c0
17 changed files with 1407 additions and 710 deletions
+7 -7
View File
@@ -16,7 +16,7 @@ static void hash_list_init(HashList *hash_list)
static void hash_list_free(HashList *hash_list)
{
free(hash_list->items);
sys_free(hash_list->items);
}
static int hash_list_insert(HashList *hash_list, SHA256 hash)
@@ -30,7 +30,7 @@ static int hash_list_insert(HashList *hash_list, SHA256 hash)
int new_capacity = hash_list->capacity ? hash_list->capacity * 2 : 16;
SHA256 *new_items = realloc(hash_list->items, new_capacity * sizeof(SHA256));
SHA256 *new_items = sys_realloc(hash_list->items, new_capacity * sizeof(SHA256));
if (new_items == NULL)
return -1;
@@ -750,7 +750,7 @@ static bool is_chunk_server_message_type(uint16_t type)
return false;
}
int metadata_server_init(MetadataServer *state, int argc, char **argv)
int metadata_server_init(MetadataServer *state, int argc, char **argv, void **contexts, struct pollfd *polled)
{
(void) argc;
(void) argv;
@@ -778,7 +778,7 @@ int metadata_server_init(MetadataServer *state, int argc, char **argv)
return -1;
}
return 0;
return tcp_register_events(&state->tcp, contexts, polled);
}
int metadata_server_free(MetadataServer *state)
@@ -788,10 +788,10 @@ int metadata_server_free(MetadataServer *state)
return 0;
}
int metadata_server_step(MetadataServer *state)
int metadata_server_step(MetadataServer *state, void **contexts, struct pollfd *polled, int num_polled)
{
Event events[MAX_CONNS+1];
int num_events = tcp_process_events(&state->tcp, events);
int num_events = tcp_translate_events(&state->tcp, events, contexts, polled, num_polled);
for (int i = 0; i < num_events; i++) {
int conn_idx = events[i].conn_idx;
@@ -852,5 +852,5 @@ int metadata_server_step(MetadataServer *state)
}
}
return 0;
return tcp_register_events(&state->tcp, contexts, polled);
}