![]() |
fpmas 1.6
|
#include <hard_sync_linker.h>
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 |
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).
typedef fpmas::api::graph::DistributedEdge<T> fpmas::synchro::hard::hard_link::HardSyncLinker< T >::EdgeApi |
DistributedEdge API.
typedef fpmas::api::graph::DistributedNode<T> fpmas::synchro::hard::hard_link::HardSyncLinker< T >::NodeApi |
DistributedNode API.
|
inline |
HardSyncLinker constructor.
graph | associated graph |
link_client | client used to transmit requests |
server_pack | associated server_pack used for synchronization |
|
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.
node | node to remove |
Implements fpmas::synchro::hard::api::HardSyncLinker< T >.
|
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.
edge | edge to link |
Implements fpmas::api::synchro::SyncLinker< T >.
|
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.
edge | edge to unlink |
Implements fpmas::api::synchro::SyncLinker< T >.
|
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).
node | node to remove |
Implements fpmas::api::synchro::SyncLinker< T >.
|
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 >.