Logo
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::Messagefile_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::FileLeader ( network::ClientHandler net)

◆ ~FileLeader()

FileLeader::~FileLeader ( )

Member Function Documentation

◆ file_delete()

bool FileLeader::file_delete ( messages::FileDel f)

◆ file_exist()

bool FileLeader::file_exist ( std::string  file_name)

◆ file_insert()

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

◆ file_insert_confirm()

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

Confirm that all the blocks has been uploaded.

◆ file_request()

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

Return a description of the blocks containing the file.

Cancel if file is being uploading

◆ file_update()

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

Update the file with the new size and blocks.

◆ find_best_arrangement()

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

◆ format()

bool FileLeader::format ( )

Remove everything and create tables.

◆ list()

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

Fill the param with the list of files.

◆ metadata_save()

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

◆ replicate_metadata()

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

◆ boundaries

std::unique_ptr<Histogram> eclipse::FileLeader::boundaries
protected

◆ current_file_arrangements

std::map<std::string, std::shared_ptr<messages::FileDescription> > eclipse::FileLeader::current_file_arrangements
protected

◆ directory

Directory eclipse::FileLeader::directory
protected

◆ local_io

Local_io eclipse::FileLeader::local_io
protected

◆ network_size

int eclipse::FileLeader::network_size
protected

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