Fix test client refactor: broken includes, typos, and structural bugs

- Rename include/lib.h to include/toastyfs.h, add -Iinclude to build
- Fix build.sh: replace deleted blob_client.c with random_client.c
- Fix src/client.c: wrong include (client_lib.h), add missing STEP_FETCH_CHUNK
  enum, add missing struct fields (bucket, key, blob_size, content_hash,
  error, file_size, phase_time), fix TRANSFER_WAITING->TRANSFER_PENDING,
  fix begin_transfers() wrong variable refs, fix reap->resp typo,
  fix resp.size check inversion, fix state->tfs in process_events,
  fix tfs->transfer->tfs->transfers, fix tfs->phase->tfs->step,
  fix function name typos in toastyfs_get_result, fix async_put->async_get
  in toastyfs_get, fix ReplyMessage->RequestMessage in async_delete,
  fix put_result/delete_result return types, fix wait_until_result,
  add leader_idx() and toastyfs_alloc(), add missing MessageHeader casts
- Fix src/random_client.c: randm_client.h typo, addrs[i]->addrs[num_addrs],
  use toastyfs_alloc() for opaque type, fix tfs->state->tfs refs
- Fix src/random_client.h: wrong include guard names
- Fix src/main.c: replace deleted client.h/blob_client.h with
  random_client.h, update all client spawn configs to use RandomClient

https://claude.ai/code/session_018MRQTdAZoBCXJZgdP4U6V6
This commit is contained in:
Claude
2026-02-21 11:46:01 +00:00
parent 99b6c9dfcc
commit 337cdad885
6 changed files with 131 additions and 92 deletions
+12 -7
View File
@@ -3,11 +3,12 @@
#endif
#include <quakey.h>
#include <toastyfs.h>
#include <stdint.h>
#include <assert.h>
#include "server.h"
#include "randm_client.h"
#include "random_client.h"
static uint64_t next_random_client_id = 100;
@@ -31,23 +32,27 @@ int random_client_init(void *state_, int argc, char **argv,
fprintf(stderr, "Node limit reached\n");
return -1;
}
addrs[i] = argv[i];
addrs[num_addrs] = argv[i];
num_addrs++;
} else {
// Ignore unknown options
}
}
ToastyFS *tfs = toastyfs_init(addrs, num_addrs);
if (tfs == NULL)
state->tfs = toastyfs_alloc();
if (state->tfs == NULL)
return -1;
uint64_t client_id = next_random_client_id++;
if (toastyfs_init(state->tfs, client_id, addrs, num_addrs) < 0)
return -1;
*timeout = 0;
if (pcap < TCP_POLL_CAPACITY) {
fprintf(stderr, "Blob client :: Not enough poll capacity\n");
fprintf(stderr, "Random client :: Not enough poll capacity\n");
return -1;
}
*pnum = tcp_register_events(&state->tcp, ctxs, pdata);
*pnum = toastyfs_register_events(state->tfs, ctxs, pdata, pcap);
return 0;
}
@@ -90,7 +95,7 @@ int random_client_tick(void *state_, void **ctxs,
break;
}
*pnum = toastyfs_register_events(tfs, ctxs, pdata, pcap, timeout);
*pnum = toastyfs_register_events(state->tfs, ctxs, pdata, pcap);
return 0;
}