comparison sat_pubsub/memory_storage.py @ 265:89493845d3dd

fix the method signatures of iidavoll.ILeafNode and memory_storage.LeafNode according to pgsql_storage.LeafNode
author souliane <souliane@mailoo.org>
date Sat, 22 Feb 2014 08:04:09 +0100
parents 9dfd3890e646
children 002c59dbc23f
comparison
equal deleted inserted replaced
264:86e767dc6abb 265:89493845d3dd
261 Node.__init__(self, nodeIdentifier, owner, config) 261 Node.__init__(self, nodeIdentifier, owner, config)
262 self._items = {} 262 self._items = {}
263 self._itemlist = [] 263 self._itemlist = []
264 264
265 265
266 def storeItems(self, items, publisher): 266 def storeItems(self, item_data, publisher):
267 for element in items: 267 for access_model, item_config, element in item_data:
268 item = PublishedItem(element, publisher) 268 item = PublishedItem(element, publisher)
269 itemIdentifier = element["id"] 269 itemIdentifier = element["id"]
270 if itemIdentifier in self._items: 270 if itemIdentifier in self._items:
271 self._itemlist.remove(self._items[itemIdentifier]) 271 self._itemlist.remove(self._items[itemIdentifier])
272 self._items[itemIdentifier] = item 272 self._items[itemIdentifier] = item
289 deleted.append(itemIdentifier) 289 deleted.append(itemIdentifier)
290 290
291 return defer.succeed(deleted) 291 return defer.succeed(deleted)
292 292
293 293
294 def getItems(self, maxItems=None): 294 def getItems(self, authorized_groups, unrestricted, maxItems=None):
295 if maxItems: 295 if maxItems:
296 itemList = self._itemlist[-maxItems:] 296 itemList = self._itemlist[-maxItems:]
297 else: 297 else:
298 itemList = self._itemlist 298 itemList = self._itemlist
299 return defer.succeed([item.element for item in itemList]) 299 return defer.succeed([item.element for item in itemList])
300 300
301 301
302 def getItemsById(self, itemIdentifiers): 302 def getItemsById(self, authorized_groups, unrestricted, itemIdentifiers):
303 items = [] 303 items = []
304 for itemIdentifier in itemIdentifiers: 304 for itemIdentifier in itemIdentifiers:
305 try: 305 try:
306 item = self._items[itemIdentifier] 306 item = self._items[itemIdentifier]
307 except KeyError: 307 except KeyError: