From 1abae6f09316b8debda522ce9a65073f63ab45bc Mon Sep 17 00:00:00 2001 From: Don Mitchell Date: Wed, 31 Jul 2013 16:20:34 -0400 Subject: [PATCH] Location to Locator mapping utilities partial impl --- .../lib/xmodule/xmodule/modulestore/split_mongo/split.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py index 7038cdf865..7e151a6649 100644 --- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py +++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py @@ -10,9 +10,8 @@ from xmodule.errortracker import null_error_tracker from xmodule.x_module import XModuleDescriptor from xmodule.modulestore.locator import BlockUsageLocator, DescriptionLocator, CourseLocator, VersionTree from xmodule.modulestore.exceptions import InsufficientSpecificationError, VersionConflictError -from xmodule.modulestore import inheritance +from xmodule.modulestore import inheritance, ModuleStoreBase -from .. import ModuleStoreBase from ..exceptions import ItemNotFoundError from .definition_lazy_loader import DefinitionLazyLoader from .caching_descriptor_system import CachingDescriptorSystem @@ -62,14 +61,11 @@ class SplitMongoModuleStore(ModuleStoreBase): **kwargs ), db) - # TODO add caching of structures to thread_cache to prevent repeated fetches (but not index b/c - # it changes w/o having a change in id) self.course_index = self.db[collection + '.active_versions'] self.structures = self.db[collection + '.structures'] self.definitions = self.db[collection + '.definitions'] - # ??? Code review question: those familiar w/ python threading. Should I instead - # use django cache? How should I expire entries? + # Code review question: How should I expire entries? # _add_cache could use a lru mechanism to control the cache size? self.thread_cache = threading.local() @@ -1178,6 +1174,7 @@ class SplitMongoModuleStore(ModuleStoreBase): else: return DescriptionLocator(definition['_id']) + def _block_matches(self, value, qualifiers): ''' Return True or False depending on whether the value (block contents)