def __init__(self, name, aws_access_key_id, aws_secret_access_key, bucket_name, memcache_servers, read_only=False): BaseStorage.__init__(self, name) #import pdb; pdb.set_trace() self._s3 = S3Aspect(aws_access_key_id, aws_secret_access_key, bucket_name) self._memcache = MemcacheAspect(memcache_servers.split(' '), 'bucket:%s' % bucket_name) if read_only: self._is_read_only = True self._clear_temp() #self._tid = None # the current tid #self._ts = None # the current timestamp #self._transaction = None # the current transaction self._ltid = None self._lserial = None # setup memcache ltid, lserial = self._s3.lastCommit() if ltid is None: ltid, lserial = z64, z64 oid = self._s3.highestOid() if oid is None: oid = z64 self._memcache.setup(ltid, lserial, oid)
def __init__(self, name='Mapping Storage'): BaseStorage.__init__(self, name) # ._index maps an oid to a string s. s[:8] is the tid of the # transaction that created oid's current state, and s[8:] is oid's # current state. self._index = {} self._clear_temp() self._ltid = None
def __init__(self, name='Demo Storage', base=None, quota=None): BaseStorage.__init__(self, name, base) # We use a BTree because the items are sorted! self._data = OOBTree.OOBTree() self._index = {} self._vindex = {} self._base = base self._size = 0 self._quota = quota self._ltid = None self._clear_temp() if base is not None and base.versions(): raise POSException.StorageError( "Demo base storage has version data")
def __init__(self, name='TemporaryStorage'): """ _index -- mapping, oid => current serial _referenceCount -- mapping, oid => count _oreferences -- mapping, oid => sequence of referenced oids _opickle -- mapping, oid => pickle _tmp -- used by 'store' to collect changes before finalization _conflict_cache -- cache of recently-written object revisions _last_cache_gc -- last time that conflict cache was garbage collected _recently_gc_oids -- a queue of recently GC'ed oids _oid -- ??? _ltid -- serial of last committed transaction (required by ZEO) _conflict_cache_gcevery -- interval for doing GC on conflict cache _conflict_cache_maxage -- age at whic conflict cache items are GC'ed """ BaseStorage.__init__(self, name) self._index = {} self._referenceCount = {} self._oreferences = {} self._opickle = {} self._tmp = [] self._conflict_cache = {} self._last_cache_gc = 0 self._recently_gc_oids = [None for x in range(RECENTLY_GC_OIDS_LEN)] self._oid = z64 self._ltid = z64 # Alow overrides for testing. self._conflict_cache_gcevery = CONFLICT_CACHE_GCEVERY self._conflict_cache_maxage = CONFLICT_CACHE_MAXAGE
def __init__(self, name='TemporaryStorage'): """ index -- mapping of oid to current serial referenceCount -- mapping of oid to count oreferences -- mapping of oid to a sequence of its referenced oids opickle -- mapping of oid to pickle _tmp -- used by 'store' to collect changes before finalization _conflict_cache -- cache of recently-written object revisions _last_cache_gc -- last time that conflict cache was garbage collected """ BaseStorage.__init__(self, name) self._index={} self._referenceCount={} self._oreferences={} self._opickle={} self._tmp = [] self._conflict_cache = {} self._last_cache_gc = 0 self._oid = '\0\0\0\0\0\0\0\0'
def __init__(self, name='TemporaryStorage'): """ index -- mapping of oid to current serial referenceCount -- mapping of oid to count oreferences -- mapping of oid to a sequence of its referenced oids opickle -- mapping of oid to pickle _tmp -- used by 'store' to collect changes before finalization _conflict_cache -- cache of recently-written object revisions _last_cache_gc -- last time that conflict cache was garbage collected _recently_gc_oids -- a queue of recently gc'ed oids """ BaseStorage.__init__(self, name) self._index={} self._referenceCount={} self._oreferences={} self._opickle={} self._tmp = [] self._conflict_cache = {} self._last_cache_gc = 0 self._recently_gc_oids = [None for x in range (RECENTLY_GC_OIDS_LEN)] self._oid = '\0\0\0\0\0\0\0\0'
def new_oid(self): if self._base is None: return BaseStorage.new_oid(self) else: return self._base.new_oid()