1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-09-15 20:36:55 +00:00

use_cache_subfolder_for_item: feature

This commit is contained in:
Peter Bieringer 2024-12-03 21:32:57 +01:00
parent f754f28518
commit 0fe53e62db
5 changed files with 17 additions and 6 deletions

View file

@ -70,6 +70,7 @@ class StorageBase(storage.BaseStorage):
_filesystem_folder: str
_filesystem_fsync: bool
_use_cache_subfolder_for_item: bool
def __init__(self, configuration: config.Configuration) -> None:
super().__init__(configuration)
@ -77,10 +78,17 @@ class StorageBase(storage.BaseStorage):
"storage", "filesystem_folder")
self._filesystem_fsync = configuration.get(
"storage", "_filesystem_fsync")
self._use_cache_subfolder_for_item = configuration.get(
"storage", "use_cache_subfolder_for_item")
def _get_collection_root_folder(self) -> str:
return os.path.join(self._filesystem_folder, "collection-root")
def _get_collection_cache_folder(self, path, folder, subfolder) -> str:
if self._use_cache_subfolder_for_item == True and subfolder == "item":
path = path.replace(os.path.join(self._filesystem_folder, "collection-root"), os.path.join(self._filesystem_folder, "collection-cache"))
return os.path.join(path, folder, subfolder)
def _fsync(self, f: IO[AnyStr]) -> None:
if self._filesystem_fsync:
try: