Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
WsFsDaemon Class Reference

Main class of the FsDaemon. More...

#include <WsFsDaemon.h>

Collaboration diagram for WsFsDaemon:
Collaboration graph

Public Types

enum  DaemonStatus { Success, Failure, NotLogged, NoAccess }
 

Public Member Functions

 WsFsDaemon (WsGlobalProperties *props)
 constructor for the server More...
 
 ~WsFsDaemon ()
 destructor More...
 
DaemonStatus bind (unsigned int numWorkers=1)
 start listening on the port More...
 
DaemonStatus workerRoutine ()
 

Private Member Functions

DaemonStatus send (zmq::socket_t &sock, const std::string &s)
 Sends data on the socket. More...
 
DaemonStatus receive (zmq::socket_t &sock, std::string &receivedData)
 read data from the socket More...
 
DaemonStatus parse (const std::string &s, Json::Value &root)
 Parses the received data (json) More...
 
DaemonStatus handleRequest (zmq::socket_t &sock, Json::Value &root)
 Handle received request and redirect to correct method. More...
 
DaemonStatus handleAuthRequest (zmq::socket_t &sock, Json::Value &root)
 Authenticate user on server Loads the groups which the user belongs to, uid, email, etc.. More...
 
DaemonStatus handleGetLockRequest (zmq::socket_t &sock, Json::Value &root)
 Acquires the lock for the path. More...
 
DaemonStatus handlePutLockRequest (zmq::socket_t &sock, Json::Value &root)
 releases the lock for the path More...
 
DaemonStatus handleIsLockedRequest (zmq::socket_t &sock, Json::Value &root)
 checks the lock for the path More...
 
DaemonStatus handleAccessTreeRequest (zmq::socket_t &sock, Json::Value &root)
 Sends the accesstree to the client. More...
 
DaemonStatus handlePermRequest (zmq::socket_t &sock, Json::Value &root)
 sends the permissions of a path to the client More...
 
DaemonStatus handlePropRequest (zmq::socket_t &sock, Json::Value &root)
 sends a property of a node to the client More...
 
DaemonStatus handleAllGroupsRequest (zmq::socket_t &sock, Json::Value &root)
 sends all the groups available to the client More...
 
DaemonStatus handlePropsRequest (zmq::socket_t &sock, Json::Value &root)
 sends all the properties of a node More...
 
DaemonStatus handleSearchRequest (zmq::socket_t &sock, Json::Value &root)
 sends the result of a search request to the client. Only nodes where the user has access are returned More...
 
DaemonStatus handleClearCache (zmq::socket_t &sock, Json::Value &root)
 clears the user from the cache More...
 
DaemonStatus handleIsAdminRequest (zmq::socket_t &sock, Json::Value &root)
 sends the result of an admin request so that the client can know if he is an admin or not More...
 
DaemonStatus handleIsEditorRequest (zmq::socket_t &sock, Json::Value &root)
 sends the result of an editor request so that the client can know if he is an editor or not More...
 
DaemonStatus handleSavePropertiesRequest (zmq::socket_t &sock, Json::Value &root)
 saves the properties received by the client for a node More...
 
DaemonStatus handleSavePropertyRequest (zmq::socket_t &sock, Json::Value &root)
 saves one property received by a client for a node More...
 
DaemonStatus handleCreateNodeRequest (zmq::socket_t &sock, Json::Value &root)
 create a node requested by the client More...
 
DaemonStatus handleRenameNodeRequest (zmq::socket_t &sock, Json::Value &root)
 rename a node More...
 
DaemonStatus handleDeleteNodeRequest (zmq::socket_t &sock, Json::Value &root)
 delete a node requested by the client More...
 
DaemonStatus handleRootPathRequest (zmq::socket_t &sock, Json::Value &root)
 send the rootPath to the client More...
 
DaemonStatus handleGetTreeVersion (zmq::socket_t &sock, Json::Value &root)
 sends the last tree version to the client More...
 
string rawDataToString (zmq::message_t &msg)
 converts raw data received on the socket to string More...
 
bool isActiveSession (const std::string &uid, const std::string &pass, const std::string &ip)
 returns true or false whether the section of a user is still active or not More...
 

Private Attributes

WsGlobalPropertiesm_conf
 
bool m_listening
 
WsFsTreeOperationsm_operation
 
map< string, WsUserSession * > m_userMap
 
set< string > m_allGroups
 
bool m_compress
 
WsCompressorm_compressor
 
WsDecompressorm_decompressor
 
zmq::context_t * m_context
 

Detailed Description

Main class of the FsDaemon.

Caches locally the FileSystemTree and wait for request and replies

Definition at line 44 of file WsFsDaemon.h.

Member Enumeration Documentation

Enumerator
Success 
Failure 
NotLogged 
NoAccess 

