Build a distributed data storage system

Assignment Help Python Programming
Reference no: EM133360614

Distributed and Cloud Computing

Learning Outcome 1: Demonstrate and apply knowledge about the state-of-the-art in distributed-systems architectures.

Learning Outcome 2: Appreciate the difference between various distributed computing middleware and their communication mechanisms.

Assignment
You have been hired by a library to build a distributed data storage system using a remote object paradigm that will allow one to store and access information relating to copies of books, authors of books and users who loan copies of books.

Each author has the following two associated pieces of information which should be stored in the system:

Author name.
Author genre which refers to the type of books written by the author (e.g. crime, fiction).
Each book copy has the following two associated pieces of information which should be stored in the system:

Book author.
Book title.
Note, multiple copies of a single book can exist in the system. You can assume that each book has a unique title.

Each user has the following two associated pieces of information which should be stored in the system:

User name.
User contact phone number.
Design and implement the above distributed data storage system using a remote object paradigm which allows library employees to perform the following twelve tasks:

Task 1

Add a user to the system. Implement this using a method with the following header:

def add_user(self, user_name, user_number)

An example of calling this method is:

rental_object.add_user("Allen Hatcher", 123456)

You can assume that each user added to the system has a unique user name.

Task 2

Return all associated pieces of information relating to the set of users currently stored in the system (i.e. a set of user names and contact numbers). Implement this using a method with the following header:

def return_users(self)

An example of calling this method is:

rental_object.return_users()

The information returned by this method should have the property that it can be easily interpreted when displayed using the Python print function. That is, the output from the following print function should be easily interpreted and understood by a human reader:

print(rental_object.return_users())

Task 3

Add an author to the system. Implement this using a method with the following header:

def add_author(self, author_name, author_genre):

An example of calling this method is:

library_object.add_author("James Joyce", "fiction")

You can assume that all author names are unique.

Task 4

Return all associated pieces of information relating to the set of authors currently stored in the system (i.e. a set of author names plus genres). Implement this using a method with the following header:

def return_authors(self)

An example of calling this method is:

library_object.return_authors()

The information returned by this method should have the property that it can be easily interpreted when displayed using the Python print function.

Task 5

Add a copy of a book to the system. Implement this using a method with the following header:

def add_book_copy(self, author_name, book_title)

An example of calling this method is:

library_object.add_book_copy("James Joyce", "Ulysses")

When a book copy is first added to the system it is initially not loaned to any user. Multiple copies of a single book (books with the same author and title) may be added to the system.

You can assume that all book titles are unique.

Task 6

Return all associated pieces of information relating to the set of book copies currently not on loan (i.e. a set of book authors plus titles). Implement this using a method with the following header:

def return_books_not_loan(self)

An example of calling this method is:

library_object.return_books_not_loan()

Note, multiple copies of a single book can exist in the system.

The information returned by this method should have the property that it can be easily interpreted when displayed using the Python print function.

Task 7

Loan a copy of a specified book to a specified user on a specified date. Implement this using a method with the following header:

def loan_book(self, user_name, book_title, year, month, day)

An example of calling this method is:

library_object.loan_book("Conor Reilly", "Ulysses", 2019, 1, 3)

Each copy of a book can only be loaned to a single user at a time. For example, consider the case where there are two copies of a given book and both are currently on loan. In this case the book in question cannot be loaned until one of the copies is returned or an additional copy is added to the system.

The method loan_book should return a value of 1 if the book in question was successfully loaned. Otherwise, the method should return a value of 0.

Task 8

Return all associated pieces of information relating to the set of book copies currently on loan (i.e. a set of book authors plus titles). Implement this using a method with the following header:

def return_books_loan(self)

An example of calling this method is:

library_object.return_books_loan()

The information returned by this method should have the property that it can be easily interpreted when displayed using the Python print function.

Task 9

Return to the library a loaned copy of a specified book by a specified user on a specified date; that is, set the status of the book in question from loaned to not loaned. Implement this using a method with the following header:

def end_book_loan(self, user_name, book_title, year, month, day)

An example of calling this method is:

library_object.end_book_loan("Conor Reilly", "Ulysses", 2019, 2, 4)

You can assume that a user will only loan one copy of a given book at any one time. Therefore, there will never exist any ambiguity regarding which book copy is being returned.

Task 10

Delete from the system all copies of a specified book which are currently not on loan. Copies which are currently on loan should not be deleted. Implement this using a method with the following header:

def delete_book(self, book_title)

An example of calling this method is:

library_object.delete_book("Ulysses")

Task 11

Delete from the system a specified user. A user should only be deleted if they currently are not loaning and have never loaned a book. Implement this using a method with the following header:

def delete_user(self, user_name)

An example of calling this method is:

library_object.delete_user("Conor Reilly")

The method delete_user should return a value of 1 if the user in question was deleted. Otherwise, the method should return a value of 0.

Task 12

Return all book titles a user previously has loaned where the corresponding loan and return dates both lie between a specified start and end date inclusive.

Implement this using a method with the following header:

def user_loans_date(self, user_name, start_year, start_month, start_day, end_year, end_month, end_day)

An example of calling this method is:

library_object.user_loans_date("Conor Reilly", 2010, 1, 1, 2029, 2, 1)

Note, the book titles returned may contain duplicates if the user loaned the book in question more than once.

The information returned by this method should have the property that it can be easily interpreted when displayed using the Python print function.

In your solution, the class in question should be called library. That is, when defining the class use the expression "class library(object):". Also, the class must be contained in a file entitled library.py.

In the file library.py you should create an object of type library and register this object with the name server using the name example.library. That is, the file library.py should contain the following code snippet:

daemon = Daemon()

serve({library: "example.library"}, daemon=daemon, use_ns=True)

Reference no: EM133360614

Questions Cloud

Paper on securing windows operating system : Paper on Securing windows operating system in a cloud environment APA formatting and citations
What is the relationship between adkar and digital : What is the relationship between ADKAR and Digital transformation?
Diversity-equity and access rises in marketing : Inclusion, Diversity, Equity, and Access (IDEA) Inclusion, Diversity, Equity, and Access (IDEA) rises in marketing.
What is performance per watt of the new processor concept : What is the performance per watt of the new processor concept relative to the current generation with and without the optimized compiler? (higher performance
Build a distributed data storage system : CMT202 Distributed and Cloud Computing, Cardiff School - Demonstrate and apply knowledge about the state-of-the-art in distributed-systems architectures
What was red lobster target consumer : What was Red Lobster's target consumer from its inception in 1968? What was Red Lobster's new positioning after Lopdrup took over in 2004?
How ups uses logistics and transportation management : Explain how UPS uses logistics and transportation management systems to manage its supply chain and delivery operations? How does UPS use of real-time tracking
Why do you consider white hat hacking essential : Express what your current perception or experience is in regards to the topic of hacking. Do you know what are black hat and white hat hacking?
Buyer decision-making process : Explain how you went through the buyer decision-making process for your recent purchase of a high-involvement product

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd