Vuo 2.4.4
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Friends | List of all members
VuoModuleCache Class Reference

Description

Provides an interface to the caches of compiled modules stored in the filesystem, with the ability to build a cache, rebuild a cache if it's out of date, and search for a cached module.

Each instance of this class is associated with one scope of modules (built-in, system, user, etc.) and may contain modules from multiple environments at that scope.

See also
VuoCompilerEnvironment

Definition at line 29 of file VuoModuleCache.hh.

Public Member Functions

string getCompiledModulesPath (bool isGenerated, const string &targetArch)
 Returns the directory containing compiled/generated bitcode for installed or generated modules.
 
string getOverriddenCompiledModulesPath (bool isGenerated, const string &targetArch)
 Returns the directory containing compiled/generated bitcode for unsaved edits to installed modules.
 
bool modifyCompiledModules (std::function< bool(void)> modify)
 Attempts to modify the contents of the compiled modules directory in a way that is safe when multiple processes are vying for the same directory.
 
void makeAvailable (bool shouldUseExistingCache, vector< shared_ptr< VuoModuleCache > > prerequisiteModuleCaches, double &lastPrerequisiteModuleCacheRebuild, const VuoModuleCacheManifest &expectedManifest, vector< VuoModuleInfoIterator > expectedModules, const set< string > &dylibsToLinkTo, const set< string > &frameworksToLinkTo, const vector< string > &runPathSearchPaths, VuoCompiler *compiler, const string &targetArch="")
 Attempts to make the module cache available — either making it available initially or making it available again after a change to the cacheable contents has made it out-of-date.
 
shared_ptr< VuoModuleCacheRevisionuseCurrentRevision (void)
 Returns the most recent revision of this module cache if one is available, otherwise null.
 
void invalidate (void)
 Indicates that the cacheable data has changed, so the cache may need to be rebuilt.
 

Static Public Member Functions

static shared_ptr< VuoModuleCachenewBuiltInCache (void)
 Creates a VuoModuleCache instance for modules at the built-in scope.
 
static shared_ptr< VuoModuleCachenewSystemCache (void)
 Creates a VuoModuleCache instance for modules at the system scope.
 
static shared_ptr< VuoModuleCachenewUserCache (void)
 Creates a VuoModuleCache instance for modules at the user scope.
 
static shared_ptr< VuoModuleCachenewCache (const string &uniquePath)
 Creates a VuoModuleCache instance for modules at a composition-family, composition, or other scope.
 
static void waitForCachesToBuild (void)
 Waits for cache (re)builds scheduled by makeAvailable to complete.
 
static void deleteOldCaches (void)
 Deletes:
 

Friends

class TestModuleCaches
 
class ModuleCachesDiff
 
class ModuleScope
 

Member Function Documentation

◆ deleteOldCaches()

void VuoModuleCache::deleteOldCaches ( void  )
static

Deletes:

  • any composition-local module cache directories that have not been accessed for more than 30 days.
  • any pid-specific module cache directories for pids that are not currently running.

Definition at line 745 of file VuoModuleCache.cc.

◆ getCompiledModulesPath()

string VuoModuleCache::getCompiledModulesPath ( bool  isGenerated,
const string &  targetArch 
)

Returns the directory containing compiled/generated bitcode for installed or generated modules.

Definition at line 197 of file VuoModuleCache.cc.

◆ getOverriddenCompiledModulesPath()

string VuoModuleCache::getOverriddenCompiledModulesPath ( bool  isGenerated,
const string &  targetArch 
)

Returns the directory containing compiled/generated bitcode for unsaved edits to installed modules.

Definition at line 205 of file VuoModuleCache.cc.

◆ invalidate()

void VuoModuleCache::invalidate ( void  )

Indicates that the cacheable data has changed, so the cache may need to be rebuilt.

Definition at line 732 of file VuoModuleCache.cc.

◆ makeAvailable()

void VuoModuleCache::makeAvailable ( bool  shouldUseExistingCache,
vector< shared_ptr< VuoModuleCache > >  prerequisiteModuleCaches,
double &  lastPrerequisiteModuleCacheRebuild,
const VuoModuleCacheManifest expectedManifest,
vector< VuoModuleInfoIterator expectedModules,
const set< string > &  dylibsToLinkTo,
const set< string > &  frameworksToLinkTo,
const vector< string > &  runPathSearchPaths,
VuoCompiler compiler,
const string &  targetArch = "" 
)

