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
827a8f81
Commit
827a8f81
authored
May 18, 2015
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve documentation of courseware.model_data
parent
bd1e9aa1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
lms/djangoapps/courseware/model_data.py
+28
-9
No files found.
lms/djangoapps/courseware/model_data.py
View file @
827a8f81
"""
Classes to provide the LMS runtime data storage to XBlocks
Classes to provide the LMS runtime data storage to XBlocks.
:class:`DjangoKeyValueStore`: An XBlock :class:`~KeyValueStore` which
stores a subset of xblocks scopes as Django ORM objects. It wraps
:class:`~FieldDataCache` to provide an XBlock-friendly interface.
:class:`FieldDataCache`: A object which provides a read-through prefetch cache
of data to support XBlock fields within a limited set of scopes.
The remaining classes in this module provide read-through prefetch cache implementations
for specific scopes. The individual classes provide the knowledge of what are the essential
pieces of information for each scope, and thus how to cache, prefetch, and create new field data
entries.
UserStateCache: A cache for Scope.user_state
UserStateSummaryCache: A cache for Scope.user_state_summary
PreferencesCache: A cache for Scope.preferences
UserInfoCache: A cache for Scope.user_info
DjangoOrmFieldCache: A base-class for single-row-per-field caches.
"""
import
json
...
...
@@ -681,7 +700,7 @@ class UserInfoCache(DjangoOrmFieldCache):
class
FieldDataCache
(
object
):
"""
A cache of django model objects needed to supply the data
for a module and its decendants
for a module and its de
s
cendants
"""
def
__init__
(
self
,
descriptors
,
course_id
,
user
,
select_for_update
=
False
,
asides
=
None
):
'''
...
...
@@ -736,13 +755,13 @@ class FieldDataCache(object):
def
add_descriptor_descendents
(
self
,
descriptor
,
depth
=
None
,
descriptor_filter
=
lambda
descriptor
:
True
):
"""
Add all descend
e
nts of `descriptor` to this FieldDataCache.
Add all descend
a
nts of `descriptor` to this FieldDataCache.
Arguments:
descriptor: An XModuleDescriptor
depth is the number of levels of descend
e
nt modules to load StudentModules for, in addition to
the supplied descriptor. If depth is None, load all descend
e
nt StudentModules
descriptor_filter is a function that accepts a descriptor and return w
ether the StudentModule
depth is the number of levels of descend
a
nt modules to load StudentModules for, in addition to
the supplied descriptor. If depth is None, load all descend
a
nt StudentModules
descriptor_filter is a function that accepts a descriptor and return w
hether the field data
should be cached
"""
...
...
@@ -782,9 +801,9 @@ class FieldDataCache(object):
course_id: the course in the context of which we want StudentModules.
user: the django user for whom to load modules.
descriptor: An XModuleDescriptor
depth is the number of levels of descend
e
nt modules to load StudentModules for, in addition to
the supplied descriptor. If depth is None, load all descend
e
nt StudentModules
descriptor_filter is a function that accepts a descriptor and return w
ether the StudentModule
depth is the number of levels of descend
a
nt modules to load StudentModules for, in addition to
the supplied descriptor. If depth is None, load all descend
a
nt StudentModules
descriptor_filter is a function that accepts a descriptor and return w
hether the field data
should be cached
select_for_update: Ignored
"""
...
...
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