Update DESIGN.txt and code accordingly

This commit is contained in:
2025-11-13 17:27:00 +01:00
parent facd220c59
commit cdce267768
7 changed files with 278 additions and 420 deletions
+28 -10
View File
@@ -3,6 +3,7 @@
#include <limits.h>
#include "metadata_server.h"
#include "tcp.h"
#define TAG_METADATA_SERVER 1
@@ -27,25 +28,42 @@ typedef struct {
typedef struct {
SHA256 hash;
Time marked_time;
} PendingRemoval;
Time time;
} TimedHash;
typedef struct {
int count;
int capacity;
PendingRemoval *items;
} RemovalList;
TimedHash *items;
} TimedHashList;
typedef struct {
bool trace;
Address local_addr;
Address remote_addr;
Time disconnect_time;
TCP tcp;
bool trace;
Address local_addr;
Address remote_addr;
Time disconnect_time;
TCP tcp;
ChunkStore store;
bool downloading;
PendingDownloadList pending_download_list;
RemovalList removal_list;
// List of chunks added since the last update
HashList cs_add_list;
// List of chunks marked for removal after a timeout
TimedHashList cs_rem_list;
// List of chunks that were lost due to errors or forceful removals of chunk files
HashList cs_lst_list;
} ChunkServer;
int chunk_server_init(ChunkServer *state, int argc, char **argv, void **contexts, struct pollfd *polled, int *timeout);