Attempts to make the module cache available — either making it available initially or making it available again after a change to the cacheable contents has made it out-of-date.

If the cache is out-of-date (and shouldUseExistingCache is false), it is scheduled to be rebuilt asynchronously.

If the cacheable contents haven't changed since the last time this function was called, this call just returns without checking or rebuilding the cache.

The caller must call VuoModuleCache::waitForCachesToBuild() after one or more calls to this function to make sure spawned threads complete before the main thread exits.

Parameters
shouldUseExistingCacheIf true, the existing cache (if any) is used, without checking if it's consistent with the expected contents.
prerequisiteModuleCachesThe caches at broader scopes on which this cache depends.
lastPrerequisiteModuleCacheRebuildWhen making a series of caches available in order from broadest to narrowest scope, pass in a variable set to 0 on the first call and the same variable on subsequent calls. This function updates the variable to either the last-modified time of the cache if it doesn't need to be rebuilt or a very large number if the cache does need to be rebuilt.
expectedManifestA list of the modules and static libraries that the module cache should contain when up-to-date.
expectedModulesIterators to get information about the module files for all modules that the module cache should contain.
dylibsToLinkToThe paths of all dylibs that need to be linked into the dylib when rebuilding it.
frameworksToLinkToThe names of all frameworks that need to be linked into the dylib when rebuilding it.
runPathSearchPathsThe rpaths that need to be passed to the linker when rebuilding the cache.
compilerThe compiler to use for linking the cache (if it needs to be rebuilt).
targetArchIf non-empty, the cache will only be checked and rebuilt for this single architecture.

This function may only be called on dispatch queue VuoCompiler::environmentQueue.

Definition at line 371 of file VuoModuleCache.cc.

◆ modifyCompiledModules()

bool VuoModuleCache::modifyCompiledModules ( std::function< bool(void)>  modify)

Attempts to modify the contents of the compiled modules directory in a way that is safe when multiple processes are vying for the same directory.

Returns true if this process holds the lock for writing to the module cache and thus was able to modify the contents. Otherwise, returns false.

Definition at line 224 of file VuoModuleCache.cc.

◆ newBuiltInCache()

shared_ptr< VuoModuleCache > VuoModuleCache::newBuiltInCache ( void  )
static

Creates a VuoModuleCache instance for modules at the built-in scope.

Definition at line 62 of file VuoModuleCache.cc.

◆ newCache()

shared_ptr< VuoModuleCache > VuoModuleCache::newCache ( const string &  uniquePath)
static

Creates a VuoModuleCache instance for modules at a composition-family, composition, or other scope.

Parameters
uniquePathA path that is unique to the scope, which will be mangled to form the cache directory name.

Definition at line 109 of file VuoModuleCache.cc.

◆ newSystemCache()

shared_ptr< VuoModuleCache > VuoModuleCache::newSystemCache ( void  )
static

Creates a VuoModuleCache instance for modules at the system scope.

Definition at line 77 of file VuoModuleCache.cc.

◆ newUserCache()

shared_ptr< VuoModuleCache > VuoModuleCache::newUserCache ( void  )
static

Creates a VuoModuleCache instance for modules at the user scope.

Definition at line 92 of file VuoModuleCache.cc.

◆ useCurrentRevision()

shared_ptr< VuoModuleCacheRevision > VuoModuleCache::useCurrentRevision ( void  )

Returns the most recent revision of this module cache if one is available, otherwise null.

The caller is responsible for calling VuoModuleCacheRevision::disuse() on the returned revision when finished using it.

Definition at line 715 of file VuoModuleCache.cc.

◆ waitForCachesToBuild()

void VuoModuleCache::waitForCachesToBuild ( void  )
static

Waits for cache (re)builds scheduled by makeAvailable to complete.

Definition at line 702 of file VuoModuleCache.cc.

Friends And Related Symbol Documentation

◆ ModuleCachesDiff

friend class ModuleCachesDiff
friend

Definition at line 97 of file VuoModuleCache.hh.

◆ ModuleScope

friend class ModuleScope
friend

Definition at line 98 of file VuoModuleCache.hh.

◆ TestModuleCaches

friend class TestModuleCaches
friend

Definition at line 96 of file VuoModuleCache.hh.


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