diff --git a/TODO.txt b/TODO.txt index 96a98b1..1aaeba4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,4 @@ - Chunks should not be separated between the main and orphaned folders. The concept of "orphans" or "to be removed" should only be held in-memory. If a chunk server crashes, upon restarting and reconnecting to the master any chunk will be re-marked for removal when speaking to the master. -- Implement write on the client - Implement proper operation handles that allow users to wait for specific events - Clean up the read operation for clients - Check that the corner case where read and writes go over the length of the file work correctly @@ -7,5 +6,5 @@ - Return the number of bytes read or written in the TinyDFS_Result struct - Make parallel uploads/downloads configurable - Recalculate next write locations whenever a write occurs, not at each read -- Make sure there are no mixups with the default tag value for connections, which I think is -1? - avoid replay attacks +- find a way to remove over-replicated chunks diff --git a/src/file_tree.c b/src/file_tree.c index 1046fb8..121d93b 100644 --- a/src/file_tree.c +++ b/src/file_tree.c @@ -422,11 +422,11 @@ int file_tree_read(FileTree *ft, string path, File *f = &e->f; + *chunk_size = f->chunk_size; + if (len == 0) return 0; - *chunk_size = f->chunk_size; - uint64_t first_chunk_index = off / f->chunk_size; uint64_t last_chunk_index = first_chunk_index + (len - 1) / f->chunk_size; diff --git a/src/main_test.c b/src/main_test.c index a2d69bb..294a0e7 100644 --- a/src/main_test.c +++ b/src/main_test.c @@ -15,7 +15,7 @@ int main(int argc, char **argv) // TODO: set simulation_should_stop=true on ctrl+C - startup_simulation(3); + startup_simulation(2); // Spawn metadata server (leader) spawn_simulated_process("--addr 127.0.0.1 --port 8080 --leader");