This project demonstrates storing key-value pairs in a hash map data structure with data serialization.
-
Double Hashtable for Resizing:
- Uses two hashtables (
ht1
&ht2
). - When the load factor exceeds the maximum, resizing begins, and nodes are moved from
ht2
toht1
.
- Uses two hashtables (
-
Server Commands:
- The server listens for commands like
get
,set
,del
, andkeys
, each corresponding to operations on the underlying key-value store.
- The server listens for commands like
-
Data Serialization:
- Generalized encoding to handle different types of data.
- Supports getting a list of strings as a response.
server-4.cpp
: Contains the server-side implementation, including handling connections, processing requests, and managing the hash table.client-4.cpp
: Contains the client-side implementation for sending requests to the server and handling responses.hashtable.cpp
: Contains the implementation of the hash table, including insertion, lookup, and resizing logic.hashtable.h
: Header file for the hash table implementation.
-
Compile the Server:
g++ -o server server-4.cpp hashtable.cpp
-
Compile the Client:
g++ -o client client-4.cpp
-
Run the Server:
./server
-
Run the Client:
./client <command> [arguments]
Example commands:
./client set key value
./client get key
./client del key
./client keys