fpmas 1.6
Public Types | Public Member Functions | List of all members
fpmas::synchro::hard::hard_link::HardSyncLinker< T > Class Template Reference

#include <hard_sync_linker.h>

Inheritance diagram for fpmas::synchro::hard::hard_link::HardSyncLinker< T >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::synchro::hard::hard_link::HardSyncLinker< T >:
Collaboration graph
[legend]

Public Types

typedef fpmas::api::graph::DistributedEdge< T > EdgeApi
 
typedef fpmas::api::graph::DistributedNode< T > NodeApi
 

Public Member Functions

void registerNodeToRemove (fpmas::api::graph::DistributedNode< T > *node) override
 
 HardSyncLinker (fpmas::api::graph::DistributedGraph< T > &graph, api::LinkClient< T > &link_client, ServerPack< api::MutexServer< T >, api::LinkServer > &server_pack)
 
void link (EdgeApi *edge) override
 
void unlink (EdgeApi *edge) override
 
void removeNode (NodeApi *node) override
 
void synchronize () override
 
virtual void registerNodeToRemove (fpmas::api::graph::DistributedNode< T > *node)=0
 
virtual void link (api::graph::DistributedEdge< T > *edge)=0
 
virtual void unlink (api::graph::DistributedEdge< T > *edge)=0
 
virtual void removeNode (api::graph::DistributedNode< T > *node)=0
 
virtual void synchronize ()=0
 

Detailed Description

template<typename T>
class fpmas::synchro::hard::hard_link::HardSyncLinker< T >

HardSyncMode fpmas::api::synchro::SyncLinker implementation.

Link and unlink operations are commited on the fly using point-to-point MPI communication.

In consequence link() and unlink() operations block until the operations are commited, but it is guaranteed that operations are complete upon return (contrary to GhostSyncLinker, where new links can't be used until the next synchronization for example).

See also
fpmas::synchro::hard::hard_link::HardSyncMode

Member Typedef Documentation

◆ EdgeApi

DistributedEdge API.

◆ NodeApi

DistributedNode API.

Constructor & Destructor Documentation

◆ HardSyncLinker()

template<typename T >
fpmas::synchro::hard::hard_link::HardSyncLinker< T >::HardSyncLinker ( fpmas::api::graph::DistributedGraph< T > &  graph,
api::LinkClient< T > &  link_client,
ServerPack< api::MutexServer< T >, api::LinkServer > &  server_pack 
)
inline

HardSyncLinker constructor.

Parameters
graphassociated graph
link_clientclient used to transmit requests
server_packassociated server_pack used for synchronization

Member Function Documentation

◆ registerNodeToRemove()

template<typename T >
void fpmas::synchro::hard::hard_link::HardSyncLinker< T >::registerNodeToRemove ( fpmas::api::graph::DistributedNode< T > *  node)
inlineoverridevirtual

Registers a local node to be removed at the next synchronize() call.

This should be called when the MutexServer receives a REMOVE_NODE request. Indeed, the node can't be erased when the request is handled since requests for this node might still be pending.

In consequence, the node can be registered to be removed using this function, and is only removed at the next synchronize() call, after the TerminationAlgorithm has been applied, when it is ensured that no more request is pending.

Parameters
nodenode to remove

Implements fpmas::synchro::hard::api::HardSyncLinker< T >.

◆ link()

template<typename T >
void fpmas::synchro::hard::hard_link::HardSyncLinker< T >::link ( EdgeApi edge)
inlineoverridevirtual

Performs a link request.

If the specified edge is DISTANT, the request is transmitted to the api::LinkClient component. Nothing needs to be done otherwise.

If source and target nodes are both DISTANT, the edge is planned to be deleted at the next synchronize() call.

Parameters
edgeedge to link

Implements fpmas::api::synchro::SyncLinker< T >.

◆ unlink()

template<typename T >
void fpmas::synchro::hard::hard_link::HardSyncLinker< T >::unlink ( EdgeApi edge)
inlineoverridevirtual

Performs an unlink request.

If the specified edge is DISTANT, the request is transmitted to the api::LinkClient component. Nothing needs to be done otherwise.

Parameters
edgeedge to unlink

Implements fpmas::api::synchro::SyncLinker< T >.

◆ removeNode()

template<typename T >
void fpmas::synchro::hard::hard_link::HardSyncLinker< T >::removeNode ( NodeApi node)
inlineoverridevirtual

Performs a remove node request.

If the specified node is DISTANT, the request is transmitted to the api::LinkClient component. Else, the local process own the node, so unlink operations of the connected edges are performed using fpmas::api::graph::DistributedGraph::unlink().

The node is scheduled to be erased at the next HardDataSync::synchronize() call (see api::LinkClient::removeNode() for a detailed explanation).

Parameters
nodenode to remove

Implements fpmas::api::synchro::SyncLinker< T >.

◆ synchronize()

template<typename T >
void fpmas::synchro::hard::hard_link::HardSyncLinker< T >::synchronize ( )
inlineoverridevirtual

HardSyncLinker synchronization.

First, edges linked between a DISTANT source and a DISTANT target since the last synchronization are erased from the graph.

All processes are then synchronized using ServerPack::terminate().

Notice that, since ServerPack is used, not only SyncLinker requests but also HardSyncMutex requests (i.e. data related requests) will be handled until termination.

This is required to avoid the following deadlock situation :

Process 0 Process 1
... ...
init HardSyncLinker::terminate() send data request to P0...
handles link requests... waits for data response...
handles link requests... waits for data response...
DEADLOCK

Implements fpmas::api::synchro::SyncLinker< T >.


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