File size: 1,730 Bytes
2fe2727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""Disabled local storage backend.

DocVault is intentionally HF-only in production deployments.
"""

from server.storage.interface import StorageInterface


class LocalStorageManager(StorageInterface):
    """Raises immediately because local persistence is not allowed."""

    def __init__(self) -> None:
        raise RuntimeError(
            "Local storage is disabled. Set STORAGE_MODE=HF and configure Hugging Face Hub."
        )

    def create_folder(self, user_id, folder_path):
        raise RuntimeError("Local storage is disabled.")

    def upload_file(self, user_id, folder_path, filename, file_obj):
        raise RuntimeError("Local storage is disabled.")

    def delete_file(self, user_id, file_path):
        raise RuntimeError("Local storage is disabled.")

    def rename_file(self, user_id, file_path, new_name):
        raise RuntimeError("Local storage is disabled.")

    def delete_folder(self, user_id, folder_path):
        raise RuntimeError("Local storage is disabled.")

    def rename_folder(self, user_id, folder_path, new_name):
        raise RuntimeError("Local storage is disabled.")

    def download(self, user_id, file_path):
        raise RuntimeError("Local storage is disabled.")

    def list(self, user_id, prefix=""):
        raise RuntimeError("Local storage is disabled.")

    def exists(self, user_id, path):
        raise RuntimeError("Local storage is disabled.")

    def get_stats(self, user_id):
        raise RuntimeError("Local storage is disabled.")

    def get_history(self, user_id, path):
        raise RuntimeError("Local storage is disabled.")

    def restore(self, user_id, path, revision, as_copy=False):
        raise RuntimeError("Local storage is disabled.")