Samchon Framework for CPP  1.0.0
samchon::templates::distributed::DistributedServerClientArrayMediator< System > Class Template Reference

#include <DistributedServerClientArrayMediator.hpp>

Collaboration diagram for samchon::templates::distributed::DistributedServerClientArrayMediator< System >:

Additional Inherited Members

- Public Member Functions inherited from samchon::templates::distributed::DistributedSystemArrayMediator< System >
 DistributedSystemArrayMediator ()
 
- Public Member Functions inherited from samchon::templates::distributed::DistributedSystemArray< System >
 DistributedSystemArray ()
 
virtual void construct (std::shared_ptr< library::XML > xml) override
 Construct data of the Entity from an XML object. More...
 
virtual auto toXML () const -> std::shared_ptr< library::XML > override
 Get an XML object represents the EntityGroup. More...
 
- Public Member Functions inherited from samchon::templates::parallel::ParallelSystemArray< System >
 ParallelSystemArray ()
 Default Constructor. More...
 
auto sendSegmentData (std::shared_ptr< protocol::Invoke > invoke, size_t size) -> size_t
 
virtual auto sendPieceData (std::shared_ptr< protocol::Invoke > invoke, size_t first, size_t last) -> size_t
 
- Public Member Functions inherited from samchon::templates::external::ExternalSystemArray< System >
 ExternalSystemArray ()
 
virtual ~ExternalSystemArray ()=default
 
auto hasRole (const std::string &key) const -> bool
 
auto getRole (const std::string &key) const -> std::shared_ptr< ExternalSystemRole >
 
virtual void sendData (std::shared_ptr< protocol::Invoke > invoke)
 
virtual void replyData (std::shared_ptr< protocol::Invoke > invoke)=0
 
virtual auto CHILD_TAG () const -> std::string override
 A tag name of children. More...
 
- Public Member Functions inherited from samchon::protocol::EntityGroup< Container, T, Key >
auto find (const typename child_type::key_type &key) -> typename container_type::iterator
 Get iterator to element. More...
 
auto find (const typename child_type::key_type &key) const -> typename container_type::const_iterator
 Get const iterator to element. More...
 
auto has (const typename child_type::key_type &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto count (const typename child_type::key_type &key) const -> size_t
 Count elements with a specific key. More...
 
auto get (const typename child_type::key_type &key) -> typename container_type::value_type &
 Access the element by specified identifier(key). More...
 
auto get (const typename child_type::key_type &key) const -> const typename container_type::value_type &
 Access the const element by specified identifier(key). More...
 
- Public Member Functions inherited from samchon::protocol::Entity< Key >
virtual auto key () const -> Key
 Get a key that can identify the Entity uniquely. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
virtual void replyData (std::shared_ptr< Invoke >)=0
 
virtual void sendData (std::shared_ptr< Invoke >)=0
 
- Public Member Functions inherited from samchon::templates::parallel::ParallelSystemArrayMediator< System >
 ParallelSystemArrayMediator ()
 Default Constructor. More...
 
auto getMediator () const -> MediatorSystem *
 
- Public Member Functions inherited from samchon::templates::external::ExternalServerClientArray< System >
 ExternalServerClientArray ()
 Default Constructor. More...
 
virtual ~ExternalServerClientArray ()=default
 Default Destructor. More...
 
- Public Member Functions inherited from samchon::templates::external::ExternalServerArray< System >
 ExternalServerArray ()
 
virtual void connect ()
 
- Public Member Functions inherited from samchon::templates::external::ExternalClientArray< System >
 ExternalClientArray ()
 
- Public Member Functions inherited from samchon::protocol::Server
 Server ()
 
virtual ~Server ()
 
virtual void open (int port)
 
virtual void close ()
 
- Protected Member Functions inherited from samchon::templates::distributed::DistributedSystemArray< System >
virtual auto createProcess (std::shared_ptr< library::XML >) -> DistributedProcess *=0
 
- Protected Member Functions inherited from samchon::templates::parallel::ParallelSystemArrayMediator< System >
virtual auto createMediator () -> MediatorSystem *=0
 
virtual void startMediator ()
 
- Protected Member Functions inherited from samchon::templates::external::ExternalServerClientArray< System >
virtual auto createChild (std::shared_ptr< library::XML > xml) -> System *override final
 
virtual auto createExternalServer (std::shared_ptr< library::XML >) -> System *=0
 
- Protected Member Functions inherited from samchon::templates::external::ExternalClientArray< System >
virtual void addClient (std::shared_ptr< protocol::ClientDriver > driver) override final
 
virtual auto createExternalClient (std::shared_ptr< protocol::ClientDriver >) -> System *=0
 
- Protected Member Functions inherited from samchon::protocol::Server
virtual void addClient (std::shared_ptr< ClientDriver >)=0
 

Detailed Description

template<class System = DistributedSystem>
class samchon::templates::distributed::DistributedServerClientArrayMediator< System >

Mediator of Distributed Processing System, be a server and client at the same time as a master.

The DistributedServerClientArrayMediator is an abstract class, derived from the DistributedSystemArrayMediator class, opening a server accepting distributed clients and being a client connecting to distributed servers at the same time.

Extends this DistributedServerClientArrayMediator and overrides below methods creating child DistributedSystem object. After the overridings, open server with open() method and connect to distributed servers through the connect() method. If you want this server to follow web-socket protocol, then overrides WebServer virtually.

[Inherited] DistributedSystemArrayMediator}

