__init__.py

This module provides standard interface for AMQP communication as it is defined and used by edeposit.amqp.

The interface consists of reactToAMQPMessage() function, which receives two parameters - structure and UUID. UUID is not much important, but structure is usually namedtuple containing information what should module do.

After the work is done, reactToAMQPMessage() returns a value, which is then automatically transfered back to caller. If the exception is raised, it is also transfered in open and easy to handle way.

edeposit.amqp.ftp

In this module, reactToAMQPMessage() is used only for receiving commands from the other side. Events caused by FTP users are handled by monitor.py.

Commands can create/change/remove users and so on. This is done by sending one of the following structures defined in structures.py:

Responses

AddUser, RemoveUser and ChangePassword requests at this moment returns just simple True. This may be changed later.

../_images/user_management.png

ListRegisteredUsers returns Userlist class.

../_images/list_registered_users.png

SetUserSettings and GetUserSettings both returns UserSettings structure.

../_images/set_get_settings.png

API

ftp.reactToAMQPMessage(message, send_back)[source]

React to given (AMQP) message. message is expected to be collections.namedtuple() structure from structures filled with all necessary data.

Parameters:
  • message (object) – One of the request objects defined in structures.
  • send_back (fn reference) – Reference to function for responding. This is useful for progress monitoring for example. Function takes one parameter, which may be response structure/namedtuple, or string or whatever would be normally returned.
Returns:

Response class from structures.

Return type:

object

Raises:

ValueError – if bad type of message structure is given.