This project implements a key-value store using the Raft consensus algorithm. It provides a fault-tolerant, distributed system for storing and retrieving data.
This Raft implementation supports the following distributed data structure commands:
set <key> <value>- Store a key-value pairget <key>- Retrieve the value for a keyrm <key>- Remove a key-value pairincr <key>- Increment a numeric valuedecr <key>- Decrement a numeric valuekeys- Get all keys in the storage
lpush <key> <element> [element2] [element3]- Prepend elements to a listlpop <key>- Remove and return the leftmost element from a listlindex <key> <index>- Get the element at the specified index in a listllen <key>- Get the length of a list
sadd <key> <member> [member2] [member3]- Add one or more members to a setsrem <key> <member> [member2] [member3]- Remove one or more members from a setsismember <key> <member>- Test if member is in the set (returns 1 if true, 0 if false)sinter <key1> [key2] [key3]- Return the intersection of multiple setsscard <key>- Get the cardinality (number of elements) of a set
Hash operations allow you to store field-value pairs within a single key, similar to Redis hashes.
hset <key> <field> <value> [field value ...]- Set field-value pairs in a hashhget <key> <field>- Get the value of a hash fieldhmget <key> <field> [field2] [field3]- Get the values of multiple hash fieldshincrby <key> <field> <increment>- Increment the integer value of a hash field by the given number
status- Get the current cluster status
All commands are replicated across the Raft cluster for consistency and durability.
- Implement Snapshotting
- Add ttl to keys