-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(GH-11) Refactor the transport layers to loosen object coupling
Previously the different transport types, TCP and STDIO, were very closely coupled which made debugging and maintaining them difficult. This commit changes the relationships between the server, client connection, message handler and message router classes/objects to be much looser and can therefore be defined/instantiated easier at run time; New object model - (Transport Server) creates a (Client Connection object) per incoming connection - Each (Client Connection object) creates a (Handler object) - Each (Handler object) creates a (Message Router object) Therefore the Message Router can create messages which traverse back down the object chain and is eventually emitted by the Transport Server. This model should apply whether it is a STDIO or TCP transport * The JSON Handler no longer inherits the TCP Server Connection, but a generic SimpleServerConnectionHandler which has some base methods. The message router object is now assigned via the message_router methods, which can be passed in via the initializer, or defaults to an instance of the PuppetDebugServer::MessageRouter class. The client connection object is expected to implement the SimpleServerConnectionBase "interface" and passedv in via the Handler initializer. * The Message Router no longer inherits from the JSON handler, but has a json_handler method. It is assumed the Handler will set this when it creates an instance of the Router * A new SimpleSTDIOServerConnection object has been created which implements the base SimpleServerConnectionBase object. This object is the concrete implementation of connection over the STDIO transport * The TCP Server Connection now inherits from the SimpleServerConnectionBase object and tracks the originating TCP Server object and socket via the initializer * PuppetLanguageServer was modified to use the new STDIO connection type and use the JSON Handler instead of the MessageRouter * The document_type method was moved from the MessageRouter code to the DocumentStore module. This made more sense and means that we don't need to create an entire Message Router object to do a simple static document type check * The validation queue was modified with the new namespace of the document_type static method * Tests were modified for the new object hierarchy
- Loading branch information
1 parent
5f1b8c1
commit 54f4b8e
Showing
17 changed files
with
261 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.