Revision 58a6c894 pithos/backends/base.py
b/pithos/backends/base.py | ||
---|---|---|
44 | 44 |
'block_size': Suggested is 4MB |
45 | 45 |
""" |
46 | 46 |
|
47 |
def get_account_meta(self, account): |
|
47 |
def delete_account(self, account): |
|
48 |
"""Delete the account with the given name. |
|
49 |
|
|
50 |
Raises: |
|
51 |
IndexError: Account is not empty |
|
52 |
""" |
|
53 |
return |
|
54 |
|
|
55 |
def get_account_meta(self, account, until=None): |
|
48 | 56 |
"""Return a dictionary with the account metadata. |
49 | 57 |
|
50 | 58 |
The keys returned are all user-defined, except: |
51 | 59 |
'name': The account name |
52 | 60 |
'count': The number of containers (or 0) |
53 | 61 |
'bytes': The total data size (or 0) |
54 |
'modified': Last modification timestamp |
|
62 |
'modified': Last modification timestamp (overall) |
|
63 |
'until_timestamp': Last modification until the timestamp provided |
|
55 | 64 |
""" |
56 | 65 |
return {} |
57 | 66 |
|
... | ... | |
64 | 73 |
""" |
65 | 74 |
return |
66 | 75 |
|
67 |
def put_container(self, account, name): |
|
76 |
def list_containers(self, account, marker=None, limit=10000, until=None): |
|
77 |
"""Return a list of container (name, version_id) tuples existing under an account. |
|
78 |
|
|
79 |
Parameters: |
|
80 |
'marker': Start list from the next item after 'marker' |
|
81 |
'limit': Number of containers to return |
|
82 |
""" |
|
83 |
return [] |
|
84 |
|
|
85 |
def put_container(self, account, container): |
|
68 | 86 |
"""Create a new container with the given name. |
69 | 87 |
|
70 | 88 |
Raises: |
... | ... | |
72 | 90 |
""" |
73 | 91 |
return |
74 | 92 |
|
75 |
def delete_container(self, account, name):
|
|
93 |
def delete_container(self, account, container):
|
|
76 | 94 |
"""Delete the container with the given name. |
77 | 95 |
|
78 | 96 |
Raises: |
... | ... | |
81 | 99 |
""" |
82 | 100 |
return |
83 | 101 |
|
84 |
def get_container_meta(self, account, name):
|
|
102 |
def get_container_meta(self, account, container, until=None):
|
|
85 | 103 |
"""Return a dictionary with the container metadata. |
86 | 104 |
|
87 | 105 |
The keys returned are all user-defined, except: |
88 | 106 |
'name': The container name |
89 | 107 |
'count': The number of objects |
90 | 108 |
'bytes': The total data size |
91 |
'created': Creation timestamp
|
|
92 |
'modified': Last modification timestamp
|
|
109 |
'modified': Last modification timestamp (overall)
|
|
110 |
'until_timestamp': Last modification until the timestamp provided
|
|
93 | 111 |
|
94 | 112 |
Raises: |
95 | 113 |
NameError: Container does not exist |
96 | 114 |
""" |
97 | 115 |
return {} |
98 | 116 |
|
99 |
def update_container_meta(self, account, name, meta, replace=False):
|
|
117 |
def update_container_meta(self, account, container, meta, replace=False):
|
|
100 | 118 |
"""Update the metadata associated with the container. |
101 | 119 |
|
102 | 120 |
Parameters: |
... | ... | |
108 | 126 |
""" |
109 | 127 |
return |
110 | 128 |
|
111 |
def list_containers(self, account, marker=None, limit=10000): |
|
112 |
"""Return a list of containers existing under an account. |
|
113 |
|
|
114 |
Parameters: |
|
115 |
'marker': Start list from the next item after 'marker' |
|
116 |
'limit': Number of containers to return |
|
117 |
""" |
|
118 |
return [] |
|
119 |
|
|
120 |
def list_objects(self, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, keys=[]): |
|
121 |
"""Return a list of objects existing under a container. |
|
129 |
def list_objects(self, account, container, prefix='', delimiter=None, marker=None, limit=10000, virtual=True, keys=[], until=None): |
|
130 |
"""Return a list of object (name, version_id) tuples existing under a container. |
|
122 | 131 |
|
123 | 132 |
Parameters: |
124 | 133 |
'prefix': List objects starting with 'prefix' |
... | ... | |
137 | 146 |
""" |
138 | 147 |
return [] |
139 | 148 |
|
140 |
def list_object_meta(self, account, name):
|
|
149 |
def list_object_meta(self, account, container, until=None):
|
|
141 | 150 |
"""Return a list with all the container's object meta keys. |
142 | 151 |
|
143 | 152 |
Raises: |
... | ... | |
145 | 154 |
""" |
146 | 155 |
return [] |
147 | 156 |
|
148 |
def get_object_meta(self, account, container, name): |
|
157 |
def get_object_meta(self, account, container, name, version=None):
|
|
149 | 158 |
"""Return a dictionary with the object metadata. |
150 | 159 |
|
151 | 160 |
The keys returned are all user-defined, except: |
152 |
'name': The account name
|
|
161 |
'name': The object name
|
|
153 | 162 |
'bytes': The total data size |
154 |
'version': The latest version (zero if not versioned)
|
|
155 |
'created': Creation timestamp
|
|
156 |
'modified': Last modification timestamp
|
|
163 |
'modified': Last modification timestamp (overall)
|
|
164 |
'version': The version identifier
|
|
165 |
'version_timestamp': The version's modification timestamp
|
|
157 | 166 |
|
158 | 167 |
Raises: |
159 | 168 |
NameError: Container/object does not exist |
169 |
IndexError: Version does not exist |
|
160 | 170 |
""" |
161 | 171 |
return {} |
162 | 172 |
|
... | ... | |
164 | 174 |
"""Update the metadata associated with the object. |
165 | 175 |
|
166 | 176 |
Parameters: |
167 |
'meta': Dictionary with metadata to update.\ |
|
168 |
Use the 'versioned' key to control versioning |
|
177 |
'meta': Dictionary with metadata to update. |
|
169 | 178 |
'replace': Replace instead of update |
170 | 179 |
|
171 | 180 |
Raises: |
... | ... | |
186 | 195 |
"""Create/update an object with the specified size and partial hashes. |
187 | 196 |
|
188 | 197 |
Raises: |
189 |
NameError: Container/block does not exist
|
|
198 |
NameError: Container does not exist |
|
190 | 199 |
""" |
191 | 200 |
return |
192 | 201 |
|
193 |
def copy_object(self, account, src_container, src_name, dest_container, dest_name, dest_meta={}, replace_meta=False): |
|
202 |
def copy_object(self, account, src_container, src_name, dest_container, dest_name, dest_meta={}, replace_meta=False, src_version=None):
|
|
194 | 203 |
"""Copy an object's data and metadata. |
195 | 204 |
|
196 | 205 |
Parameters: |
197 | 206 |
'dest_meta': Dictionary with metadata to changes from source to destination |
198 | 207 |
'replace_meta': Replace metadata instead of update |
208 |
'src_version': Copy from the version provided. |
|
199 | 209 |
|
200 | 210 |
Raises: |
201 | 211 |
NameError: Container/object does not exist |
212 |
IndexError: Version does not exist |
|
202 | 213 |
""" |
203 | 214 |
return |
204 | 215 |
|
205 |
def move_object(self, account, src_container, src_name, dest_container, dest_name, dest_meta={}, replace_meta=False): |
|
216 |
def move_object(self, account, src_container, src_name, dest_container, dest_name, dest_meta={}, replace_meta=False, src_version=None):
|
|
206 | 217 |
"""Move an object's data and metadata. |
207 | 218 |
|
208 | 219 |
Parameters: |
209 | 220 |
'dest_meta': Dictionary with metadata to changes from source to destination |
210 | 221 |
'replace_meta': Replace metadata instead of update |
222 |
'src_version': Copy from the version provided. |
|
211 | 223 |
|
212 | 224 |
Raises: |
213 | 225 |
NameError: Container/object does not exist |
226 |
IndexError: Version does not exist |
|
214 | 227 |
""" |
215 | 228 |
return |
216 | 229 |
|
... | ... | |
222 | 235 |
""" |
223 | 236 |
return |
224 | 237 |
|
238 |
def list_versions(self, account, container, name): |
|
239 |
"""Return a list of version (version_id, version_modified) tuples for an object.""" |
|
240 |
return [] |
|
241 |
|
|
225 | 242 |
def get_block(self, hash): |
226 | 243 |
"""Return a block's data. |
227 | 244 |
|
Also available in: Unified diff