Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
eclipse::FileLeader Class Reference

#include <file_leader.hh>

Inheritance diagram for eclipse::FileLeader:
Inheritance graph
Collaboration diagram for eclipse::FileLeader:
Collaboration graph

Public Member Functions

 FileLeader (network::ClientHandler *)
 
 ~FileLeader ()
 
unique_ptr< messages::Messagefile_insert (messages::FileInfo *)
 Insert file metadata and compute block metadata. More...
 
bool file_insert_confirm (messages::FileInfo *)
 Confirm that all the blocks has been uploaded. More...
 
std::shared_ptr
< messages::Message
file_request (messages::FileRequest *)
 Return a description of the blocks containing the file. More...
 
bool file_delete (messages::FileDel *)
 
bool list (messages::FileList *)
 Fill the param with the list of files. More...
 
bool file_exist (std::string)
 
bool file_update (messages::FileUpdate *)
 Update the file with the new size and blocks. More...
 
void metadata_save (messages::MetaData *)
 
bool format ()
 Remove everything and create tables. More...
 
- Public Member Functions inherited from eclipse::Node
 Node ()
 
 ~Node ()
 
std::string get_ip () const override
 
- Public Member Functions inherited from eclipse::Machine
 Machine ()=default
 
 Machine (int)
 
virtual ~Machine ()
 
int get_id () const
 

Protected Member Functions

void replicate_metadata ()
 This function replicates to its right and left neighbor node the metadata db. More...
 
void find_best_arrangement (messages::FileDescription *file_desc)
 

Protected Attributes

Directory directory
 
Local_io local_io
 
std::unique_ptr< Histogramboundaries
 
std::map< std::string,
std::shared_ptr
< messages::FileDescription > > 
current_file_arrangements
 
int network_size
 
- Protected Attributes inherited from eclipse::Node
network::ClientHandlernetwork
 
Loggerlogger
 
std::string ip_of_this
 
int port
 
- Protected Attributes inherited from eclipse::Machine
int id
 

Constructor & Destructor Documentation

FileLeader::FileLeader ( network::ClientHandler net)
FileLeader::~FileLeader ( )

Member Function Documentation

bool FileLeader::file_delete ( messages::FileDel f)
bool FileLeader::file_exist ( std::string  file_name)
unique_ptr< Message > FileLeader::file_insert ( messages::FileInfo f)

Insert file metadata and compute block metadata.

Attention
The block metadata is a proposal, the client might endup with more blocks.
Todo:

fix block shortage in client

strategy pattern for scheduling the blocks

bool FileLeader::file_insert_confirm ( messages::FileInfo f)

Confirm that all the blocks has been uploaded.

shared_ptr< Message > FileLeader::file_request ( messages::FileRequest m)

Return a description of the blocks containing the file.

Cancel if file is being uploading

bool FileLeader::file_update ( messages::FileUpdate f)

Update the file with the new size and blocks.

void FileLeader::find_best_arrangement ( messages::FileDescription file_desc)
protected
bool FileLeader::format ( )

Remove everything and create tables.

bool FileLeader::list ( messages::FileList m)

Fill the param with the list of files.

void FileLeader::metadata_save ( messages::MetaData m)
void FileLeader::replicate_metadata ( )
protected

This function replicates to its right and left neighbor node the metadata db.

This function is intended to be invoked whenever the metadata db is modified.

Member Data Documentation

std::unique_ptr<Histogram> eclipse::FileLeader::boundaries
protected
std::map<std::string, std::shared_ptr<messages::FileDescription> > eclipse::FileLeader::current_file_arrangements
protected
Directory eclipse::FileLeader::directory
protected
Local_io eclipse::FileLeader::local_io
protected
int eclipse::FileLeader::network_size
protected

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