Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

mdfs::MDistributedFS Class Reference

Virtual base class for a simple distributed file system. More...

#include <MDistributedFileSystem.h>

Inheritance diagram for mdfs::MDistributedFS:

mdfs::MFileDFS List of all members.

Public Member Functions

 MDistributedFS ()
virtual ~MDistributedFS ()
void Init (const std::string &initfilepath)
 Init the dfs given a xml init file path.

void Start ()
 Thread control.

void Stop ()
MServerAddServer (const std::string &host, int port)
 Before a msg can be sent, the server has to be in the server list.

void SendMsg (const std::string &host, std::string &msg)
 Given a server host and a msg in xml, send it to the server. This is the main function to send messages.

void BroadcastMsg (const std::string &msg)
 Send msg to all servers.

void GetStats (MStats &s)
MUpdateListLockUpdates ()
 Request file updates.

void UnlockUpdates ()
void operator() ()
 Run thread loop. Must be public, but do not call, use Start().

void Download (const std::string &url)
void AddUpdate (MUpdate &u)

Public Attributes

MDFSDBDB
 Remote file DB.

MOptions Options
MPNL::MTransferManagerTransferManager

Protected Member Functions

void Listen (TiXmlElement *cur)
void NewServer (TiXmlElement *cur)
void ParseNetMsg (MDFSPeerBase *c, std::string &rv)
 Parse a network msg and gives a response.

void Init (TiXmlElement *cur)
void NewShare (TiXmlElement *cur)
void ParseNetMsg (MDFSPeerBase *c, TiXmlElement *cur, std::string &rv)
void ParseQuery (MDFSPeerBase *c, TiXmlElement *cur, std::string &rv)
void ParseDLQuery (MDFSPeerBase *c, TiXmlElement *cur, std::string &rv)
void ParseDLResponse (MDFSPeerBase *c, TiXmlElement *cur, std::string &rv)
void ParseUpdate (TiXmlElement *cur, std::string &rv)
void ParseFile (MFileType ft, TiXmlElement *cur, std::string &rv)
virtual void BuildFileQueryResponse (MDFSPeerBase *c, const MQuery &q, std::string &rv)=0
 Builds a response (a xml string) that will be sent to the client.

virtual bool Login (const std::string &login, const std::string &pwd, MUser &rv)=0
void AddErrors (std::string &rv)

Protected Attributes

std::string Base
 URL base. if Base == mdfs://host/ then every path/ will be rewritten as mdfs//host/path/.

std::string DownloadPath
 Where downloads go.

MStringList Errors
MServerList Servers
 Known servers and related TCPClients.

MShareList Shares
 Local shares.

MDFSTCPServerTCPServer
 Main server.

std::string ServerName
MStringList ServerHosts
MStats Stats
MUpdateList Updates
boost::thread * RunThread
MDownloadList Downloads

Detailed Description

Virtual base class for a simple distributed file system.

This MDFS class is virtual, you have to implemented some method in a derivated class. mdfs::MFileDFS implements them.

MDFS is based on a client/server architecture. Each MDFS can be a server (See mdfs::MDistributedFS::TCPServer) and can have several clients connected to servers running at the same time (See mdfs::MDistributedFS::Servers and mdfs::MServer)


Constructor & Destructor Documentation

MDistributedFS::MDistributedFS  ) 
 

MDistributedFS::~MDistributedFS  )  [virtual]
 


Member Function Documentation

void MDistributedFS::AddErrors std::string &  rv  )  [protected]
 

MServer * MDistributedFS::AddServer const std::string &  host,
int  port
 

Before a msg can be sent, the server has to be in the server list.

void MDistributedFS::AddUpdate MUpdate u  ) 
 

void MDistributedFS::BroadcastMsg const std::string &  msg  ) 
 

Send msg to all servers.

virtual void mdfs::MDistributedFS::BuildFileQueryResponse MDFSPeerBase c,
const MQuery q,
std::string &  rv
[protected, pure virtual]
 

Builds a response (a xml string) that will be sent to the client.

Parameters:
path is the path of the file (can be a dir, see MFileType)
fileype is a sum of MFileType
rcount can be -1 for infinite recursion, 0 for just the file info, 1 for the dir and its content, etc... if != 0 then apply only to dfDIR type of files
rv is the response

Implemented in mdfs::MFileDFS.

void MDistributedFS::Download const std::string &  url  ) 
 

void MDistributedFS::GetStats MStats s  ) 
 

void MDistributedFS::Init TiXmlElement *  cur  )  [protected]
 

void MDistributedFS::Init const std::string &  initfilepath  ) 
 

Init the dfs given a xml init file path.

void MDistributedFS::Listen TiXmlElement *  cur  )  [protected]
 

MUpdateList* mdfs::MDistributedFS::LockUpdates  )  [inline]
 

Request file updates.

virtual bool mdfs::MDistributedFS::Login const std::string &  login,
const std::string &  pwd,
MUser rv
[protected, pure virtual]
 

Implemented in mdfs::MFileDFS.

void MDistributedFS::NewServer TiXmlElement *  cur  )  [protected]
 

void MDistributedFS::NewShare TiXmlElement *  cur  )  [protected]
 

void MDistributedFS::operator()  ) 
 

Run thread loop. Must be public, but do not call, use Start().

void MDistributedFS::ParseDLQuery MDFSPeerBase c,
TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDistributedFS::ParseDLResponse MDFSPeerBase c,
TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDistributedFS::ParseFile MFileType  ft,
TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDistributedFS::ParseNetMsg MDFSPeerBase c,
TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDistributedFS::ParseNetMsg MDFSPeerBase c,
std::string &  rv
[protected]
 

Parse a network msg and gives a response.

void MDistributedFS::ParseQuery MDFSPeerBase c,
TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDistributedFS::ParseUpdate TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDistributedFS::SendMsg const std::string &  host,
std::string &  msg
 

Given a server host and a msg in xml, send it to the server. This is the main function to send messages.

void MDistributedFS::Start  ) 
 

Thread control.

void MDistributedFS::Stop  ) 
 

void mdfs::MDistributedFS::UnlockUpdates  )  [inline]
 


Member Data Documentation

std::string mdfs::MDistributedFS::Base [protected]
 

URL base. if Base == mdfs://host/ then every path/ will be rewritten as mdfs//host/path/.

MDFSDB* mdfs::MDistributedFS::DB
 

Remote file DB.

std::string mdfs::MDistributedFS::DownloadPath [protected]
 

Where downloads go.

MDownloadList mdfs::MDistributedFS::Downloads [protected]
 

MStringList mdfs::MDistributedFS::Errors [protected]
 

MOptions mdfs::MDistributedFS::Options
 

boost::thread* mdfs::MDistributedFS::RunThread [protected]
 

MStringList mdfs::MDistributedFS::ServerHosts [protected]
 

std::string mdfs::MDistributedFS::ServerName [protected]
 

MServerList mdfs::MDistributedFS::Servers [protected]
 

Known servers and related TCPClients.

MShareList mdfs::MDistributedFS::Shares [protected]
 

Local shares.

MStats mdfs::MDistributedFS::Stats [protected]
 

MDFSTCPServer* mdfs::MDistributedFS::TCPServer [protected]
 

Main server.

MPNL::MTransferManager* mdfs::MDistributedFS::TransferManager
 

MUpdateList mdfs::MDistributedFS::Updates [protected]
 


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


MDFS SourceForge project page and download

SourceForge.net Logo

Generated on Sat Jan 3 03:14:20 2004 for MDFS by doxygen1.3.5