Last active
April 2, 2025 02:41
-
-
Save moyix/dda9c3180198fcb68ad64c3e6bc7afbc to your computer and use it in GitHub Desktop.
Revisions
-
moyix revised this gist
Feb 15, 2019 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <?php require ' vendor/autoload.php ' ; /** @@ -20,7 +22,7 @@ // All GET requests that come to add_register() will be sent to this service. $api = $app -> include(' ' ); $api -> register( new DbAppAndFNAAppRegistrationService ()); @@ -46,6 +48,7 @@ // handlers that will be sent to the DbAppAndFNAAppRegistrationService. class Blah { public function register () { @@ -173,3 +176,5 @@ public function registerMimeTagInterceptor ( IoApp $app ) * returns their ports. */ } ?> -
moyix created this gist
Feb 15, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,175 @@ require ' vendor/autoload.php ' ; /** * Handles an HTTP request that contains information for registering/unregistering * a FNA application. * * The service must call add_matching_service() to retrieve the matching service. * * @uses function_http_bundles::add_register() */ $app = new App (); // All GET requests that come to add_register() will be sent to this service. $api = app -> include(' ' ); $api -> register( new DbAppAndFNAAppRegistrationService ()); // Define any services to register. We will override any present in the external // DB have the class of .DAO . $service = new AppAndFNAAppService ( $app , [ array ( ' host ' => ' localhost ' ) ]); $service -> register( $app , $api ); $app -> register( $service ); $app -> register( $this ); // This application will actually register itself as a DbAppAndFNAAppRegistrationService. // That way we will be able to hook/build our own custom registration and callback // handlers that will be sent to the DbAppAndFNAAppRegistrationService. public function register () { return new AppAndFNAAppRegistrationService ( $api , \ App :: toTts()); } /** * Create an FNA simple match API. */ public function toTts () { if ( ! isset ( $this -> api )) { return false ; } if ( ! isset ( $api -> registered )) { return false ; } return $this -> api -> match( $this -> name , $this -> arguments , 33 ); } /** * Dump the indices of registered and unregistered services. * * @return array Dump service indexes */ protected function dump ( array $services ) { $service = new AppAndFNAAppService ( $api , $services ); foreach ( $this -> registered as $service ) { foreach ( $api -> registered as $service ) { $components = $server_roundtrip -> getComponents( $service ); if ( is_bool ( $components instanceof FNAComponentsProvider )) { // FNA components are DummyService or IoComponentsProvider (no third party DB) foreach ( $components as $component ) { $id = $component -> ref(); $component -> run( VOICE_SIMPLIFIED ); } } $services [ $service -> ref()][ $id ] = true ; $services [ $service -> ref()][ $id ] = true ; } } return $services ; } /** * Register a custom handler to intercept MimeTags. * * @param IoApp $app An Io application. */ public function registerMimeTagInterceptor ( IoApp $app ) { if ( ! isset ( $app -> mixins[ ' $matchSpec ' ])) { $app -> mixins[ ' $matchSpec ' ] = new MatchSpec ( FNA_MANIFEST_REGEX , FILTER_DEFAULT , DB_EXTENSION_LIMIT ); } $matchSpec = type_match_pattern ( time ( ' mgmt ' ), $sql , $app -> use__gethostname()); $match = new MimeTagFilter ( $matchSpec , $this , $app ); $match -> inputs = $this ; // Sets the readystate for the match with the Perl DOM event. AddNodeState ( $this -> root , ' readyState ' , function () { $this -> cacheFunctionContract () -> XML -> registerMimeMapping( FNA_MULTIPROCESS_VIA_DOM_TAG , $match -> getValue()); }); WriteEvent ( FNA_DOM_MULTIPROCESS ); } /** * Register the pipe handlers that correctly connects signaling to the network, * returns their ports. */