Commit Graph

33 Commits

Author SHA1 Message Date
Kelvin Mwinuka 52646d1564 Take expiry into account when creating snashot and AOF preamble. If the key is already expired when snapshot is taken, it will not be persisted. If the key is expired when loading a snapshot/preamble, it will not be restored. 2024-03-12 21:35:39 +08:00
Kelvin Mwinuka f27a0dda79 Implemented eviction algorithm that samples a configurable number of keys with TTLs (default 20) at a configurable interval (default 100ms) and deletes the keys that are expired. 2024-03-12 02:12:55 +08:00
Kelvin Mwinuka 52b39d5b0f Re-enabled cluster nodes in docker-compose.yml.
Created flow to forward key deletion command from non-leader node to leader node.
Created flow for propagating key deletion accross the entire cluster to maintain consistency of the deleted keys.
2024-03-11 20:39:57 +08:00
Kelvin Mwinuka c414da16b4 KeyExists keyspace function now removes the key if the key expiry is in the past.
KeyData type moved to utils package to allow sharing between multiple packages.
Updated all commands and command tests to pass context object to KeyExists, KeyLock, keyUnlock, KeyRLock, and KeyRUnlock.
Create context object for each test in all test suites instead of just passing context.Background() to all functions that accept a context.
2024-03-10 23:19:05 +08:00
Kelvin Mwinuka 0b90c9343e Added DEL command for deleting keys from the store 2024-03-08 22:49:03 +08:00
Kelvin Clement Mwinuka 5c347cb7de Changed max-memory to uint64. Added TODO commends on how to handle memory checking for key eviction. 2024-03-05 22:45:05 +08:00
Kelvin Clement Mwinuka 28f97656c4 Removed etc and get modules and replaced them with generic module. Implemented functions to set and remove the expiry of a key. Implemented LRU and LFU caches using heap. 2024-03-03 16:21:12 +08:00
Kelvin Clement Mwinuka e569bf6837 Added config flags max-memory and eviction-policy to manage memory usage. Created ParseMemory utility function to parse max-memory value into bytes. Created LFU cache to be used with heap data structure for managing LFU cache. 2024-03-01 16:25:04 +08:00
Kelvin Clement Mwinuka 97b41da729 Moved aof and snapshot packages from server folder to src folder. Created new package for evictions 2024-02-29 16:06:52 +08:00
Kelvin Clement Mwinuka facdc089d8 Implemented command handler for COMMAND LIST command 2024-02-28 15:16:11 +08:00
Kelvin Clement Mwinuka 1a4747db6d Updated GPL badge to v3 and uncommented cluster nodes in docker-compose.yml 2024-02-28 13:35:02 +08:00
Kelvin Clement Mwinuka 160c701c3a MGET command now returns RESP nil value for non-existent keys 2024-02-27 16:07:13 +08:00
Kelvin Clement Mwinuka 088e4c25f0 Made GET, MGET, SET, MSET, SETNX commands compatible with redis client 2024-02-27 15:41:22 +08:00
Kelvin Clement Mwinuka fbb0b8dc8d Removed plugin-dir cli flag as its not used 2024-02-26 00:37:00 +08:00
Kelvin Clement Mwinuka 5e1e362b28 Updated flags from camelCase to kebab-case 2024-02-25 23:27:57 +08:00
Kelvin Clement Mwinuka 02351a3374 Re-enabled cluster instances in docker-compose 2024-02-25 22:00:07 +08:00
Kelvin Clement Mwinuka 8d7fe0225a Created AppendReadWriter and PreambleReadWriter interfaces for file handling in the log and preamble packages respectively.
Seek to the beginning of the preamble file after truncating.
2024-02-25 15:16:27 +08:00
Kelvin Clement Mwinuka b0375f2ef1 Renamed dev dockerfile to 'Dockerfile.dev' 2024-02-23 05:05:57 +08:00
Kelvin Clement Mwinuka c8a2700ab1 Remvoed CGO_ENABLED env var on go build command in makefile 2024-02-23 05:03:16 +08:00
Kelvin Clement Mwinuka 5bb5d5428b Updated docker-compose to include MTLS, CERT_KEY_PAIR and CLIENT_CA for cluster nodes. Uncommented cluster nodes 2024-02-11 16:35:50 +08:00
Kelvin Clement Mwinuka 69c9170f56 Implemented mTLS listener to verify client certificates. 2024-02-03 06:40:03 +08:00
Kelvin Clement Mwinuka 3cd9da245c Untrack docker-compose.yaml and Dockerfile 2023-09-10 02:17:39 +08:00
Kelvin Clement Mwinuka 01712892de Set default dataDir config. Set INMEMORY env var of docker containers to false. Added volumes folder to gitignore 2023-09-05 01:14:55 +08:00
Kelvin Clement Mwinuka 5fa6bc893c Re-enabled all the nodes in docker-compose 2023-08-12 05:56:33 +08:00
Kelvin Clement Mwinuka c101b18969 Created ApplyRequest and ApplyResponse types to handle calls and responses to raft.Apply.
In-Memory state between nodes is now synchronized.
2023-08-12 05:40:35 +08:00
Kelvin Clement Mwinuka bc4ce05753 User proper boolean value passing in Dockerfile CMD command.
Pass key, cert and set TLS env variable to true in docker-compose file to enable tls mode.
2023-08-12 00:53:08 +08:00
Kelvin Clement Mwinuka e8df5bb13c Updated Makefile to build for linux/amd64 2023-08-10 04:52:16 +08:00
Kelvin Clement Mwinuka de1f9681a2 Installed boltdb for logstore and stablestore 2023-08-08 23:26:14 +08:00
Kelvin Clement Mwinuka e1e89f46ca Implement raft and memberlist shutdown 2023-08-01 01:17:37 +08:00
Kelvin Clement Mwinuka d82a6a98d7 Use UDP dial to find default address for outbound traffic.
Set default bindAddr if it has not been explicitly provided be the user.
2023-07-29 01:33:33 +08:00
Kelvin Clement Mwinuka 52eaa6b735 Added 2 nodes in docker-compose for cluster testing 2023-07-23 02:56:54 +08:00
Kelvin Clement Mwinuka dc5ff9855d Pass server args in docker-compose 2023-07-22 06:30:14 +08:00
Kelvin Clement Mwinuka d4a5997b30 Scrapped plugin design in favour of simple command interfaces.
Setup docker build process for running server.
Deleted test files.
2023-07-22 05:34:07 +08:00