Esempio n. 1
0
 def getMaKaCInfoInstance(cls):
     dbmgr = DBMgr.getInstance()
     root = dbmgr.getDBConnection().root()
     try:
         minfo = root["MaKaCInfo"]["main"]
     except KeyError, e:
         minfo = MaKaCInfo()
         root["MaKaCInfo"] = OOBTree.OOBTree()
         root["MaKaCInfo"]["main"] = minfo
Esempio n. 2
0
 def getMaKaCInfoInstance(cls):
     dbmgr = DBMgr.getInstance()
     root = dbmgr.getDBConnection().root()
     try:
         minfo = root["MaKaCInfo"]["main"]
     except KeyError, e:
         minfo = MaKaCInfo()
         root["MaKaCInfo"] = OOBTree.OOBTree()
         root["MaKaCInfo"]["main"] = minfo
Esempio n. 3
0
 def _setIdx( self ):
     if self.idxClass == None:
         raise Exception( _("index class not set (%s)")%self.__class__.__name__)
     shelf = DBMgr.getInstance().getDBConnection()
     #XXX: calling this provokes a modification on the shelf which produces
     #   read conflicts
     #self._idx = shelf.create_catalog( self.idxClass )
     if shelf.has_catalog( self.idxClass ):
         self._idx = shelf.get_catalog( self.idxClass )
     else:
         self._idx = shelf.create_catalog( self.idxClass )
Esempio n. 4
0
 def _getTree(self, name):
     """Returns a OOBTree object stored in the DB root under the key "name".
        If the key doesn't exist if creates a new tree and inserts it into the
        DB root.
        BTree objects act as a dictionary but due to their data structure 
        properties allow to increase the concurrency (don't need to load all
        the mapping on memory) and improves performance.
         Params:
             name -- key value of the requested tree
     """
     root = DBMgr.getInstance().getDBConnection().root()
     name = name.strip().lower()
     if not (name in self.__allowedIdxs):
         raise Exception(_("index name not allowed %s") % name)
     if not root.has_key(name):
         root[name] = OOBTree.OOBTree()
     return root[name]
Esempio n. 5
0
 def _getTree(self, name):
     """Returns a OOBTree object stored in the DB root under the key "name".
        If the key doesn't exist if creates a new tree and inserts it into the
        DB root.
        BTree objects act as a dictionary but due to their data structure
        properties allow to increase the concurrency (don't need to load all
        the mapping on memory) and improves performance.
         Params:
             name -- key value of the requested tree
     """
     root = DBMgr.getInstance().getDBConnection().root()
     name =  name.lower()
     if not (name in self.__allowedIdxs):
         raise Exception( _("index name not allowed %s")%name)
     if not root.has_key( name ):
         root[ name ] = OOBTree.OOBTree()
     return root[ name ]