Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d8744611
Commit
d8744611
authored
Jun 27, 2016
by
Nimisha Asthagiri
Committed by
GitHub
Jun 27, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12872 from edx/naa/fix-block-structure-version
Update BlockStructure version number
parents
65bca48e
b9b16486
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
openedx/core/lib/block_structure/block_structure.py
+6
-0
openedx/core/lib/block_structure/cache.py
+5
-2
openedx/core/lib/block_structure/tests/test_manager.py
+7
-0
No files found.
openedx/core/lib/block_structure/block_structure.py
View file @
d8744611
...
...
@@ -395,6 +395,12 @@ class BlockStructureBlockData(BlockStructure):
Subclass of BlockStructure that is responsible for managing block
and transformer data.
"""
# The latest version of the data structure of this class. Incrementally
# update this value whenever the data structure changes. Dependent storage
# layers can then use this value when serializing/deserializing block
# structures, and invalidating any previously cached/stored data.
VERSION
=
1
def
__init__
(
self
,
root_block_usage_key
):
super
(
BlockStructureBlockData
,
self
)
.
__init__
(
root_block_usage_key
)
...
...
openedx/core/lib/block_structure/cache.py
View file @
d8744611
...
...
@@ -6,7 +6,7 @@ from logging import getLogger
from
openedx.core.lib.cache_utils
import
zpickle
,
zunpickle
from
.block_structure
import
BlockStructureModulestoreData
from
.block_structure
import
BlockStructureModulestoreData
,
BlockStructureBlockData
logger
=
getLogger
(
__name__
)
# pylint: disable=C0103
...
...
@@ -126,4 +126,7 @@ class BlockStructureCache(object):
Returns the cache key to use for storing the block structure
for the given root_block_usage_key.
"""
return
"root.key."
+
unicode
(
root_block_usage_key
)
return
"v{version}.root.key.{root_usage_key}"
.
format
(
version
=
unicode
(
BlockStructureBlockData
.
VERSION
),
root_usage_key
=
unicode
(
root_block_usage_key
),
)
openedx/core/lib/block_structure/tests/test_manager.py
View file @
d8744611
...
...
@@ -4,6 +4,7 @@ Tests for manager.py
from
nose.plugins.attrib
import
attr
from
unittest
import
TestCase
from
..block_structure
import
BlockStructureBlockData
from
..exceptions
import
UsageKeyNotInBlockStructure
from
..manager
import
BlockStructureManager
from
..transformers
import
BlockStructureTransformers
...
...
@@ -154,6 +155,12 @@ class TestBlockStructureManager(TestCase, ChildrenMapTestMixin):
self
.
collect_and_verify
(
expect_modulestore_called
=
True
,
expect_cache_updated
=
True
)
self
.
assertEquals
(
TestTransformer1
.
collect_call_count
,
2
)
def
test_get_collected_version_update
(
self
):
self
.
collect_and_verify
(
expect_modulestore_called
=
True
,
expect_cache_updated
=
True
)
BlockStructureBlockData
.
VERSION
+=
1
self
.
collect_and_verify
(
expect_modulestore_called
=
True
,
expect_cache_updated
=
True
)
self
.
assertEquals
(
TestTransformer1
.
collect_call_count
,
2
)
def
test_clear
(
self
):
self
.
collect_and_verify
(
expect_modulestore_called
=
True
,
expect_cache_updated
=
True
)
self
.
bs_manager
.
clear
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment