@@ -67,6 +67,10 @@ class Storage(metaclass=StorageMeta):
67
67
# The machine-readable name of this collection.
68
68
collection = None
69
69
70
+ #A value of False means storage does not support delete requests. A
71
+ #value of True mean the storage supports it.
72
+ no_delete = False
73
+
70
74
# A value of True means the storage does not support write-methods such as
71
75
# upload, update and delete. A value of False means the storage does
72
76
# support those methods.
@@ -75,13 +79,19 @@ class Storage(metaclass=StorageMeta):
75
79
# The attribute values to show in the representation of the storage.
76
80
_repr_attributes : list [str ] = []
77
81
78
- def __init__ (self , instance_name = None , read_only = None , collection = None ):
82
+ def __init__ (self , instance_name = None , read_only = None , no_delete = None , collection = None ):
79
83
if read_only is None :
80
84
read_only = self .read_only
81
85
if self .read_only and not read_only :
82
86
raise exceptions .UserError ("This storage can only be read-only." )
83
87
self .read_only = bool (read_only )
84
88
89
+ if no_delete is None :
90
+ no_delete = self .no_delete
91
+ if self .no_delete and not no_delete :
92
+ raise exceptions .UserError ("Nothing can be deleted in this storage." )
93
+ self .no_delete = bool (no_delete )
94
+
85
95
if collection and instance_name :
86
96
instance_name = f"{ instance_name } /{ collection } "
87
97
self .instance_name = instance_name
0 commit comments