A file-based key-value data store that supports the basic CRD (create, read, and delete) operations.
file-based key-value data store that supports the basic CRD (create, read, and delete) operations.
build a file-based key-value data store that supports the basic crd (create, read, and delete) operations. this data store is meant to be used as a local storage for one single process on one laptop. the data store must be exposed as a library to clients that can instantiate a class and work with the data store the data store will support the following functional requirements.
- it can be initialized using an optional file path. if one is not provided, it will reliably create itself in a reasonable location on the laptop.
- a new key-value pair can be added to the data store using the create operation. the key is always a string - capped at 32chars. the value is always a json obiect-apped at 16kb
- if create is invoked for an existing key, an appropriate crror must be returned
- a read operation on a key can be performed by providing the key, and receiving the value in response, as a json object.
- a delete operation can be performed by providing the key.
- every key supports setting a time-to-live property when it is created. this property is optional. if provided, it will be evaluated as an integer defining the number of seconds the key must be retained in the data store. once the time-to-live for a key has expired, the key will no longer be available for read or delete operations
- appropriate error responses must always be returned to a client if it uses the data store in unexpected ways or breaches any limits.
- the size of the file storing data must never exceed igb.
- more than one client process cannot be allowed to use the same file as a data store at any given time.
- a client process is allowed to access the data store using multiple threads, if it desires to. the data store must therefore be thread-safe.
- the client will bear as little memory costs as possible to use this data store, while deriving maximum performance with respect to response times for accessing the data store