P2P File Share
A simple peer-to-peer file sharing system.
Loading...
Searching...
No Matches
FilesDB Class Reference

A thread-safe database of partfiles. More...

#include <filesdb.hpp>

Public Member Functions

 FilesDB ()=default
 
 ~FilesDB ()=default
 
 FilesDB (const FilesDB &)=delete
 
FilesDBoperator= (const FilesDB &)=delete
 
 FilesDB (FilesDB &&)=delete
 
bool add_partfile (const std::string &group_id, std::shared_ptr< FileInfo > file_info, const std::string &file_path, bool all_downloaded)
 Add a partfile to the database.
 
bool remove_partfile (const std::string &group_id, const std::string &file_name)
 Remove a partfile from the database.
 
PartFile get_partfile (const std::string &group_id, const std::string &file_name)
 
bool has_file (const std::string &group_id, const std::string &file_name)
 Check if a partfile exists in the database.
 
bool has_piece (const std::string &group_id, const std::string &file_name, const std::string &piece)
 
bool is_complete (const std::string &group_id, const std::string &file_name)
 
bool mark_downloaded (const std::string &group_id, const std::string &file_name, const std::string &piece)
 

Detailed Description

A thread-safe database of partfiles.

Constructor & Destructor Documentation

◆ FilesDB() [1/3]

FilesDB::FilesDB ( )
default

◆ ~FilesDB()

FilesDB::~FilesDB ( )
default

◆ FilesDB() [2/3]

FilesDB::FilesDB ( const FilesDB & )
delete

◆ FilesDB() [3/3]

FilesDB::FilesDB ( FilesDB && )
delete

Member Function Documentation

◆ add_partfile()

bool FilesDB::add_partfile ( const std::string & group_id,
std::shared_ptr< FileInfo > file_info,
const std::string & file_path,
bool all_downloaded )

Add a partfile to the database.

Returns
true If the partfile was added successfully.
false If the partfile was not added successfully.

◆ get_partfile()

PartFile FilesDB::get_partfile ( const std::string & group_id,
const std::string & file_name )

◆ has_file()

bool FilesDB::has_file ( const std::string & group_id,
const std::string & file_name )

Check if a partfile exists in the database.

◆ has_piece()

bool FilesDB::has_piece ( const std::string & group_id,
const std::string & file_name,
const std::string & piece )

◆ is_complete()

bool FilesDB::is_complete ( const std::string & group_id,
const std::string & file_name )

◆ mark_downloaded()

bool FilesDB::mark_downloaded ( const std::string & group_id,
const std::string & file_name,
const std::string & piece )

◆ operator=()

FilesDB & FilesDB::operator= ( const FilesDB & )
delete

◆ remove_partfile()

bool FilesDB::remove_partfile ( const std::string & group_id,
const std::string & file_name )

Remove a partfile from the database.

Returns
true If the partfile was removed successfully.
false If the partfile was not removed successfully.

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