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

mdfs::MDFS Class Reference

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

#include <MDistributedFileSystem.h>

Inheritance diagram for mdfs::MDFS:

MThread mdfs::MFileDFS List of all members.

Public Member Functions

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

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

int SendMsg (const std::string &host, const 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 SendConnections (const std::string &ip)
 Send active connections to peer.

bool IsConnected (const std::string &ip)
 Goes through all the servers and clients to see if the ip is there.

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 (MDFSUpdate *u)
void AddConnection (MConnection &c)
 Add and connect.

void RemoveConnection (const std::string &ip)
 Remove but do not disconnect.

void SaveConnections ()

Public Attributes

MDFSDBDB
 Remote file DB.

MShareList Shares
 Local shares.

MOptions Options
MPNL::MTransferManagerTransferManager
unsigned char ClearStamp

Protected Types

typedef std::vector< MConnectionMConnectionList

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 CancelDL (MDFSPeerBase *c, TiXmlElement *cur, std::string &rv)
void ParseUpdate (TiXmlElement *cur, std::string &rv)
void ParseFile (MFileType ft, TiXmlElement *cur, std::string &rv)
void SendInfos (const std::string &ip, const std::string &localip)
void NewInfo (MDFSPeerBase *c, TiXmlElement *cur)
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)
void DeleteDownload (const std::string &url)

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.

MDFSTCPServerTCPServer
 Main server.

std::string Name
MStringList ServerHosts
MStats Stats
MUpdateList Updates
MDownloadList Downloads
MUpdateScannerUpdateScanner
MConnectionList Connections

Detailed Description

Virtual base class for a simple distributed file system.

This 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::MDFS::TCPServer) and can have several clients connected to servers running at the same time (See mdfs::MDFS::Servers and mdfs::MServer)


Member Typedef Documentation

typedef std::vector<MConnection> mdfs::MDFS::MConnectionList [protected]
 


Constructor & Destructor Documentation

MDFS::MDFS  ) 
 

MDFS::~MDFS  )  [virtual]
 


Member Function Documentation

void MDFS::AddConnection MConnection c  ) 
 

Add and connect.

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

MServer * MDFS::AddServer const std::string &  host,
int  port = 5050
 

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

void MDFS::AddUpdate MDFSUpdate u  ) 
 

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

Send msg to all servers.

virtual void mdfs::MDFS::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 MDFS::CancelDL MDFSPeerBase c,
TiXmlElement *  cur,
std::string &  rv
[protected]
 

void MDFS::DeleteDownload const std::string &  url  )  [protected]
 

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

void MDFS::GetStats MStats s  ) 
 

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

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

Init the dfs given a xml init file path.

bool MDFS::IsConnected const std::string &  ip  ) 
 

Goes through all the servers and clients to see if the ip is there.

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

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

Request file updates.

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

Implemented in mdfs::MFileDFS.

void MDFS::NewInfo MDFSPeerBase c,
TiXmlElement *  cur
[protected]
 

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

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

void MDFS::operator()  )  [virtual]
 

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

Implements MThread.

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

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

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

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

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

Parse a network msg and gives a response.

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

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

void MDFS::RemoveConnection const std::string &  ip  ) 
 

Remove but do not disconnect.

void MDFS::SaveConnections  ) 
 

void MDFS::SendConnections const std::string &  ip  ) 
 

Send active connections to peer.

void MDFS::SendInfos const std::string &  ip,
const std::string &  localip
[protected]
 

int MDFS::SendMsg const std::string &  host,
const 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 mdfs::MDFS::UnlockUpdates  )  [inline]
 


Member Data Documentation

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

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

unsigned char mdfs::MDFS::ClearStamp
 

MConnectionList mdfs::MDFS::Connections [protected]
 

MDFSDB* mdfs::MDFS::DB
 

Remote file DB.

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

Where downloads go.

MDownloadList mdfs::MDFS::Downloads [protected]
 

MStringList mdfs::MDFS::Errors [protected]
 

std::string mdfs::MDFS::Name [protected]
 

MOptions mdfs::MDFS::Options
 

MStringList mdfs::MDFS::ServerHosts [protected]
 

MServerList mdfs::MDFS::Servers [protected]
 

Known servers and related TCPClients.

MShareList mdfs::MDFS::Shares
 

Local shares.

MStats mdfs::MDFS::Stats [protected]
 

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

Main server.

MPNL::MTransferManager* mdfs::MDFS::TransferManager
 

MUpdateList mdfs::MDFS::Updates [protected]
 

MUpdateScanner* mdfs::MDFS::UpdateScanner [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