wfexs_backend.cache_handler
#
Module Contents#
Classes#
API#
- class wfexs_backend.cache_handler.CachedContent#
Bases:
typing.NamedTuple
- kind: wfexs_backend.common.ContentKind = None#
- path: pathlib.Path = None#
- metadata_array: Sequence[URIWithMetadata] = None#
- licences: Tuple[URIType, ...] = None#
- exception wfexs_backend.cache_handler.CacheHandlerException#
- exception wfexs_backend.cache_handler.CacheOfflineException#
- exception wfexs_backend.cache_handler.CacheHandlerSchemeException#
- class wfexs_backend.cache_handler.SchemeHandlerCacheHandler(cacheDir: pathlib.Path, schemeHandlers: Mapping[str, DocumentedProtocolFetcher] = dict())#
Initialization
- CACHE_METADATA_SCHEMA = 'cast(...)'#
- addRawSchemeHandlers(schemeHandlers: Mapping[str, DocumentedProtocolFetcher]) None #
- bypassSchemeHandler(scheme: str, handler: DocumentedStatefulProtocolFetcher | DocumentedProtocolFetcher, progs: wfexs_backend.common.ProgsMapping = dict(), setup_block: Mapping[str, Any] | None = None) None #
This method adds and overwrites a scheme handler, instantiating it if it is a stateful one.
- Parameters:
scheme
handler
- bypassSchemeHandlers(schemeHandlers: Mapping[str, DocumentedStatefulProtocolFetcher | DocumentedProtocolFetcher]) None #
- instantiateStatefulFetcher(statefulFetcher: Type[StatefulFetcher], progs: wfexs_backend.common.ProgsMapping = dict(), setup_block: Mapping[str, Any] | None = None) wfexs_backend.fetchers.StatefulFetcher #
Method to instantiate stateful fetchers
- _genUriMetaCachedFilename(hashDir: pathlib.Path, the_remote_file: wfexs_backend.common.URIType) Tuple[pathlib.Path, RelPath, pathlib.Path] #
- static getHashDir(destdir: pathlib.Path) pathlib.Path #
- _parseMetaStructure(fMeta: pathlib.Path, validate_meta: bool = False) wfexs_backend.cache_handler.CacheMetadataDict #
Parse cache metadata structure, with optional validation
- list(*args: str, destdir: pathlib.Path | None = None, acceptGlob: bool = False, cascade: bool = False) Iterator[Tuple[LicensedURI, CacheMetadataDict]] #
This method iterates over the list of metadata entries, using glob patterns if requested
- remove(*args: str, destdir: pathlib.Path | None = None, doRemoveFiles: bool = False, acceptGlob: bool = False, cascade: bool = False) Iterator[Tuple[LicensedURI, pathlib.Path, pathlib.Path | None]] #
This method iterates elements from metadata entries, and optionally the cached value
- inject(the_remote_file: LicensedURI | urllib.parse.ParseResult | URIType, destdir: pathlib.Path | None = None, fetched_metadata_array: Sequence[URIWithMetadata] | None = None, finalCachedFilename: pathlib.Path | None = None, tempCachedFilename: pathlib.Path | None = None, inputKind: ContentKind | None = None, clonable: bool = True) Tuple[pathlib.Path | None, Fingerprint | None] #
- _inject(hashDir: pathlib.Path, the_remote_file: LicensedURI | urllib.parse.ParseResult | URIType, destdir: pathlib.Path, fetched_metadata_array: Sequence[URIWithMetadata] | None = None, finalCachedFilename: pathlib.Path | None = None, tempCachedFilename: pathlib.Path | None = None, inputKind: ContentKind | AnyURI | Sequence[AnyURI] | None = None, clonable: bool = True) Tuple[pathlib.Path | None, Fingerprint | None] #
This method has been created to be able to inject a cached metadata entry
- validate(*args: str, destdir: pathlib.Path | None = None, acceptGlob: bool = False, cascade: bool = False) Iterator[Tuple[LicensedURI, bool, CacheMetadataDict | None]] #
- fetch(remote_file: AnyURI | urllib.parse.ParseResult | Sequence[AnyURI] | Sequence[urllib.parse.ParseResult], offline: bool, destdir: pathlib.Path | None = None, ignoreCache: bool = False, registerInCache: bool = True, vault: SecurityContextVault | None = None, sec_context_name: str | None = None, default_clonable: bool = True) wfexs_backend.cache_handler.CachedContent #