Samchon Framework for CPP  1.0.0
samchon::protocol::slave::ParallelSystem Class Referenceabstract

A slave parallel system. More...

#include <ParallelSystem.hpp>

Collaboration diagram for samchon::protocol::slave::ParallelSystem:

Public Member Functions

 ParallelSystem ()
 Default Constructor. More...
 
virtual void replyPieceData (std::shared_ptr< Invoke >, size_t, size_t)=0
 Handle requested processes which are segmented. More...
 
- Public Member Functions inherited from samchon::protocol::slave::SlaveSystem
 SlaveSystem ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::ExternalSystem
 ExternalSystem ()
 Default Constructor. More...
 
virtual void construct (std::shared_ptr< library::XML >) override
 Construct data of the Entity from an XML object. More...
 
virtual void start ()=0
 Start interaction. More...
 
virtual auto key () const -> std::string override
 Get a key that can identify the Entity uniquely. More...
 
virtual void replyData (std::shared_ptr< Invoke >) override
 Handling replied message from an external system. More...
 
virtual auto TAG () const -> std::string override
 A tag name when represented by XML. More...
 
virtual auto CHILD_TAG () const -> std::string override
 A tag name of children. 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::protocol::EntityGroup< _Container, _ETy, T >
 EntityGroup ()
 Default Constructor. More...
 
auto has (const std::string &key) const -> bool
 Indicates whether a container has an object having the specified identifier. More...
 
auto get (const std::string &key) -> value_type &
 Access the element by specified identifier(key). More...
 
auto get (const std::string &key) const -> const value_type &
 Access the const element by specified identifier(key). More...
 
- Public Member Functions inherited from samchon::protocol::Entity
 Entity ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::IEntityGroup
 IEntityGroup ()
 Default Constructor. More...
 
- Public Member Functions inherited from samchon::protocol::IClient
 IClient ()
 Default Constructor. More...
 
virtual void listen ()
 Listens message from a related system. More...
 
virtual void sendData (std::shared_ptr< Invoke >)
 Sends message to a related system. More...
 
- Public Member Functions inherited from samchon::protocol::IProtocol
 IProtocol ()
 Default Constructor. More...
 

Protected Member Functions

virtual auto createChild (std::shared_ptr< library::XML >) -> ExternalSystemRole *override
 Factory method of a child Entity. More...
 
virtual void _replyData (std::shared_ptr< Invoke >) override
 Pre-processor for segmented processes and reporting elapsed time. More...
 
- Protected Member Functions inherited from samchon::protocol::IClient
virtual auto BUFFER_SIZE () const -> size_t
 Buffer size of network I/O. More...
 

Additional Inherited Members

- Protected Attributes inherited from samchon::protocol::ExternalSystem
std::string name
 A name can identify an external system. More...
 
std::string ip
 An ip address of an external system. More...
 
int port
 A port number of an external system. More...
 
- Protected Attributes inherited from samchon::protocol::IClient
Socket * socket
 Socket for network I/O. More...
 
std::mutex * sendMtx
 A mutex for sending message. More...
 

Detailed Description

A slave parallel system.

ParallelSystem is a class processing segmented Invoke messages from master.

[Inherited]

SlaveSystem, literally, means a slave system belongs to a maste system.

The SlaveSystem class is used in opposite side system of master::DistributedSystem and master::ParallelSystem and reports elapsed time of each commmand (by Invoke message) for estimation of its performance.

[Inherited]

ExternalSystem is a boundary class interacting with an external system by network communication. Also, ExternalSystem is an abstract class that a network role, which one is server and which one is client, is not determined yet.

The ExternalSystem has ExternalSystemRole(s) groupped methods, handling Invoke message interacting with the external system, by subject or unit of a moudle. The ExternalSystemRole is categorized in a 'control'.

protocol_external_system.png
Example Sources
Note

The ExternalSystem class takes a role of interaction with external system in network level. However, within a framework of Samchon Framework, a boundary class like the ExternalSystem is not such important. You can find some evidence in a relationship between ExternalSystemArray, ExternalSystem and ExternalSystemRole.

Of course, the ExternalSystemRole is belonged to an ExternalSystem. However, if you access an ExternalSystemRole from an ExternalSystemArray directly, not passing by a belonged ExternalSystem, and send an Invoke message even you're not knowing which ExternalSystem is related in, it's called "Proxy pattern".

Like the explanation of "Proxy pattern", you can utilize an ExternalSystemRole as a proxy of an ExternalSystem. With the pattern, you can only concentrate on ExternalSystemRole itself, what to do with Invoke message, irrespective of the ExternalSystemRole is belonged to which ExternalSystem.

See also
samchon::protocol
Author
Jeongho Nam http://samchon.org

Definition at line 21 of file ParallelSystem.hpp.

Constructor & Destructor Documentation

Member Function Documentation

virtual auto samchon::protocol::slave::ParallelSystem::createChild ( std::shared_ptr< library::XML ) -> ExternalSystemRole *override
overrideprotectedvirtual

Factory method of a child Entity.

EntityGroup::createChild() is a factory method creating a new child Entity which is belonged to the EntityGroup. This method is called by EntityGroup::construct(). The children construction methods Entity::construct() will be called by abstract method of the EntityGroup::construct().

Returns
A new child Entity belongs to EntityGroup.

Implements samchon::protocol::EntityGroup< _Container, _ETy, T >.

Referenced by ParallelSystem().

Here is the caller graph for this function:

virtual void samchon::protocol::slave::ParallelSystem::_replyData ( std::shared_ptr< Invoke )
overrideprotectedvirtual

Pre-processor for segmented processes and reporting elapsed time.

[Inherited]

You can realize a pre-processing about the replied Invoke message by overriding the IClient::_replyData().

Archiving a history log, filtering and truncating, let handling the message with a new thread, calculating performance by estimating elapsed time about the Invoke message, and so on. Anything you can define pre-processing works before IProtocol::replyData().

  • Archive history log -> cloud service
  • Estimating performance -> distributed and parallel processing system
Parameters
invokeAn invoke message to be pre-processed and shifted to IProtocol::replyData().

Reimplemented from samchon::protocol::slave::SlaveSystem.

Referenced by ParallelSystem().

Here is the caller graph for this function:

virtual void samchon::protocol::slave::ParallelSystem::replyPieceData ( std::shared_ptr< Invoke ,
size_t  ,
size_t   
)
pure virtual

Handle requested processes which are segmented.

Parameters
invokeAn invoke message containing segmented process requestments.
startIndexStarting index number of segmentation.
sizeSize of segmentation.

Implemented in samchon::protocol::master::ParallelSlaveSystemMediator.

Referenced by ParallelSystem().

Here is the caller graph for this function:


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