示例#1
0
 def __init__(self, context=None):
     # last add in milliseconds - used in both async and cache key
     self._mtime = 0
     # cache buster in MICROseconds - used in cache key only
     self._ctime = 0
     # primary storage: (long statusid) -> (object IStatusUpdate)
     self._status_mapping = LOBTree.LOBTree()
     # archive deleted: (long statusid) -> (object IStatusUpdate)
     self._status_archive = LOBTree.LOBTree()
     # index by user: (string userid) -> (object TreeSet(long statusid))
     self._user_mapping = OOBTree.OOBTree()
     # index by tag: (string tag) -> (object TreeSet(long statusid))
     self._tag_mapping = OOBTree.OOBTree()
     # index by microblog_context:
     # (string UUID) -> (object TreeSet(long statusid))
     self._uuid_mapping = OOBTree.OOBTree()  # keep old name for backcompat
     # index by content_context:
     # (string UUID) -> (object TreeSet(long statusid))
     self._content_uuid_mapping = OOBTree.OOBTree()
     # index by thread (string UUID) -> (object TreeSet(long statusid))
     self._threadid_mapping = OOBTree.OOBTree()
     # index by mentions (string UUID) -> (object TreeSet(long statusid))
     self._mentions_mapping = OOBTree.OOBTree()
     # index all content updates: (object TreeSet(long statusid))
     self._is_content_mapping = LLBTree.LLTreeSet()
     # index all human updates: (object TreeSet(long statusid))
     self._is_human_mapping = LLBTree.LLTreeSet()
示例#2
0
def ondelete_archive(context):
    """
    Initialize archive for deleted statusupdates.
    Archive updates whose microblog_context or content_context
    has been deleted.
    """
    logger.info("ondelete_archive")
    tool = queryUtility(IMicroblogTool)
    if not hasattr(tool, '_status_archive'):
        logger.info("Adding missing status archive")
        tool._status_archive = LOBTree.LOBTree()
    to_cleanup = set()
    for (id, status) in tool.items(limit=None):
        uuid = status._content_context_uuid
        if uuid and not status._uuid2object(uuid):
            # postpone writing BTree while looping over its values
            to_cleanup.add(id)
        uuid = status._microblog_context_uuid
        if uuid and not status._uuid2object(uuid):
            # postpone writing BTree while looping over its values
            to_cleanup.add(id)
    i = 0
    for id in to_cleanup:
        tool.delete(id, restricted=False)
        i += 1
    logger.info("archived %s statusupdates with stale uuid references", i)
    commit()
 def __init__(self, context=None):
     self._mtime = 0
     # primary storage: (long statusid) -> (object IStatusUpdate)
     self._status_mapping = LOBTree.LOBTree()
     # index by user: (string userid) -> (object TreeSet(long statusid))
     self._user_mapping = OOBTree.OOBTree()
     # index by tag: (string tag) -> (object TreeSet(long statusid))
     self._tag_mapping = OOBTree.OOBTree()
     # index by context (string UUID) -> (object TreeSet(long statusid))
     self._uuid_mapping = OOBTree.OOBTree()
示例#4
0
 def __init__(self, context=None):
     # last write stamp in milliseconds
     self._mtime = 0
     # primary storage: (long statusid) -> (object IStatusUpdate)
     self._status_mapping = LOBTree.LOBTree()
     # index by user: (string userid) -> (object TreeSet(long statusid))
     self._user_mapping = OOBTree.OOBTree()
     # index by tag: (string tag) -> (object TreeSet(long statusid))
     self._tag_mapping = OOBTree.OOBTree()
     # index by context (string UUID) -> (object TreeSet(long statusid))
     self._uuid_mapping = OOBTree.OOBTree()
     # index by thread (string UUID) -> (object TreeSet(long statusid))
     self._threadid_mapping = OOBTree.OOBTree()
     # index by mentions (string UUID) -> (object TreeSet(long statusid))
     self._mentions_mapping = OOBTree.OOBTree()
示例#5
0
 def clear(self):
     """ Clears all the information stored
     """
     self._tree = LOBTree.LOBTree()
     self._count = Length(0)
示例#6
0
 def __init__(self):
     self._tree = LOBTree.LOBTree()
     self._count = Length(0)