def remote_storage_factory(): """A filetracker factory which creates a client that uses the remote server at ``settings.FILETRACKER_URL`` and a folder ``settings.FILETRACKER_CACHE_ROOT`` as a cache directory. """ return filetracker.Client(remote_url=settings.FILETRACKER_URL, cache_dir=settings.FILETRACKER_CACHE_ROOT)
def test_real_file_storage(self): dir = tempfile.mkdtemp() try: client = filetracker.Client(cache_dir=dir, remote_store=None) storage = FiletrackerStorage(client=client) self._test_file_storage(storage) finally: shutil.rmtree(dir)
def init_instance(filetracker_url): url_hash = get_url_hash(filetracker_url) lock.acquire() if not url_hash in ft_clients: ft_clients[url_hash] = \ filetracker.Client(remote_url=filetracker_url, cache_dir=get_cache_dir(filetracker_url)) util.threadlocal_dir.ft_client_instance = ft_clients[url_hash] lock.release()
def media_root_factory(): """A filetracker factory which sets up local client in ``settings.MEDIA_ROOT`` folder.""" return filetracker.Client(cache_dir=settings.MEDIA_ROOT, remote_store=None)
def remote_storage_factory(): """A filetracker factory which creates a client that uses only the remote server at ``settings.FILETRACKER_URL``. """ return filetracker.Client( remote_url=settings.FILETRACKER_URL, local_store=None)
def instance(): """Returns a singleton instance of :class:`filetracker.Client`.""" if getattr(util.threadlocal_dir, 'ft_client_instance', None) is None: launch_filetracker_server() util.threadlocal_dir.ft_client_instance = filetracker.Client() return util.threadlocal_dir.ft_client_instance