def delproperty(self, path, property): path = _normpath(path) self.__conn.sync() db = self.__db if db.has_key(path) and db[path].has_key(property): del db[path][property] get_transaction.commit()
def properties(self, path): path = _normpath(path) self.__conn.sync() db = self.__db if db.has_key(path): return db[path].data.copy() return ()
def properties(self, path): path=_normpath(path) self.__conn.sync() db=self.__db if db.has_key(path): return db[path].data.copy() return ()
def delproperty(self, path, property): path=_normpath(path) self.__conn.sync() db=self.__db if db.has_key(path) and db[path].has_key(property): del db[path][property] get_transaction.commit()
def getproperty(self, path, property): path = _normpath(path) property = str(property) db = self.__db() if db.has_key(path): pathhash = db[path] if pathhash.has_key(property): return pathhash[property] raise KeyError, property
def getproperty(self, path, property): path = _normpath(path) self.__conn.sync() db = self.__db if db.has_key(path): pathhash = db[path] if pathhash.has_key(property): return pathhash[property] raise KeyError, property
def getproperty(self, path, property): path=_normpath(path) self.__conn.sync() db=self.__db if db.has_key(path): pathhash=db[path] if pathhash.has_key(property): return pathhash[property] raise KeyError, property
def getproperty(self, path, property): path=_normpath(path) property=str(property) db=self.__db() if db.has_key(path): pathhash=db[path] if pathhash.has_key(property): return pathhash[property] raise KeyError, property
def setproperty(self, path, property, value): path = _normpath(path) self.__conn.sync() db = self.__db if db.has_key(path): pathhash = db[path] else: pathhash = PersistentMapping() db[path] = pathhash pathhash[property] = value get_transaction().commit()
def setproperty(self, path, property, value): path = _normpath(path) property = str(property) db = self.__db() if db.has_key(path): pathhash = db[path] pathhash[property] = value else: pathhash = {property: value} db[path] = pathhash db.close()
def setproperty(self, path, property, value): path=_normpath(path) self.__conn.sync() db=self.__db if db.has_key(path): pathhash=db[path] else: pathhash=PersistentMapping() db[path]=pathhash pathhash[property]=value get_transaction().commit()
def setproperty(self, path, property, value): path=_normpath(path) property=str(property) db=self.__db() if db.has_key(path): pathhash=db[path] pathhash[property]=value else: pathhash={property : value} db[path]=pathhash db.close()
def properties(self, path): path = _normpath(path) d, fname = self.__splitpath(path) comppath = os.path.join(d, self.__compname) try: db = Component.callComponent(comppath, {}, self.cache, DT_DATA) except VFSException: return {} if type(db) != type({}): raise VFSException, "corrupted or inappropriate data in %s" % comppath props = db.get(fname, {}) if type(props) != type({}): raise VFSException, "corrupted or inappropriate data in %s" % comppath return props
def clearCache(name, arguments, matchExact=None): if matchExact: path, svr, fk = _genCachedComponentPath(name, arguments) _expireCacheFile(path) else: name = _normpath(name) md5, fullKey = cacheKey.cachekey.genCacheKey(arguments) if Configuration.numServers: names = ' '.join([ _shellEscape("%s/%s/%s" % (Configuration.componentCacheRoot, i, name)) for i in range(Configuration.numServers) ]) else: names = "%s/%s" % (Configuration.componentCacheRoot, _shellEscape(name)) greps = [] for k, v in fullKey.items(): #print "--> %r %r" % (k, v) greps.append(_shellQuote("%r %r" % (k, v))) cmd = ('%(find)s %(names)s -name "*.cache" | %(sed)s ' "'s/.cache$/.key/' ") % { 'find': Configuration.findCommand, 'names': names, 'sed': Configuration.sedCommand } cmd += "|" + " | ".join([ "%s %s -l %s" % (Configuration.xargsCommand, Configuration.fgrepCommand, i) for i in greps ]) LOG('running command %s' % cmd) ret, out = commands.getstatusoutput(cmd) #LOG('code %s, out %s' % (ret, out)) if ret: ERROR('Command "%s" returned %d, output:\n%s' % (cmd, ret, out)) return out = [ out[:-3] + 'cache' for i in out.split('\n') if len(i.strip()) and i[:6] != 'find: ' ] LOG('Expiring %s' % out) for i in out: _expireCacheFile(i)
def properties(self, path): path=_normpath(path) d, fname=self.__splitpath(path) comppath=os.path.join(d, self.__compname) try: db=Component.callComponent(comppath, {}, self.cache, DT_DATA) except VFSException: return {} if type(db) != type({}): raise VFSException, "corrupted or inappropriate data in %s" % comppath props=db.get(fname, {}) if type(props) != type({}): raise VFSException, "corrupted or inappropriate data in %s" % comppath return props
def clearCache( name, arguments, matchExact = None ): if matchExact: path, svr, fk = _genCachedComponentPath( name, arguments ) _expireCacheFile( path ) else: name = _normpath( name ) md5, fullKey = cacheKey.cachekey.genCacheKey( arguments ) if Configuration.numServers: names = ' '.join([_shellEscape( "%s/%s/%s" % ( Configuration.componentCacheRoot, i, name ) ) for i in range(Configuration.numServers) ]) else: names = "%s/%s" % (Configuration.componentCacheRoot, _shellEscape( name )) greps = [] for k, v in fullKey.items(): #print "--> %r %r" % (k, v) greps.append( _shellQuote( "%r %r" % (k, v) ) ) cmd = ('%(find)s %(names)s -name "*.cache" | %(sed)s ' "'s/.cache$/.key/' ") % { 'find': Configuration.findCommand, 'names': names, 'sed': Configuration.sedCommand } cmd += "|" + " | ".join(["%s %s -l %s" % ( Configuration.xargsCommand, Configuration.fgrepCommand, i ) for i in greps]) LOG('running command %s' % cmd) ret, out = commands.getstatusoutput(cmd) #LOG('code %s, out %s' % (ret, out)) if ret: ERROR ( 'Command "%s" returned %d, output:\n%s' % ( cmd, ret, out )) return out = [out[:-3]+'cache' for i in out.split('\n') if len(i.strip()) and i[:6] != 'find: '] LOG('Expiring %s' % out) for i in out: _expireCacheFile( i )
def setproperty(self, path, property, value): path = _normpath(path) properties = self.__getproperties(path) properties[property] = value self.__saveproperties(path, properties)
def hasproperty(self, path, property): path = _normpath(path) db = self.__db() return db.has_key(path) and db[path].has_key(property)
def delproperty(self, path, property): path = _normpath(path) db = self.__db() if db.has_key(path) and db[path].has_key(property): del db[path][property] db.close()
def getproperty(self, path, property): return self.properties(_normpath(path))[property]
def properties(self, path): path = _normpath(path) db = self.__db() if db.has_key(path): return db[path] return {}
def properties(self, path): path=_normpath(path) db=self.__db() if db.has_key(path): return db[path] return {}
def __init__(self, propsDir): self.__picklepath=_normpath(propsDir) if not os.path.exists(self.__picklepath): os.makedirs(self.__picklepath)
def _fixPath(root, path): return '%s/%s' % (root, _normpath(path))
def hasproperty(self, path, property): path=_normpath(path) db=self.__db() return db.has_key(path) and db[path].has_key(property)
def __init__(self, propsDir): self.__picklepath = _normpath(propsDir) if not os.path.exists(self.__picklepath): os.makedirs(self.__picklepath)
def _fixPath( root, path ): return '%s/%s' % (root, _normpath(path))
def properties(self, path): return self.__getproperties(_normpath(path))
def setproperty(self, path, property, value): path=_normpath(path) properties=self.__getproperties(path) properties[property]=value self.__saveproperties(path, properties)
def delproperty(self, path, property): path=_normpath(path) db=self.__db() if db.has_key(path) and db[path].has_key(property): del db[path][property] db.close()
def hasproperty(self, path, property): path=_normpath(path) self.__conn.sync() db=self.__db return db.has_key(path) and db[path].has_key(property)
def delproperty(self, path, property): path = _normpath(path) properties = self.__getproperties(path) if properties.has_key(property): del properties[property] self.__saveproperties(path, properties)
def delproperty(self, path, property): path=_normpath(path) properties=self.__getproperties(path) if properties.has_key(property): del properties[property] self.__saveproperties(path, properties)
def hasproperty(self, path, property): path = _normpath(path) self.__conn.sync() db = self.__db return db.has_key(path) and db[path].has_key(property)