LMS is a mini project made as a part of the Software Engineering Lab Course.
The project assumes that the library is huge, with ample books, members, and administrators. The members can self-register to become authorized members of the library. They choose the books and approach the administrators to authorize the issue. In a large library, administrators might sometimes be unable to interact as fluently as they would face-to-face. Hence, mutual exclusion is required to prevent collisions in "transactions" (in a rough sense only). The administrators can add books, authorize issues, and revoke them, while members can view their issued books, due dates, and books available in the library at their convenience. For the current case, even admin can self-register, but an additional authorization can be put in place, as the case may be. Numerous queries for the admin can be explored. A few have been implemented here as described by the menu.
- It utilizes a concurrent server to handle multiple clients that connect to it.
- File locking is implemented using fcntl to ensure mutual exclusion and protect critical sections, thus ensuring concurrency control.
- User Authentication: Members are required to pass through a login system to access their accounts, ensuring data privacy and security.
- Dedicated unit testing constructs.
- ser_files, cli_files and test_files contain respective codes for the server, client and test functionalities.
- db_files contain binary files for data storage.
- Clone the repository. Make file contains all the make routes.
- Run the following command to make server and client executables:
make all
- After step 2, one can see 2 executable files: "client" and "server". Run the following command to start the server:
./server
- On different terminals (since for testing purposes the client and server will be on the same machine), run the following command to start the client (NOTE: member and admin are both clients. Server refers to more of query processing stop)
./client
- To remove the executables, run the following command:
make clean
We use CUNIT to help with our tetsing phase.
- Simply run
make test
This creates an executable test
that tests some functions common to both server and client.
- /test_db_files are created separate from the working db_files. A user and an admin is pre added to these files to facilitate tetsing. To test the server and client functionlaities in isolation, we need a mechanism to mock the send() and recv() functionalities.
- In the ser_files/adm.c and ser_files/mem.c, there is a macro at top TESTING_MODE that must be set to 1 in order for the send() and recv() functions to get mocked. Their behaviour is imitated by a pair of pipes facilitating exchange of messages between server and client(not an actual connection, but a simulation).
- In the makefile, see the rule for make 'test'. Uncommenting $(TARGET_TEST_SERVER) and $(TARGET_TEST_CLIENT) and then running
make test
will create corresponding test executables:test_server
andtest_client
.
- These executables test the fucntions of server and client respectively.
- For the sake of demonstration we test 2 functions that perform CRUD operations on the server's part. This can be extended easily to all fucntions.