tiled.adapters.files.DirectoryAdapter¶
- class tiled.adapters.files.DirectoryAdapter(mapping, directory, index, subdirectory_trie, subdirectory_handler, watcher_thread_kill_switch, manual_trigger, metadata, specs, sorting, access_policy, entries_stale_after=None, metadata_stale_after=None, must_revalidate=True)[source]¶
An Adapter constructed by walking a directory and watching it for changes.
Examples
>>> DirecotryAdapter.from_directory("path/to/directory")
- __init__(mapping, directory, index, subdirectory_trie, subdirectory_handler, watcher_thread_kill_switch, manual_trigger, metadata, specs, sorting, access_policy, entries_stale_after=None, metadata_stale_after=None, must_revalidate=True)[source]¶
Create a simple Adapter from any mapping (e.g. dict, OneShotCachedMap).
- Parameters:
- mappingdict-like
- metadatadict, optional
- specsList[str], optional
- sortingList[Tuple[str, int]], optional
- specsList[str], optional
- access_policyAccessPolicy, optional
- entries_stale_after: timedelta
This server uses this to communite to the client how long it should rely on a local cache before checking back for changes.
- metadata_stale_after: timedelta
This server uses this to communite to the client how long it should rely on a local cache before checking back for changes.
- must_revalidatebool
Whether the client should strictly refresh stale cache items.
Methods
__init__(mapping, directory, index, ...[, ...])Create a simple Adapter from any mapping (e.g.
from_directory(directory, *[, ...])Construct a Adapter from a directory of files.
get(k[,d])get_distinct(metadata, structure_families, ...)items()keys()new_variation(*args, **kwargs)read([fields])register_query(class_, translator)register_query_lazy(toplevel, register)Register a registration function which will be called if the toplevel module (e.g.
search(query)Return a Adapter with a subset of the mapping.
shutdown_watcher()sort(sorting)update_now()Force an update and block until it completes.
values()Attributes
access_policybackground_tasksdirectoryentries_stale_afterentries_stale_atinclude_routersitems_indexerkeys_indexermetadataMetadata about this Adapter.
metadata_stale_aftermetadata_stale_atmust_revalidatequery_registrysortingspecsstructure_familyvalues_indexer