SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::server::RemoteProtocol Class Reference

Handles the remote communication protocol for SVCS. More...

#include <RemoteProtocol.hxx>

Public Member Functions

 RemoteProtocol (std::shared_ptr< ISubject > event_bus, std::shared_ptr< RepositoryManager > repository_manager)
 Constructs a RemoteProtocol with necessary dependencies.
 ~RemoteProtocol ()=default
 Default destructor.
bool handleReceivePack ()
 Handles the 'receive-pack' protocol for push operations.
bool handleUploadPack ()
 Handles the 'upload-pack' protocol for pull operations.

Detailed Description

Handles the remote communication protocol for SVCS.

Manages the custom protocol for push and pull operations, including object negotiation, data transfer, and reference updates between client and server. The protocol is a simple text-based exchange over standard input/output.

Constructor & Destructor Documentation

◆ RemoteProtocol()

svcs::server::RemoteProtocol::RemoteProtocol ( std::shared_ptr< ISubject > event_bus,
std::shared_ptr< RepositoryManager > repository_manager )

Constructs a RemoteProtocol with necessary dependencies.

Parameters
event_busThe shared pointer to the event bus for the notification system (ISubject).
repository_managerThe shared pointer to the repository manager for repository operations (RepositoryManager).

Member Function Documentation

◆ handleReceivePack()

bool svcs::server::RemoteProtocol::handleReceivePack ( )

Handles the 'receive-pack' protocol for push operations.

Returns
bool True if the protocol completed successfully (all objects received and references updated), false otherwise.

This function processes client push requests. It manages the negotiation of objects, receives the missing object data from the client, and finally attempts to apply the requested reference updates (e.g., updating branches).

◆ handleUploadPack()

bool svcs::server::RemoteProtocol::handleUploadPack ( )

Handles the 'upload-pack' protocol for pull operations.

Returns
bool True if the protocol completed successfully (objects negotiated and sent), false otherwise.

This function processes client pull requests. It performs object negotiation by determining which objects the client is missing based on its 'have' list, and then packages and sends the missing object data to the client.


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