Implement functionality to read an RDB (Redis Data Persistence) file at the start of the program. The file will be provided via --dir and --dbfilename options. If the specified RDB file does not exist, the program should treat the database as empty.
Requirements:
- On program start, check if the RDB file specified by
--dir and --dbfilename exists:
- If the file exists, read and load the database from it.
- If the file does not exist, initialize the database as empty.
- Implement support for reading numbers stored in the RDB file using both little-endian and big-endian formats, as per the RDB specification.
- Integrate the reading functionality with the
SAVE command to ensure that a valid RDB file is generated and can be read back correctly.
Acceptance Criteria:
Additional Notes:
- Refer to the MDN article on endianness to understand how to handle little-endian and big-endian formats.
- Ensure the implementation is robust, handling edge cases such as corrupted or partially written RDB files.
Implement functionality to read an RDB (Redis Data Persistence) file at the start of the program. The file will be provided via
--dirand--dbfilenameoptions. If the specified RDB file does not exist, the program should treat the database as empty.Requirements:
--dirand--dbfilenameexists:SAVEcommand to ensure that a valid RDB file is generated and can be read back correctly.Acceptance Criteria:
SAVEcommand is valid and can be successfully read on subsequent startups.Additional Notes: