Skip to content

Framework class diagram

mike edited this page Dec 25, 2017 · 2 revisions

In this section, a informal class diagram of the pinus framework is presented.

There are some notices about the class diagram:

  • Actually, since there is not a concept of class but simulative pseudo-class in javascript, so classes within the class diagram is not corresponding to the pseudo-classes defined within the pinus framework strictly. For example, HandlerFilter, in our class diagram , it is an abstract class to be as the super for all HandlerFilter class, however there is not a corresponding definition in the pinus framework. We often define just before method and after method for an object and then treat it as a HandlerFilter, without being concerned about their inheritance hierarchy.

  • In the class diagram, we name some classes with prefix "Co", in order to indicate that it is a component for pinus framework.

  • In the class diagram, There is a RawSocket class, which is treated as an abstract socket for communication. In practical, it may be WebSocket, TCP or socket.io. All the classes related to RawSocket will participante network communication, including communication with clients or with other servers via RPC invocation.

Here is the class diagram :

pinus Framework class diagram

The following is a brief analysis of the class diagram:

  • The Core of the framework is two classes, Pinus and Application, Application instance is created by Pinus. Pinus consists of a series of components and a global context "Application".

  • All the components that have a "Co"-prefixal name presented in the diagram are subclasses of abstract class Component. Each component will do its particular work, and be loaded by different servers. The components presented in the class diagram are all built-in component of pinus framework, which provide core functionalities of pinus. Developer can customize their own component to extend pinus framework as well.

  • In order to demonstrate pinus framework better, the classes presented is not only in pinus framework, but also some classes that is related to the pinus framework, such as some classes in the pinus-admin and pinus-rpc.

  • It can be seen from the class diagram that there are many classes that are communication-related as they are related to RawSocket, such as MasterAgent & MonitorAgent; MailBox & Acceptor and Connector. In fact , MasterAgent & MonitorAgent are used in server management framework, MasterAgent acts as "server", and MonitorAgent acts as "client". MasterAgent listens on its configured port, MonitorAgent will connects and communicates to MasterAgent, and transfer the commands and monitoring info between them to complete the job for server cluster management, and MailBox and Acceptor do the same work as MasterAgent and MonitorAgent do, but they work for RPC framework. Connector is used to accept connections from clients.

Clone this wiki locally