Commit Graph

35 Commits

Author SHA1 Message Date
Kelvin Mwinuka
54d0ae700a Removed Opts from echovault. NewEchoVault now entirely uses the option pattern 2024-03-25 17:22:18 +08:00
Kelvin Mwinuka
ba2ebaa6da Renamed 'server' package to 'echovault' 2024-03-25 16:26:09 +08:00
Kelvin Mwinuka
93cfb9caeb Renames Server struct and utils.Server interface to EchoVault and utils.EchoVault respectively 2024-03-25 16:23:16 +08:00
Kelvin Mwinuka
4bc1f44e1d Added Apache 2.0 license header to all go files in src folder 2024-03-24 18:30:17 +08:00
Kelvin Mwinuka
e685d5041b Updated test suites to set mock server only once in each suite instead of instantiating it in every test. 2024-03-15 03:44:42 +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
82be1f6068 Added addedTime to EntryLFU object to control which entry will be removed if access count is the same. If two entries have the same access count, the older entry should be removed first.
SetKeyExpiry and GetValue keyspace receiver functions now require context object to be passed.
Created adjustMemoryUsage function for key eviction for LFU, LRU, and Random eviction policies.
Updated all modules to pass context to SetKeyExpirty and GetValue functions.
2024-03-08 00:26:49 +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
9a4f58a3f0 Implemented test case for ZRANGESTORE command handler 2024-02-22 08:26:21 +08:00
Kelvin Clement Mwinuka
b26743bd28 Added numbering to last test case in ZRANGE test table 2024-02-22 07:32:04 +08:00
Kelvin Clement Mwinuka
045691ae94 Created unit test case for ZRANGE command handler 2024-02-22 07:30:42 +08:00
Kelvin Clement Mwinuka
3e9f921cff Made unit test for ZREMRANGEBYRANK command handler 2024-02-22 05:59:46 +08:00
Kelvin Clement Mwinuka
4792516d6d Added unit test for ZREMRANGEBYLEX command handler 2024-02-22 05:40:57 +08:00
Kelvin Clement Mwinuka
3c85f986b7 Implemented unit test for ZREMRANGEBYSCORE command handler 2024-02-22 05:23:58 +08:00
Kelvin Clement Mwinuka
ba61e103ee Implemented unit test for ZREM command handler 2024-02-22 04:53:25 +08:00
Kelvin Clement Mwinuka
464f8cd1b6 Implemented unit test for ZRANK command handler 2024-02-22 04:31:30 +08:00
Kelvin Clement Mwinuka
438988dbe2 Implemented unit test for ZRANDMEMBER command handler 2024-02-22 04:00:41 +08:00
Kelvin Clement Mwinuka
11a68c9a2f Implemented unit test for ZSCORE command handler 2024-02-22 03:24:18 +08:00
Kelvin Clement Mwinuka
f29202534d Implemented test for ZMSCORE command handler 2024-02-22 03:12:59 +08:00
Kelvin Clement Mwinuka
1350b3a5c1 Added test case for ZPOPMIN and ZPOPMAX command handlers 2024-02-22 02:27:23 +08:00
Kelvin Clement Mwinuka
b7d56934c4 Added Equals receiver funcion on SortedSet to compare deep equality of two sorted sets. Created unit test for ZMPOP command handler 2024-02-22 00:54:28 +08:00
Kelvin Clement Mwinuka
3de114ca00 Implemented test case for ZINCRYBY command handler 2024-02-21 22:52:04 +08:00
Kelvin Clement Mwinuka
3097826e77 Implemented unit tes for ZUNIONSTORE command handler 2024-02-21 03:25:35 +08:00
Kelvin Clement Mwinuka
ed735b9dbd Implemented divide & conquer function for calculating the union of multiple sets. Implemented unit test for ZUNION command handler 2024-02-21 01:04:34 +08:00
Kelvin Clement Mwinuka
0e657baa2e ZINTERSTORE command handler now uses new Intersect divide & conquer function instead of the old Intersect receiver function.
Intersect receiver function on SortedSet reference has been deleted as it's no longer in use.
Added test for ZINTERSTORE command handler.
2024-02-20 23:25:22 +08:00
Kelvin Clement Mwinuka
a3bb3e9b34 Created divide & conquer Intersect function to calculate the intersection between 2 sorted sets.
Used new Intersect function to calculate intersection in ZINTER command handler.
Implemented unit test for ZINTER command handler.
2024-02-20 22:14:03 +08:00
Kelvin Clement Mwinuka
bb5ea92990 Added unit test for ZDIFFSTORE command handler 2024-02-20 05:50:21 +08:00
Kelvin Clement Mwinuka
59b9e5da45 Implemented test for ZDIFF command handler 2024-02-20 05:10:58 +08:00
Kelvin Clement Mwinuka
00c0fb5442 Implemented test for ZLEXCOUNT command handler 2024-02-20 03:39:13 +08:00
Kelvin Clement Mwinuka
6bb3c83758 Implemented test for ZCOUNT command handler 2024-02-20 03:17:53 +08:00
Kelvin Clement Mwinuka
5b6946d8f2 Added infinity scores to ZADD command test 2024-02-20 02:59:47 +08:00
Kelvin Clement Mwinuka
4e2d34b05d Implemented unit test for ZCARD command handler 2024-02-20 02:57:26 +08:00
Kelvin Clement Mwinuka
f5015a8cc6 Implemented test case for ZADD command handler. Added error returns for incompatible flags in ZADD commands 2024-02-20 01:33:46 +08:00
Kelvin Clement Mwinuka
a84d1b4d31 Created test skeleton for sorted set test suite 2024-02-18 22:56:10 +08:00
Kelvin Clement Mwinuka
51e88c3559 Created test file for sorted_set commands 2024-02-17 01:54:12 +08:00