Every course in split modulestore has a version (internally), and any change to the structure of the course (or any content, too, I suppose) will change the version (which is just a mongoDB ObjectId). So "all you need to do" is store the result of the Course Blocks API query for each course along with the "version of the published branch" of that course. Then, you only need to re-fetch the block structure if the current version doesn't match the cached result version.
A course's ID string/key can actually include this version information, though this form is rarely seen: "course-v1:mit.eecs+6002x+branch@published+version@519665f6223ebd6980884f2b"
From what I recall about split's "versions" table, a MongoDB query to fetch a list of all courses and the version of each would be trivial and fast, though I don't know if there is currently any API which exposes it.
FWIW I implemented content libraries using that approach - the randomized content block checks the version of the library to know when to prompt the course author to update. If we used that approach it should be non through some API that's not directly related to the modulestore.
Yeah, I thought about leveraging that data. I'm not aware of any API that exposes it, however, and am very wary of reaching in behind the modulestore API (given how complex it is).
I like the idea of using the version, though, to determine which courses need to be pulled again instead of time. Maybe we could leverage entity tags? Basically set the etag to the version identifier? Maybe it already does this?
I'm not very familiar with conditional get semantics, but I think we could then use "If-None-Match" to short-circuit and return a 304 if the course hasn't changed.
--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/cedb8238-e452-467d-ab25-544c73e8a359%40googlegroups.com.
So now, this data is available to the Course Blocks API. The subtree_edited_on timestamp may be all that you need to embed in the ETag when non-user-specific blocks are requested (i.e., when all_blocks=true URL param is specified).
"block-v1:edX+DemoX+Demo_Course+type@course+block@course": { "display_name": "edX Demonstration Course", "student_view_url": "http://helga.local:8000/xblock/block-v1:edX+DemoX+Demo_Course+type@course+block@course", "id": "block-v1:edX+DemoX+Demo_Course+type@course+block@course", "lms_web_url": "http://helga.local:8000/courses/course-v1:edX+DemoX+Demo_Course/jump_to/block-v1:edX+DemoX+Demo_Course+type@course+block@course", "type": "course", "children": [ "block-v1:edX+DemoX+Demo_Course+type@sequential+block@edx_introduction", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@simulations", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@graded_simulations", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@175e76c4951144a29d46211361266e0e", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@07bc32474380492cb34f76e5f9d9a135", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@workflow", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@19a30717eff543078a5d94ae9d6c18a5", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@basic_questions", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@48ecb924d7fe4b66a230137626bfa93e", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@dbe8fc027bcb4fe9afb744d2e8415855", "block-v1:edX+DemoX+Demo_Course+type@sequential+block@6ab9c442501d472c8ed200e367b4edfa" ] },
--
You received this message because you are subscribed to the Google Groups "General Open edX discussion" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/CACSOLjdJxTYRU1sRBxcOSAVahFV1NHfYdTbrBMn80Y7MhX6Y_A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/edx-code/CAMZ1AtJ4cahScc%3DkhMbsX9GF0v__G_mu0mfsx0wq6LZtTG9uBA%40mail.gmail.com.