def datafile_Store( self, store_name, clause_name, *, path=None, basedir=None, hashclass=None, ): ''' Construct a VTDStore from a "datafile" clause. ''' if basedir is None: basedir = self.get_default('basedir') if path is None: path = clause_name path = longpath(path) if not isabspath(path): if path.startswith('./'): path = abspath(path) else: if basedir is None: raise ValueError('relative path %r but no basedir' % (path, )) basedir = longpath(basedir) path = joinpath(basedir, path) return VTDStore(store_name, path, hashclass=hashclass)
def datadir_Store( self, store_name, clause_name, *, path=None, basedir=None, hashclass=None, raw=False, ): ''' Construct a DataDirStore from a "datadir" clause. ''' if basedir is None: basedir = self.get_default('basedir') if path is None: path = clause_name path = longpath(path) if not isabspath(path): if path.startswith('./'): path = abspath(path) else: if basedir is None: raise ValueError('relative path %r but no basedir' % (path, )) basedir = longpath(basedir) path = joinpath(basedir, path) if isinstance(raw, str): raw = truthy_word(raw) return DataDirStore(store_name, path, hashclass=hashclass, raw=raw)
def platonic_Store( self, store_name, clause_name, *, path=None, basedir=None, follow_symlinks=False, meta=None, archive=None, hashclass=None, ): ''' Construct a PlatonicStore from a "datadir" clause. ''' if basedir is None: basedir = self.get_default('basedir') if path is None: path = clause_name debug("path from clausename: %r", path) path = longpath(path) debug("longpath(path) ==> %r", path) if not isabspath(path): if path.startswith('./'): path = abspath(path) debug("abspath ==> %r", path) else: if basedir is None: raise ValueError('relative path %r but no basedir' % (path, )) basedir = longpath(basedir) debug("longpath(basedir) ==> %r", basedir) path = joinpath(basedir, path) debug("path ==> %r", path) if follow_symlinks is None: follow_symlinks = False if meta is None: meta_store = None elif isinstance(meta, str): meta_store = Store(meta, self) if isinstance(archive, str): archive = longpath(archive) return PlatonicStore( store_name, path, hashclass=hashclass, indexclass=None, follow_symlinks=follow_symlinks, meta_store=meta_store, archive=archive, flags_prefix='VT_' + clause_name, )
def filecache_Store( self, store_name, clause_name, *, path=None, max_files=None, max_file_size=None, basedir=None, backend=None, hashclass=None, ): ''' Construct a FileCacheStore from a "filecache" clause. ''' if basedir is None: basedir = self.get_default('basedir') if path is None: path = clause_name debug("path from clausename: %r", path) path = longpath(path) debug("longpath(path) ==> %r", path) if isinstance(max_files, str): max_files = scaled_value(max_files) if isinstance(max_file_size, str): max_file_size = scaled_value(max_file_size) if backend is None: backend_store = None else: backend_store = self.Store_from_spec(backend) if not isabspath(path): if path.startswith('./'): path = abspath(path) debug("abspath ==> %r", path) else: if basedir is None: raise ValueError('relative path %r but no basedir' % (path, )) basedir = longpath(basedir) debug("longpath(basedir) ==> %r", basedir) path = joinpath(basedir, path) debug("path ==> %r", path) return FileCacheStore( store_name, backend_store, path, max_cachefile_size=max_file_size, max_cachefiles=max_files, hashclass=hashclass, )
def blockmapdir(self): ''' The global blockmapdir. Falls back to `{self.basedir}/blockmaps`. ''' return longpath( self.get_default('blockmapdir', joinpath(self.basedir, 'blockmaps')))
def mountdir(self): ''' The default directory for mount points. ''' return longpath(self.get_default('mountdir'))
def basedir(self): ''' The default location for local archives and stores. ''' return longpath(self.get_default('basedir', DEFAULT_BASEDIR))