Revision 02c0c3fa pithos/backends/base.py

b/pithos/backends/base.py
42 42
    
43 43
    Note that the account level is always valid as it is checked from another subsystem.
44 44
    
45
    When not replacing metadata, keys with empty values should be deleted.
45
    When not replacing metadata/groups/policy, keys with empty values should be deleted.
46 46
    
47 47
    The following variables should be available:
48 48
        'hash_algorithm': Suggested is 'sha256'
49 49
        'block_size': Suggested is 4MB
50 50
    """
51 51
    
52
    def delete_account(self, user, account):
53
        """Delete the account with the given name.
54
        
55
        Raises:
56
            NotAllowedError: Operation not permitted
57
            IndexError: Account is not empty
58
        """
59
        return
60
    
61 52
    def get_account_meta(self, user, account, until=None):
62 53
        """Return a dictionary with the account metadata.
63 54
        
......
85 76
        """
86 77
        return
87 78
    
88
    def list_containers(self, user, account, marker=None, limit=10000, until=None):
89
        """Return a list of container (name, version_id) tuples existing under an account.
90
        
91
        Parameters:
92
            'marker': Start list from the next item after 'marker'
93
            'limit': Number of containers to return
79
    def get_account_groups(self, user, account):
80
        """Return a dictionary with the user groups defined for this account.
94 81
        
95 82
        Raises:
96 83
            NotAllowedError: Operation not permitted
97 84
        """
98
        return []
85
        return {}
99 86
    
100
    def put_container(self, user, account, container):
101
        """Create a new container with the given name.
87
    def update_account_groups(self, user, account, groups, replace=False):
88
        """Update the groups associated with the account.
102 89
        
103 90
        Raises:
104 91
            NotAllowedError: Operation not permitted
105
            NameError: Container already exists
92
            ValueError: Invalid data in groups
106 93
        """
107 94
        return
108 95
    
109
    def delete_container(self, user, account, container):
110
        """Delete the container with the given name.
96
    def delete_account(self, user, account):
97
        """Delete the account with the given name.
111 98
        
112 99
        Raises:
113 100
            NotAllowedError: Operation not permitted
114
            NameError: Container does not exist
115
            IndexError: Container is not empty
101
            IndexError: Account is not empty
116 102
        """
117 103
        return
118 104
    
105
    def list_containers(self, user, account, marker=None, limit=10000, until=None):
106
        """Return a list of container (name, version_id) tuples existing under an account.
107
        
108
        Parameters:
109
            'marker': Start list from the next item after 'marker'
110
            'limit': Number of containers to return
111
        
112
        Raises:
113
            NotAllowedError: Operation not permitted
114
        """
115
        return []
116
    
119 117
    def get_container_meta(self, user, account, container, until=None):
120 118
        """Return a dictionary with the container metadata.
121 119
        
......
145 143
        """
146 144
        return
147 145
    
146
    def get_container_policy(self, user, account, container):
147
        """Return a dictionary with the container policy.
148
        
149
        The keys returned are:
150
            'quota': The maximum bytes allowed (default is 0 - unlimited)
151
            'versioning': Can be 'auto', 'manual' or 'none' (default is 'manual')
152
        
153
        Raises:
154
            NotAllowedError: Operation not permitted
155
            NameError: Container does not exist
156
        """
157
        return {}
158
    
159
    def update_container_policy(self, user, account, container, policy, replace=False):
160
        """Update the policy associated with the account.
161
        
162
        Raises:
163
            NotAllowedError: Operation not permitted
164
            NameError: Container does not exist
165
            ValueError: Invalid policy defined
166
        """
167
        return
168
    
169
    def put_container(self, user, account, container, policy=None):
170
        """Create a new container with the given name.
171
        
172
        Raises:
173
            NotAllowedError: Operation not permitted
174
            NameError: Container already exists
175
            ValueError: Invalid policy defined
176
        """
177
        return
178
    
179
    def delete_container(self, user, account, container):
180
        """Delete the container with the given name.
181
        
182
        Raises:
183
            NotAllowedError: Operation not permitted
184
            NameError: Container does not exist
185
            IndexError: Container is not empty
186
        """
187
        return
188
    
148 189
    def list_objects(self, user, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, keys=[], until=None):
149 190
        """Return a list of object (name, version_id) tuples existing under a container.
150 191
        
......
237 278
        """
238 279
        return
239 280
    
281
    def get_object_public(self, user, account, container, name):
282
        """Return the public URL of the object if applicable.
283
        
284
        Raises:
285
            NotAllowedError: Operation not permitted
286
            NameError: Container/object does not exist
287
        """
288
        return None
289
    
290
    def update_object_public(self, user, account, container, name, public):
291
        """Update the public status of the object.
292
        
293
        Parameters:
294
            'public': Boolean value
295
        
296
        Raises:
297
            NotAllowedError: Operation not permitted
298
            NameError: Container/object does not exist
299
        """
300
        return
301
    
240 302
    def get_object_hashmap(self, user, account, container, name, version=None):
241 303
        """Return the object's size and a list with partial hashes.
242 304
        

Also available in: Unified diff