Definition at line 47 of file WsFsDaemon.h.

Constructor & Destructor Documentation

WsFsDaemon::WsFsDaemon ( WsGlobalProperties props)

constructor for the server

Parameters
propsan instance of WsGlobalProperties

Definition at line 28 of file WsFsDaemon.cpp.

Here is the call graph for this function:

WsFsDaemon::~WsFsDaemon ( )

destructor

Definition at line 40 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Member Function Documentation

WsFsDaemon::WsFsDaemon::DaemonStatus WsFsDaemon::bind ( unsigned int  numWorkers = 1)

start listening on the port

Returns
DaemonStatus

Definition at line 83 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleAccessTreeRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

Sends the accesstree to the client.

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 316 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleAllGroupsRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends all the groups available to the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 347 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleAuthRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

Authenticate user on server Loads the groups which the user belongs to, uid, email, etc..

See Also
WsAbstractAuth

Definition at line 274 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleClearCache ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

clears the user from the cache

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 412 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleCreateNodeRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

create a node requested by the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 478 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleDeleteNodeRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

delete a node requested by the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 492 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleGetLockRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

Acquires the lock for the path.

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 519 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleGetTreeVersion ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends the last tree version to the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 566 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleIsAdminRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends the result of an admin request so that the client can know if he is an admin or not

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 435 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleIsEditorRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends the result of an editor request so that the client can know if he is an editor or not

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 422 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleIsLockedRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

checks the lock for the path

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 543 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handlePermRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends the permissions of a path to the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 333 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handlePropRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends a property of a node to the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 374 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handlePropsRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends all the properties of a node

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 358 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handlePutLockRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

releases the lock for the path

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 531 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleRenameNodeRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

rename a node

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 505 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

Handle received request and redirect to correct method.

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 189 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleRootPathRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

send the rootPath to the client

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 557 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleSavePropertiesRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

saves the properties received by the client for a node

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 448 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleSavePropertyRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

saves one property received by a client for a node

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 461 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::handleSearchRequest ( zmq::socket_t &  sock,
Json::Value &  root 
)
private

sends the result of a search request to the client. Only nodes where the user has access are returned

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 389 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool WsFsDaemon::isActiveSession ( const std::string &  uid,
const std::string &  pass,
const std::string &  ip 
)
private

returns true or false whether the section of a user is still active or not

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 583 of file WsFsDaemon.cpp.

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::parse ( const std::string &  s,
Json::Value &  root 
)
private

Parses the received data (json)

Parameters
sthe string to parse (Json)
Returns
DaemonStatus

Definition at line 177 of file WsFsDaemon.cpp.

Here is the caller graph for this function:

string WsFsDaemon::rawDataToString ( zmq::message_t &  msg)
private

converts raw data received on the socket to string

Parameters
sockthe zmq::socket_t
Returns
DaemonStatus

Definition at line 574 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::receive ( zmq::socket_t &  sock,
std::string &  receivedData 
)
private

read data from the socket

Parameters
sockthe zmq::socket_t
receivedDatathe string where the data read will be stored
Returns
DaemonStatus

Definition at line 160 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::DaemonStatus WsFsDaemon::send ( zmq::socket_t &  sock,
const std::string &  s 
)
private

Sends data on the socket.

Parameters
socka zmq::socket_t
sthe string to send
Returns
DaemonStatus

Definition at line 120 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

WsFsDaemon::WsFsDaemon::DaemonStatus WsFsDaemon::workerRoutine ( )

Definition at line 48 of file WsFsDaemon.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

set<string> WsFsDaemon::m_allGroups
private

All groups available

Definition at line 281 of file WsFsDaemon.h.

bool WsFsDaemon::m_compress
private

Copress data or no ?

Definition at line 286 of file WsFsDaemon.h.

WsCompressor* WsFsDaemon::m_compressor
private

Object used for compression

Definition at line 291 of file WsFsDaemon.h.

WsGlobalProperties* WsFsDaemon::m_conf
private

GlobalProperties

Definition at line 261 of file WsFsDaemon.h.

zmq::context_t* WsFsDaemon::m_context
private

Definition at line 298 of file WsFsDaemon.h.

WsDecompressor* WsFsDaemon::m_decompressor
private

Object used for decompressions

Definition at line 296 of file WsFsDaemon.h.

bool WsFsDaemon::m_listening
private

listening on socket ?

Definition at line 266 of file WsFsDaemon.h.

WsFsTreeOperations* WsFsDaemon::m_operation
private

Contains the interface to all possible operations on tree

Definition at line 271 of file WsFsDaemon.h.

map<string, WsUserSession* > WsFsDaemon::m_userMap
private

User's session map

Definition at line 276 of file WsFsDaemon.h.


The documentation for this class was generated from the following files: