paul@1069 | 1 | #!/usr/bin/env python |
paul@1069 | 2 | |
paul@1069 | 3 | """ |
paul@1069 | 4 | General support for calendar data storage. |
paul@1069 | 5 | |
paul@1069 | 6 | Copyright (C) 2014, 2015, 2016 Paul Boddie <paul@boddie.org.uk> |
paul@1069 | 7 | |
paul@1069 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@1069 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@1069 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@1069 | 11 | version. |
paul@1069 | 12 | |
paul@1069 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@1069 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@1069 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@1069 | 16 | details. |
paul@1069 | 17 | |
paul@1069 | 18 | You should have received a copy of the GNU General Public License along with |
paul@1069 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@1069 | 20 | """ |
paul@1069 | 21 | |
paul@1069 | 22 | class StoreBase: |
paul@1069 | 23 | |
paul@1069 | 24 | "The core operations of a data store." |
paul@1069 | 25 | |
paul@1069 | 26 | def acquire_lock(self, user, timeout=None): |
paul@1069 | 27 | pass |
paul@1069 | 28 | |
paul@1069 | 29 | def release_lock(self, user): |
paul@1069 | 30 | pass |
paul@1069 | 31 | |
paul@1069 | 32 | # User discovery. |
paul@1069 | 33 | |
paul@1069 | 34 | def get_users(self): |
paul@1069 | 35 | |
paul@1069 | 36 | "Return a list of users." |
paul@1069 | 37 | |
paul@1069 | 38 | pass |
paul@1069 | 39 | |
paul@1069 | 40 | # Event and event metadata access. |
paul@1069 | 41 | |
paul@1069 | 42 | def get_events(self, user): |
paul@1069 | 43 | |
paul@1069 | 44 | "Return a list of event identifiers." |
paul@1069 | 45 | |
paul@1069 | 46 | pass |
paul@1069 | 47 | |
paul@1069 | 48 | def get_all_events(self, user): |
paul@1069 | 49 | |
paul@1069 | 50 | "Return a set of (uid, recurrenceid) tuples for all events." |
paul@1069 | 51 | |
paul@1069 | 52 | uids = self.get_events(user) |
paul@1069 | 53 | if not uids: |
paul@1069 | 54 | return set() |
paul@1069 | 55 | |
paul@1069 | 56 | all_events = set() |
paul@1069 | 57 | for uid in uids: |
paul@1069 | 58 | all_events.add((uid, None)) |
paul@1069 | 59 | all_events.update([(uid, recurrenceid) for recurrenceid in self.get_recurrences(user, uid)]) |
paul@1069 | 60 | |
paul@1069 | 61 | return all_events |
paul@1069 | 62 | |
paul@1069 | 63 | def get_event(self, user, uid, recurrenceid=None, dirname=None): |
paul@1069 | 64 | |
paul@1069 | 65 | """ |
paul@1069 | 66 | Get the event for the given 'user' with the given 'uid'. If |
paul@1069 | 67 | the optional 'recurrenceid' is specified, a specific instance or |
paul@1069 | 68 | occurrence of an event is returned. |
paul@1069 | 69 | """ |
paul@1069 | 70 | |
paul@1069 | 71 | pass |
paul@1069 | 72 | |
paul@1069 | 73 | def get_complete_event(self, user, uid): |
paul@1069 | 74 | |
paul@1069 | 75 | "Get the event for the given 'user' with the given 'uid'." |
paul@1069 | 76 | |
paul@1069 | 77 | pass |
paul@1069 | 78 | |
paul@1069 | 79 | def set_event(self, user, uid, recurrenceid, node): |
paul@1069 | 80 | |
paul@1069 | 81 | """ |
paul@1069 | 82 | Set an event for 'user' having the given 'uid' and 'recurrenceid' (which |
paul@1069 | 83 | if the latter is specified, a specific instance or occurrence of an |
paul@1069 | 84 | event is referenced), using the given 'node' description. |
paul@1069 | 85 | """ |
paul@1069 | 86 | |
paul@1069 | 87 | if recurrenceid: |
paul@1069 | 88 | return self.set_recurrence(user, uid, recurrenceid, node) |
paul@1069 | 89 | else: |
paul@1069 | 90 | return self.set_complete_event(user, uid, node) |
paul@1069 | 91 | |
paul@1069 | 92 | def set_complete_event(self, user, uid, node): |
paul@1069 | 93 | |
paul@1069 | 94 | "Set an event for 'user' having the given 'uid' and 'node'." |
paul@1069 | 95 | |
paul@1069 | 96 | pass |
paul@1069 | 97 | |
paul@1069 | 98 | def remove_event(self, user, uid, recurrenceid=None): |
paul@1069 | 99 | |
paul@1069 | 100 | """ |
paul@1069 | 101 | Remove an event for 'user' having the given 'uid'. If the optional |
paul@1069 | 102 | 'recurrenceid' is specified, a specific instance or occurrence of an |
paul@1069 | 103 | event is removed. |
paul@1069 | 104 | """ |
paul@1069 | 105 | |
paul@1069 | 106 | if recurrenceid: |
paul@1069 | 107 | return self.remove_recurrence(user, uid, recurrenceid) |
paul@1069 | 108 | else: |
paul@1069 | 109 | for recurrenceid in self.get_recurrences(user, uid) or []: |
paul@1069 | 110 | self.remove_recurrence(user, uid, recurrenceid) |
paul@1069 | 111 | return self.remove_complete_event(user, uid) |
paul@1069 | 112 | |
paul@1069 | 113 | def remove_complete_event(self, user, uid): |
paul@1069 | 114 | |
paul@1069 | 115 | "Remove an event for 'user' having the given 'uid'." |
paul@1069 | 116 | |
paul@1069 | 117 | self.remove_recurrences(user, uid) |
paul@1069 | 118 | return self.remove_parent_event(user, uid) |
paul@1069 | 119 | |
paul@1069 | 120 | def remove_parent_event(self, user, uid): |
paul@1069 | 121 | |
paul@1069 | 122 | "Remove the parent event for 'user' having the given 'uid'." |
paul@1069 | 123 | |
paul@1069 | 124 | pass |
paul@1069 | 125 | |
paul@1069 | 126 | def get_recurrences(self, user, uid): |
paul@1069 | 127 | |
paul@1069 | 128 | """ |
paul@1069 | 129 | Get additional event instances for an event of the given 'user' with the |
paul@1069 | 130 | indicated 'uid'. Both active and cancelled recurrences are returned. |
paul@1069 | 131 | """ |
paul@1069 | 132 | |
paul@1069 | 133 | return self.get_active_recurrences(user, uid) + self.get_cancelled_recurrences(user, uid) |
paul@1069 | 134 | |
paul@1069 | 135 | def get_active_recurrences(self, user, uid): |
paul@1069 | 136 | |
paul@1069 | 137 | """ |
paul@1069 | 138 | Get additional event instances for an event of the given 'user' with the |
paul@1069 | 139 | indicated 'uid'. Cancelled recurrences are not returned. |
paul@1069 | 140 | """ |
paul@1069 | 141 | |
paul@1069 | 142 | pass |
paul@1069 | 143 | |
paul@1069 | 144 | def get_cancelled_recurrences(self, user, uid): |
paul@1069 | 145 | |
paul@1069 | 146 | """ |
paul@1069 | 147 | Get additional event instances for an event of the given 'user' with the |
paul@1069 | 148 | indicated 'uid'. Only cancelled recurrences are returned. |
paul@1069 | 149 | """ |
paul@1069 | 150 | |
paul@1069 | 151 | pass |
paul@1069 | 152 | |
paul@1069 | 153 | def get_recurrence(self, user, uid, recurrenceid): |
paul@1069 | 154 | |
paul@1069 | 155 | """ |
paul@1069 | 156 | For the event of the given 'user' with the given 'uid', return the |
paul@1069 | 157 | specific recurrence indicated by the 'recurrenceid'. |
paul@1069 | 158 | """ |
paul@1069 | 159 | |
paul@1069 | 160 | pass |
paul@1069 | 161 | |
paul@1069 | 162 | def set_recurrence(self, user, uid, recurrenceid, node): |
paul@1069 | 163 | |
paul@1069 | 164 | "Set an event for 'user' having the given 'uid' and 'node'." |
paul@1069 | 165 | |
paul@1069 | 166 | pass |
paul@1069 | 167 | |
paul@1069 | 168 | def remove_recurrence(self, user, uid, recurrenceid): |
paul@1069 | 169 | |
paul@1069 | 170 | """ |
paul@1069 | 171 | Remove a special recurrence from an event stored by 'user' having the |
paul@1069 | 172 | given 'uid' and 'recurrenceid'. |
paul@1069 | 173 | """ |
paul@1069 | 174 | |
paul@1069 | 175 | pass |
paul@1069 | 176 | |
paul@1069 | 177 | def remove_recurrences(self, user, uid): |
paul@1069 | 178 | |
paul@1069 | 179 | """ |
paul@1069 | 180 | Remove all recurrences for an event stored by 'user' having the given |
paul@1069 | 181 | 'uid'. |
paul@1069 | 182 | """ |
paul@1069 | 183 | |
paul@1069 | 184 | for recurrenceid in self.get_recurrences(user, uid): |
paul@1069 | 185 | self.remove_recurrence(user, uid, recurrenceid) |
paul@1069 | 186 | |
paul@1069 | 187 | return self.remove_recurrence_collection(user, uid) |
paul@1069 | 188 | |
paul@1069 | 189 | def remove_recurrence_collection(self, user, uid): |
paul@1069 | 190 | |
paul@1069 | 191 | """ |
paul@1069 | 192 | Remove the collection of recurrences stored by 'user' having the given |
paul@1069 | 193 | 'uid'. |
paul@1069 | 194 | """ |
paul@1069 | 195 | |
paul@1069 | 196 | pass |
paul@1069 | 197 | |
paul@1069 | 198 | # Free/busy period providers, upon extension of the free/busy records. |
paul@1069 | 199 | |
paul@1069 | 200 | def get_freebusy_providers(self, user, dt=None): |
paul@1069 | 201 | |
paul@1069 | 202 | """ |
paul@1069 | 203 | Return a set of uncancelled events of the form (uid, recurrenceid) |
paul@1069 | 204 | providing free/busy details beyond the given datetime 'dt'. |
paul@1069 | 205 | |
paul@1069 | 206 | If 'dt' is not specified, all events previously found to provide |
paul@1069 | 207 | details will be returned. Otherwise, if 'dt' is earlier than the |
paul@1069 | 208 | datetime recorded for the known providers, None is returned, indicating |
paul@1069 | 209 | that the list of providers must be recomputed. |
paul@1069 | 210 | |
paul@1069 | 211 | This function returns a list of (uid, recurrenceid) tuples upon success. |
paul@1069 | 212 | """ |
paul@1069 | 213 | |
paul@1069 | 214 | pass |
paul@1069 | 215 | |
paul@1069 | 216 | def set_freebusy_providers(self, user, dt, providers): |
paul@1069 | 217 | |
paul@1069 | 218 | """ |
paul@1069 | 219 | Define the uncancelled events providing free/busy details beyond the |
paul@1069 | 220 | given datetime 'dt'. |
paul@1069 | 221 | """ |
paul@1069 | 222 | |
paul@1069 | 223 | pass |
paul@1069 | 224 | |
paul@1069 | 225 | def append_freebusy_provider(self, user, provider): |
paul@1069 | 226 | |
paul@1069 | 227 | "For the given 'user', append the free/busy 'provider'." |
paul@1069 | 228 | |
paul@1069 | 229 | pass |
paul@1069 | 230 | |
paul@1069 | 231 | def remove_freebusy_provider(self, user, provider): |
paul@1069 | 232 | |
paul@1069 | 233 | "For the given 'user', remove the free/busy 'provider'." |
paul@1069 | 234 | |
paul@1069 | 235 | pass |
paul@1069 | 236 | |
paul@1069 | 237 | # Free/busy period access. |
paul@1069 | 238 | |
paul@1069 | 239 | def get_freebusy(self, user, name=None): |
paul@1069 | 240 | |
paul@1069 | 241 | "Get free/busy details for the given 'user'." |
paul@1069 | 242 | |
paul@1069 | 243 | pass |
paul@1069 | 244 | |
paul@1069 | 245 | def get_freebusy_for_other(self, user, other): |
paul@1069 | 246 | |
paul@1069 | 247 | "For the given 'user', get free/busy details for the 'other' user." |
paul@1069 | 248 | |
paul@1069 | 249 | pass |
paul@1069 | 250 | |
paul@1071 | 251 | def get_freebusy_for_update(self, user, name=None): |
paul@1071 | 252 | |
paul@1071 | 253 | "Get free/busy details for the given 'user'." |
paul@1071 | 254 | |
paul@1071 | 255 | pass |
paul@1071 | 256 | |
paul@1071 | 257 | def get_freebusy_for_other_for_update(self, user, other): |
paul@1071 | 258 | |
paul@1071 | 259 | "For the given 'user', get free/busy details for the 'other' user." |
paul@1071 | 260 | |
paul@1071 | 261 | pass |
paul@1071 | 262 | |
paul@1069 | 263 | def set_freebusy(self, user, freebusy, name=None): |
paul@1069 | 264 | |
paul@1069 | 265 | "For the given 'user', set 'freebusy' details." |
paul@1069 | 266 | |
paul@1069 | 267 | pass |
paul@1069 | 268 | |
paul@1069 | 269 | def set_freebusy_for_other(self, user, freebusy, other): |
paul@1069 | 270 | |
paul@1069 | 271 | "For the given 'user', set 'freebusy' details for the 'other' user." |
paul@1069 | 272 | |
paul@1069 | 273 | pass |
paul@1069 | 274 | |
paul@1069 | 275 | # Tentative free/busy periods related to countering. |
paul@1069 | 276 | |
paul@1069 | 277 | def get_freebusy_offers(self, user): |
paul@1069 | 278 | |
paul@1069 | 279 | "Get free/busy offers for the given 'user'." |
paul@1069 | 280 | |
paul@1069 | 281 | pass |
paul@1069 | 282 | |
paul@1071 | 283 | def get_freebusy_offers_for_update(self, user): |
paul@1071 | 284 | |
paul@1071 | 285 | "Get free/busy offers for the given 'user'." |
paul@1071 | 286 | |
paul@1071 | 287 | pass |
paul@1071 | 288 | |
paul@1069 | 289 | def set_freebusy_offers(self, user, freebusy): |
paul@1069 | 290 | |
paul@1069 | 291 | "For the given 'user', set 'freebusy' offers." |
paul@1069 | 292 | |
paul@1069 | 293 | return self.set_freebusy(user, freebusy, "freebusy-offers") |
paul@1069 | 294 | |
paul@1069 | 295 | # Requests and counter-proposals. |
paul@1069 | 296 | |
paul@1069 | 297 | def get_requests(self, user): |
paul@1069 | 298 | |
paul@1069 | 299 | "Get requests for the given 'user'." |
paul@1069 | 300 | |
paul@1069 | 301 | pass |
paul@1069 | 302 | |
paul@1069 | 303 | def set_requests(self, user, requests): |
paul@1069 | 304 | |
paul@1069 | 305 | "For the given 'user', set the list of queued 'requests'." |
paul@1069 | 306 | |
paul@1069 | 307 | pass |
paul@1069 | 308 | |
paul@1069 | 309 | def set_request(self, user, uid, recurrenceid=None, type=None): |
paul@1069 | 310 | |
paul@1069 | 311 | """ |
paul@1069 | 312 | For the given 'user', set the queued 'uid' and 'recurrenceid', |
paul@1069 | 313 | indicating a request, along with any given 'type'. |
paul@1069 | 314 | """ |
paul@1069 | 315 | |
paul@1069 | 316 | pass |
paul@1069 | 317 | |
paul@1069 | 318 | def queue_request(self, user, uid, recurrenceid=None, type=None): |
paul@1069 | 319 | |
paul@1069 | 320 | """ |
paul@1069 | 321 | Queue a request for 'user' having the given 'uid'. If the optional |
paul@1069 | 322 | 'recurrenceid' is specified, the entry refers to a specific instance |
paul@1069 | 323 | or occurrence of an event. The 'type' parameter can be used to indicate |
paul@1069 | 324 | a specific type of request. |
paul@1069 | 325 | """ |
paul@1069 | 326 | |
paul@1069 | 327 | requests = self.get_requests(user) or [] |
paul@1069 | 328 | |
paul@1069 | 329 | if not self.have_request(requests, uid, recurrenceid): |
paul@1069 | 330 | return self.set_request(user, uid, recurrenceid, type) |
paul@1069 | 331 | |
paul@1069 | 332 | return False |
paul@1069 | 333 | |
paul@1069 | 334 | def dequeue_request(self, user, uid, recurrenceid=None): |
paul@1069 | 335 | |
paul@1069 | 336 | """ |
paul@1069 | 337 | Dequeue all requests for 'user' having the given 'uid'. If the optional |
paul@1069 | 338 | 'recurrenceid' is specified, all requests for that specific instance or |
paul@1069 | 339 | occurrence of an event are dequeued. |
paul@1069 | 340 | """ |
paul@1069 | 341 | |
paul@1069 | 342 | requests = self.get_requests(user) or [] |
paul@1069 | 343 | result = [] |
paul@1069 | 344 | |
paul@1069 | 345 | for request in requests: |
paul@1069 | 346 | if request[:2] != (uid, recurrenceid): |
paul@1069 | 347 | result.append(request) |
paul@1069 | 348 | |
paul@1069 | 349 | self.set_requests(user, result) |
paul@1069 | 350 | return True |
paul@1069 | 351 | |
paul@1069 | 352 | def has_request(self, user, uid, recurrenceid=None, type=None, strict=False): |
paul@1069 | 353 | return self.have_request(self.get_requests(user) or [], uid, recurrenceid, type, strict) |
paul@1069 | 354 | |
paul@1069 | 355 | def have_request(self, requests, uid, recurrenceid=None, type=None, strict=False): |
paul@1069 | 356 | |
paul@1069 | 357 | """ |
paul@1069 | 358 | Return whether 'requests' contains a request with the given 'uid' and |
paul@1069 | 359 | any specified 'recurrenceid' and 'type'. If 'strict' is set to a true |
paul@1069 | 360 | value, the precise type of the request must match; otherwise, any type |
paul@1069 | 361 | of request for the identified object may be matched. |
paul@1069 | 362 | """ |
paul@1069 | 363 | |
paul@1069 | 364 | for request in requests: |
paul@1069 | 365 | if request[:2] == (uid, recurrenceid) and ( |
paul@1069 | 366 | not strict or |
paul@1069 | 367 | not request[2:] and not type or |
paul@1069 | 368 | request[2:] and request[2] == type): |
paul@1069 | 369 | |
paul@1069 | 370 | return True |
paul@1069 | 371 | |
paul@1069 | 372 | return False |
paul@1069 | 373 | |
paul@1069 | 374 | def get_counters(self, user, uid, recurrenceid=None): |
paul@1069 | 375 | |
paul@1069 | 376 | """ |
paul@1069 | 377 | For the given 'user', return a list of users from whom counter-proposals |
paul@1069 | 378 | have been received for the given 'uid' and optional 'recurrenceid'. |
paul@1069 | 379 | """ |
paul@1069 | 380 | |
paul@1069 | 381 | pass |
paul@1069 | 382 | |
paul@1069 | 383 | def get_counter(self, user, other, uid, recurrenceid=None): |
paul@1069 | 384 | |
paul@1069 | 385 | """ |
paul@1069 | 386 | For the given 'user', return the counter-proposal from 'other' for the |
paul@1069 | 387 | given 'uid' and optional 'recurrenceid'. |
paul@1069 | 388 | """ |
paul@1069 | 389 | |
paul@1069 | 390 | pass |
paul@1069 | 391 | |
paul@1069 | 392 | def set_counter(self, user, other, node, uid, recurrenceid=None): |
paul@1069 | 393 | |
paul@1069 | 394 | """ |
paul@1069 | 395 | For the given 'user', store a counter-proposal received from 'other' the |
paul@1069 | 396 | given 'node' representing that proposal for the given 'uid' and |
paul@1069 | 397 | 'recurrenceid'. |
paul@1069 | 398 | """ |
paul@1069 | 399 | |
paul@1069 | 400 | pass |
paul@1069 | 401 | |
paul@1069 | 402 | def remove_counters(self, user, uid, recurrenceid=None): |
paul@1069 | 403 | |
paul@1069 | 404 | """ |
paul@1069 | 405 | For the given 'user', remove all counter-proposals associated with the |
paul@1069 | 406 | given 'uid' and 'recurrenceid'. |
paul@1069 | 407 | """ |
paul@1069 | 408 | |
paul@1069 | 409 | pass |
paul@1069 | 410 | |
paul@1069 | 411 | def remove_counter(self, user, other, uid, recurrenceid=None): |
paul@1069 | 412 | |
paul@1069 | 413 | """ |
paul@1069 | 414 | For the given 'user', remove any counter-proposal from 'other' |
paul@1069 | 415 | associated with the given 'uid' and 'recurrenceid'. |
paul@1069 | 416 | """ |
paul@1069 | 417 | |
paul@1069 | 418 | pass |
paul@1069 | 419 | |
paul@1069 | 420 | # Event cancellation. |
paul@1069 | 421 | |
paul@1069 | 422 | def cancel_event(self, user, uid, recurrenceid=None): |
paul@1069 | 423 | |
paul@1069 | 424 | """ |
paul@1069 | 425 | Cancel an event for 'user' having the given 'uid'. If the optional |
paul@1069 | 426 | 'recurrenceid' is specified, a specific instance or occurrence of an |
paul@1069 | 427 | event is cancelled. |
paul@1069 | 428 | """ |
paul@1069 | 429 | |
paul@1069 | 430 | pass |
paul@1069 | 431 | |
paul@1069 | 432 | def uncancel_event(self, user, uid, recurrenceid=None): |
paul@1069 | 433 | |
paul@1069 | 434 | """ |
paul@1069 | 435 | Uncancel an event for 'user' having the given 'uid'. If the optional |
paul@1069 | 436 | 'recurrenceid' is specified, a specific instance or occurrence of an |
paul@1069 | 437 | event is uncancelled. |
paul@1069 | 438 | """ |
paul@1069 | 439 | |
paul@1069 | 440 | pass |
paul@1069 | 441 | |
paul@1069 | 442 | def remove_cancellations(self, user, uid, recurrenceid=None): |
paul@1069 | 443 | |
paul@1069 | 444 | """ |
paul@1069 | 445 | Remove cancellations for 'user' for any event having the given 'uid'. If |
paul@1069 | 446 | the optional 'recurrenceid' is specified, a specific instance or |
paul@1069 | 447 | occurrence of an event is affected. |
paul@1069 | 448 | """ |
paul@1069 | 449 | |
paul@1069 | 450 | # Remove all recurrence cancellations if a general event is indicated. |
paul@1069 | 451 | |
paul@1069 | 452 | if not recurrenceid: |
paul@1069 | 453 | for _recurrenceid in self.get_cancelled_recurrences(user, uid): |
paul@1069 | 454 | self.remove_cancellation(user, uid, _recurrenceid) |
paul@1069 | 455 | |
paul@1069 | 456 | return self.remove_cancellation(user, uid, recurrenceid) |
paul@1069 | 457 | |
paul@1069 | 458 | def remove_cancellation(self, user, uid, recurrenceid=None): |
paul@1069 | 459 | |
paul@1069 | 460 | """ |
paul@1069 | 461 | Remove a cancellation for 'user' for the event having the given 'uid'. |
paul@1069 | 462 | If the optional 'recurrenceid' is specified, a specific instance or |
paul@1069 | 463 | occurrence of an event is affected. |
paul@1069 | 464 | """ |
paul@1069 | 465 | |
paul@1069 | 466 | pass |
paul@1069 | 467 | |
paul@1069 | 468 | class PublisherBase: |
paul@1069 | 469 | |
paul@1069 | 470 | "The core operations of a data publisher." |
paul@1069 | 471 | |
paul@1069 | 472 | def set_freebusy(self, user, freebusy): |
paul@1069 | 473 | |
paul@1069 | 474 | "For the given 'user', set 'freebusy' details." |
paul@1069 | 475 | |
paul@1069 | 476 | pass |
paul@1069 | 477 | |
paul@1069 | 478 | class JournalBase: |
paul@1069 | 479 | |
paul@1069 | 480 | "The core operations of a journal system supporting quotas." |
paul@1069 | 481 | |
paul@1069 | 482 | # Quota and user identity/group discovery. |
paul@1069 | 483 | |
paul@1069 | 484 | def get_quotas(self): |
paul@1069 | 485 | |
paul@1069 | 486 | "Return a list of quotas." |
paul@1069 | 487 | |
paul@1069 | 488 | pass |
paul@1069 | 489 | |
paul@1069 | 490 | def get_quota_users(self, quota): |
paul@1069 | 491 | |
paul@1069 | 492 | "Return a list of quota users." |
paul@1069 | 493 | |
paul@1069 | 494 | pass |
paul@1069 | 495 | |
paul@1069 | 496 | # Groups of users sharing quotas. |
paul@1069 | 497 | |
paul@1069 | 498 | def get_groups(self, quota): |
paul@1069 | 499 | |
paul@1069 | 500 | "Return the identity mappings for the given 'quota' as a dictionary." |
paul@1069 | 501 | |
paul@1069 | 502 | pass |
paul@1069 | 503 | |
paul@1069 | 504 | def get_limits(self, quota): |
paul@1069 | 505 | |
paul@1069 | 506 | """ |
paul@1069 | 507 | Return the limits for the 'quota' as a dictionary mapping identities or |
paul@1069 | 508 | groups to durations. |
paul@1069 | 509 | """ |
paul@1069 | 510 | |
paul@1069 | 511 | pass |
paul@1069 | 512 | |
paul@1069 | 513 | # Free/busy period access for users within quota groups. |
paul@1069 | 514 | |
paul@1069 | 515 | def get_freebusy(self, quota, user): |
paul@1069 | 516 | |
paul@1069 | 517 | "Get free/busy details for the given 'quota' and 'user'." |
paul@1069 | 518 | |
paul@1069 | 519 | pass |
paul@1069 | 520 | |
paul@1071 | 521 | def get_freebusy_for_update(self, quota, user): |
paul@1071 | 522 | |
paul@1071 | 523 | "Get free/busy details for the given 'quota' and 'user'." |
paul@1071 | 524 | |
paul@1071 | 525 | pass |
paul@1071 | 526 | |
paul@1069 | 527 | def set_freebusy(self, quota, user, freebusy): |
paul@1069 | 528 | |
paul@1069 | 529 | "For the given 'quota' and 'user', set 'freebusy' details." |
paul@1069 | 530 | |
paul@1069 | 531 | pass |
paul@1069 | 532 | |
paul@1069 | 533 | # Journal entry methods. |
paul@1069 | 534 | |
paul@1069 | 535 | def get_entries(self, quota, group): |
paul@1069 | 536 | |
paul@1069 | 537 | """ |
paul@1069 | 538 | Return a list of journal entries for the given 'quota' for the indicated |
paul@1069 | 539 | 'group'. |
paul@1069 | 540 | """ |
paul@1069 | 541 | |
paul@1069 | 542 | pass |
paul@1069 | 543 | |
paul@1071 | 544 | def get_entries_for_update(self, quota, group): |
paul@1071 | 545 | |
paul@1071 | 546 | """ |
paul@1071 | 547 | Return a list of journal entries for the given 'quota' for the indicated |
paul@1071 | 548 | 'group'. |
paul@1071 | 549 | """ |
paul@1071 | 550 | |
paul@1071 | 551 | pass |
paul@1071 | 552 | |
paul@1069 | 553 | def set_entries(self, quota, group, entries): |
paul@1069 | 554 | |
paul@1069 | 555 | """ |
paul@1069 | 556 | For the given 'quota' and indicated 'group', set the list of journal |
paul@1069 | 557 | 'entries'. |
paul@1069 | 558 | """ |
paul@1069 | 559 | |
paul@1069 | 560 | pass |
paul@1069 | 561 | |
paul@1069 | 562 | # vim: tabstop=4 expandtab shiftwidth=4 |