Commit a9695828 by Don Mitchell

Remove LocMapperStore

LMS-2918
parent a71919ef
...@@ -14,7 +14,6 @@ import django.utils ...@@ -14,7 +14,6 @@ import django.utils
import re import re
import threading import threading
from xmodule.modulestore.loc_mapper_store import LocMapperStore
from xmodule.util.django import get_current_request_hostname from xmodule.util.django import get_current_request_hostname
import xmodule.modulestore # pylint: disable=unused-import import xmodule.modulestore # pylint: disable=unused-import
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
...@@ -102,36 +101,8 @@ def clear_existing_modulestores(): ...@@ -102,36 +101,8 @@ def clear_existing_modulestores():
This is useful for flushing state between unit tests. This is useful for flushing state between unit tests.
""" """
global _MIXED_MODULESTORE, _loc_singleton # pylint: disable=global-statement global _MIXED_MODULESTORE # pylint: disable=global-statement
_MIXED_MODULESTORE = None _MIXED_MODULESTORE = None
# pylint: disable=W0603
cache = getattr(_loc_singleton, "cache", None)
if cache:
cache.clear()
_loc_singleton = None
# singleton instance of the loc_mapper
_loc_singleton = None
def loc_mapper():
"""
Get the loc mapper which bidirectionally maps Locations to Locators. Used like modulestore() as
a singleton accessor.
"""
# pylint: disable=W0603
global _loc_singleton
# pylint: disable=W0212
if _loc_singleton is None:
try:
loc_cache = get_cache('loc_cache')
except InvalidCacheBackendError:
loc_cache = get_cache('default')
# instantiate
_loc_singleton = LocMapperStore(loc_cache, **settings.DOC_STORE_CONFIG)
return _loc_singleton
class ModuleI18nService(object): class ModuleI18nService(object):
......
...@@ -173,7 +173,7 @@ class SplitMigrator(object): ...@@ -173,7 +173,7 @@ class SplitMigrator(object):
""" """
def get_translation(location): def get_translation(location):
""" """
Convert the location and add to loc mapper Convert the location
""" """
return new_course_key.make_usage_key( return new_course_key.make_usage_key(
location.category, location.category,
...@@ -207,7 +207,7 @@ class SplitMigrator(object): ...@@ -207,7 +207,7 @@ class SplitMigrator(object):
""" """
def get_translation(location): def get_translation(location):
""" """
Convert the location and add to loc mapper Convert the location
""" """
return new_course_key.make_usage_key( return new_course_key.make_usage_key(
location.category, location.category,
......
...@@ -5,10 +5,8 @@ Modulestore configuration for test cases. ...@@ -5,10 +5,8 @@ Modulestore configuration for test cases.
from uuid import uuid4 from uuid import uuid4
from django.test import TestCase from django.test import TestCase
from django.contrib.auth.models import User from django.contrib.auth.models import User
from xmodule.modulestore.django import (
modulestore, clear_existing_modulestores, loc_mapper
)
from xmodule.contentstore.django import _CONTENTSTORE from xmodule.contentstore.django import _CONTENTSTORE
from xmodule.modulestore.django import modulestore, clear_existing_modulestores
from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore import ModuleStoreEnum
...@@ -197,11 +195,6 @@ class ModuleStoreTestCase(TestCase): ...@@ -197,11 +195,6 @@ class ModuleStoreTestCase(TestCase):
module_store._drop_database() # pylint: disable=protected-access module_store._drop_database() # pylint: disable=protected-access
_CONTENTSTORE.clear() _CONTENTSTORE.clear()
location_mapper = loc_mapper()
if location_mapper.db:
location_mapper.location_map.drop()
location_mapper.db.connection.close()
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
""" """
......
...@@ -33,10 +33,6 @@ Modulestore Helpers ...@@ -33,10 +33,6 @@ Modulestore Helpers
These packages provide utilities for easier use of modulestores, These packages provide utilities for easier use of modulestores,
and migrating data between modulestores. and migrating data between modulestores.
.. automodule:: xmodule.modulestore.loc_mapper_store
:members:
:show-inheritance:
.. automodule:: xmodule.modulestore.search .. automodule:: xmodule.modulestore.search
:members: :members:
:show-inheritance: :show-inheritance:
......
...@@ -12,14 +12,6 @@ db.collection_name ...@@ -12,14 +12,6 @@ db.collection_name
``` ```
as in ```db.location_map.ensureIndex({'course_id': 1}{background: true})``` as in ```db.location_map.ensureIndex({'course_id': 1}{background: true})```
location_map:
=============
```
ensureIndex({'org': 1, 'offering': 1})
ensureIndex({'schema': 1})
```
fs.files: fs.files:
========= =========
......
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