Skip to content

Commit

Permalink
feat: fill in outline for new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi committed Jan 26, 2023
1 parent 81ee4f5 commit e2c2ef4
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 3 deletions.
49 changes: 49 additions & 0 deletions docs/concepts/hooks-extension-framework.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Extending Open edX with the Hooks Extensions Framework
######################################################

To sustain the growth of the Open edX ecosystem, the business rules of the
platform must be open for extension following the open-closed principle. This
framework allows developers to do just that without needing to fork and modify
the main edx-platform repository.

Context
*******

Hooks are predefined places in the edx-platform core where externally defined
functions can take place. In some cases, those functions can alter what the user
sees or experiences in the platform. Other cases are informative only. All cases
are meant to be extended using Open edX plugins and configuration.

Hooks can be of two types, events and filters. Events are in essence signals, in
that they are sent in specific application places and whose listeners can extend
functionality. On the other hand Filters are passed data and can act on it
before this data is put back in the original application flow. In order to allow
extension developers to use the Events and Filters definitions on their plugins,
both kinds of hooks are defined in lightweight external libraries.

* `openedx-filters`_
* `openedx-events`_

Hooks are designed with stability in mind. The main goal is that developers can
use them to change the functionality of the platform as needed and still be able
to migrate to newer open releases with very little to no development effort. In
the case of filters, this is detailed in the `naming and versioning ADR`_.

A longer description of the framework and it's history can be found in `OEP 50`_.

.. _OEP 50: https://open-edx-proposals.readthedocs.io/en/latest/oep-0050-hooks-extension-framework.html
.. _naming and versioning ADR: https://github.com/eduNEXT/openedx-events/blob/main/docs/decisions/0002-events-naming-and-versioning.rst
.. _openedx-filters: https://github.com/eduNEXT/openedx-filters
.. _openedx-events: https://github.com/eduNEXT/openedx-events

On the technical side events are implemented through django signals which makes
them run in the same python process as the lms or cms. Furthermore, events block
the running process. Listeners of an event are encouraged to monitor the
performance or use alternative arch patterns such as receiving the event and
defer to launching async tasks than do the slow processing.

On the other hand, filters are implemented using a pipeline mechanism, that executes
a list of functions called ``steps`` configured through Django settings. Each
pipeline step receives a dictionary with data, process it and returns an output. During
this process, they can alter the application execution flow by halting the process
or modifying their input arguments.
8 changes: 7 additions & 1 deletion docs/concepts/index.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
Concepts
########
========

.. toctree::
:maxdepth: 1
:caption: Contents:

hooks-extension-framework
Empty file.
11 changes: 11 additions & 0 deletions docs/how-tos/create-new-filter.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Create a new filter
###################

Let's say you want to modify the behavior of the students enrollment. You want
at least the following use cases:




Context
*******
Empty file.
13 changes: 11 additions & 2 deletions docs/how-tos/index.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
How-tos
#######
Concepts
========

.. toctree::
:maxdepth: 1
:caption: Contents:

create-new-filter
triggering-filters
configure-filter
filter-unittest
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit e2c2ef4

Please sign in to comment.