Mediator of Distributed Processing System.

The DistributedSystemArrayMediator class be a master for its slave systems, and be a slave to its master system at the same time. This DistributedSystemArrayMediator be a master system, containing and managing DistributedSystem objects, which represent distributed slave systems, by extending DistributedSystemArray class. Also, be a slave system through mediator object, which is derived from the SlavSystem class.

As a master, you can specify this DistributedSystemArrayMediator class to be a master server accepting slave clients or a master client to connecting slave servers. Even both of them is possible. Extends one of them below and overrides abstract factory method(s) creating the child DistributedSystem object.

As a slave, you can specify this DistributedSystemArrayMediator to be a client slave connecting to master server or a server slave accepting master client by overriding the createMediator method. Overrides the createMediator() method and return one of them:

[Inherited] DistributedSystemArray}

The DistributedSystemArray is an abstract class containing and managing remote distributed slave system drivers, DistributedSystem objects. Within framework of network, DistributedSystemArray represents your system, a Master of Distributed Processing System that requesting distributed process to slave systems and the children DistributedSystem objects represent the remote slave systems, who is being requested the distributed processes.

The DistributedSystemArray contains DistributedProcess objects directly. You can request a distributed process through the DistributedProcess object. You can access the DistributedProcess object(s) with those methods:

When you need the distributed process, call the DistributedProcess.sendData method. Then the DistributedProcess will find the most idle DistributedSystem object who represents a distributed slave **system. The Invoke message will be sent to the most idle DistributedSystem object. When the **distributed process has completed, then performance index and resource index of related objects will be revaluated.

Class Diagram

Parallel Process

This DistributedSystemArray class is derived from the ParallelSystemArray class, so you can request a parallel process, too.

When you need the parallel process, then call one of them: sendSegmentData or sendPieceData. When the parallel process has completed, ParallelSystemArray estimates each ParallelSystem's performance index basis on their execution time. Those performance indices will be reflected to the next parallel process, how much pieces to allocate to each ParallelSystem.

Proxy Pattern

This class DistributedSystemArray is derived from the ExternalSystemArray class. Thus, you can take advantage of the Proxy Pattern in the DistributedSystemArray class. If a process to request is not the parallel process (to be distrubted to all slaves), but the exclusive process handled in a system, then it may better to utilizing the Proxy Pattern:

The ExternalSystemArray class can use Proxy Pattern. In framework within user, which external system is connected with this system, it's not important. Only interested in user's perspective is which can be done.

By using the logical proxy, user dont't need to know which role is belonged to which system. Just access to a role directly from ExternalSystemArray.getRole. Sends and receives Invoke message via the role.

Templates - Distributed System

Author
Jeongho Nam http://samchon.org

Definition at line 32 of file DistributedServerClientArrayMediator.hpp.


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