P2P File Share
A simple peer-to-peer file sharing system.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PeerDB Class Reference

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

#include <peerdb.hpp>

Public Member Functions

bool addPeer (EndpointID id, const Endpoint &endpoint)
 
bool removePeer (EndpointID id)
 
bool addFile (EndpointID peer_id, const std::string &group_id, const std::string &file_name)
 
bool removeFile (EndpointID peer_id, const std::string &group_id, const std::string &file_name)
 
std::vector< std::shared_ptr< Peer > > getPeers (const std::string &group_id, const std::string &file_name)
 Get a list of peers that have the file.
 

Detailed Description

A thread-safe database of peers.

Member Function Documentation

◆ addFile()

bool PeerDB::addFile ( EndpointID peer_id,
const std::string & group_id,
const std::string & file_name )

◆ addPeer()

bool PeerDB::addPeer ( EndpointID id,
const Endpoint & endpoint )

◆ getPeers()

std::vector< std::shared_ptr< Peer > > PeerDB::getPeers ( const std::string & group_id,
const std::string & file_name )

Get a list of peers that have the file.

Parameters
group_idThe group id of the file.
file_nameThe name of the file.
Returns
std::vector<std::shared_ptr<Peer>> A list of peers that have the file.

◆ removeFile()

bool PeerDB::removeFile ( EndpointID peer_id,
const std::string & group_id,
const std::string & file_name )

◆ removePeer()

bool PeerDB::removePeer ( EndpointID id)

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