Commit 1abae6f0 by Don Mitchell

Location to Locator mapping utilities

partial impl
parent 0833f87f
...@@ -10,9 +10,8 @@ from xmodule.errortracker import null_error_tracker ...@@ -10,9 +10,8 @@ from xmodule.errortracker import null_error_tracker
from xmodule.x_module import XModuleDescriptor from xmodule.x_module import XModuleDescriptor
from xmodule.modulestore.locator import BlockUsageLocator, DescriptionLocator, CourseLocator, VersionTree from xmodule.modulestore.locator import BlockUsageLocator, DescriptionLocator, CourseLocator, VersionTree
from xmodule.modulestore.exceptions import InsufficientSpecificationError, VersionConflictError 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 ..exceptions import ItemNotFoundError
from .definition_lazy_loader import DefinitionLazyLoader from .definition_lazy_loader import DefinitionLazyLoader
from .caching_descriptor_system import CachingDescriptorSystem from .caching_descriptor_system import CachingDescriptorSystem
...@@ -62,14 +61,11 @@ class SplitMongoModuleStore(ModuleStoreBase): ...@@ -62,14 +61,11 @@ class SplitMongoModuleStore(ModuleStoreBase):
**kwargs **kwargs
), db) ), 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.course_index = self.db[collection + '.active_versions']
self.structures = self.db[collection + '.structures'] self.structures = self.db[collection + '.structures']
self.definitions = self.db[collection + '.definitions'] self.definitions = self.db[collection + '.definitions']
# ??? Code review question: those familiar w/ python threading. Should I instead # Code review question: How should I expire entries?
# use django cache? How should I expire entries?
# _add_cache could use a lru mechanism to control the cache size? # _add_cache could use a lru mechanism to control the cache size?
self.thread_cache = threading.local() self.thread_cache = threading.local()
...@@ -1178,6 +1174,7 @@ class SplitMongoModuleStore(ModuleStoreBase): ...@@ -1178,6 +1174,7 @@ class SplitMongoModuleStore(ModuleStoreBase):
else: else:
return DescriptionLocator(definition['_id']) return DescriptionLocator(definition['_id'])
def _block_matches(self, value, qualifiers): def _block_matches(self, value, qualifiers):
''' '''
Return True or False depending on whether the value (block contents) Return True or False depending on whether the value (block contents)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment