forked from puppetlabs/puppet-editor-services
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(puppetlabsGH-121) Add caching layer to Puppet 4 API functions
Previously the Puppet 4 API loader would always _actually_ load the Puppet assets whereas the Puppet 3 loader had a caching layer to speed up the process. This commit adds same caching layer to the Puppet 4 API loaders, specifically for functions in this case: * Fixes minor typos in the filesystem cache object and adds a `clear` method which should only be used for testing * Move the caching object to live on the PuppetLanguageServerSideCar module. This is required as the monkey patches have no way of knowing how to access the cache without it. * Functions were modified to have an additional was_cached and was_preloaded property. was_cached indicates that the function was loaded from cache and should not be saved back to cache either. was_preloaded indicates that the object was loaded prior to the loading process. They should also not be saved to cache because they can never be loaded from cache. * The function creation methods were modified to load the function metadata from cache. Even if we load the metadata from the cache, we still need _actually_ load the function in Puppet as it keeps track of function loading and will attempt reloads if it's not seen. Fortunately loading functions is quick and the user won't really see any slow downs. The slow part of the process is the puppet string documentation which is not processed when `.was_cached` is set to true * Added tests to the function loading to ensure that the metadata from the function loading is that same whether it is loaded from cache or not.
- Loading branch information
1 parent
aa31944
commit 47e4e90
Showing
6 changed files
with
185 additions
and
52 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
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.