| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from in_memory_object_store import InMemoryObjectStore | 5 from cache_chain_object_store import CacheChainObjectStore |
| 6 from memcache_object_store import MemcacheObjectStore | 6 from memcache_object_store import MemcacheObjectStore |
| 7 from persistent_object_store import PersistentObjectStore |
| 7 | 8 |
| 8 class ObjectStoreCreator(object): | 9 class ObjectStoreCreator(object): |
| 9 class Factory(object): | 10 class Factory(object): |
| 10 def __init__(self, branch=None): | 11 def __init__(self, branch=None): |
| 11 self._branch = branch | 12 self._branch = branch |
| 12 | 13 |
| 13 '''Creates ObjectStoreCreators (yes seriously) bound to an SVN branch. | 14 '''Creates ObjectStoreCreators (yes seriously) bound to an SVN branch. |
| 14 ''' | 15 ''' |
| 15 def Create(self, cls, store_type=None): | 16 def Create(self, cls, store_type=None): |
| 16 return ObjectStoreCreator(cls, branch=self._branch, store_type=store_type) | 17 return ObjectStoreCreator(cls, branch=self._branch, store_type=store_type) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 38 ''' | 39 ''' |
| 39 namespace = self._name | 40 namespace = self._name |
| 40 if category is not None: | 41 if category is not None: |
| 41 assert not any(c.isdigit() for c in category) | 42 assert not any(c.isdigit() for c in category) |
| 42 namespace = '%s/%s' % (namespace, category) | 43 namespace = '%s/%s' % (namespace, category) |
| 43 if version is not None: | 44 if version is not None: |
| 44 assert isinstance(version, int) | 45 assert isinstance(version, int) |
| 45 namespace = '%s/%s' % (namespace, version) | 46 namespace = '%s/%s' % (namespace, version) |
| 46 if self._store_type is not None: | 47 if self._store_type is not None: |
| 47 return self._store_type(namespace) | 48 return self._store_type(namespace) |
| 48 return InMemoryObjectStore(MemcacheObjectStore(namespace)) | 49 return CacheChainObjectStore((MemcacheObjectStore(namespace), |
| 50 PersistentObjectStore(namespace))) |
| OLD | NEW |