Skip to content

Commit

Permalink
Update persister docs to reflect db dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jernejfrank committed Feb 1, 2025
1 parent a89c1c0 commit 150b844
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions docs/reference/persister.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,29 @@ State Persistence
Burr provides a set of tools to make loading and saving state easy. These are functions
that will be used by lifecycle hooks to save and load state.

We currently support the following database integrations:

.. table:: Burr Implemented Persisters
:widths: auto

+-------------+-----------------------------------------------------------------+---------------------------------------------------------------------+
| Database | Sync | Async |
+=============+===========+=====================================================+===============+=====================================================+
| SQLite | sqlite3 | :ref:`SQLitePersister <syncsqliteref>` | aiosqlite | :ref:`AsyncSQLitePersister <asyncsqliteref>` |
+-------------+-----------+-----------------------------------------------------+---------------+-----------------------------------------------------+
| PostgreSQL | psycopg2 | :ref:`PostgreSQLPersister <syncpostgresref>` | asyncpg | :ref:`AsyncPostgreSQLPersister <asyncpostgresref>` |
+-------------+-----------+-----------------------------------------------------+---------------+-----------------------------------------------------+
| Redis | redis | :ref:`RedisBasePersister <syncredisref>` | redis.asyncio | :ref:`AsyncRedisBasePersister <asyncredisref>` |
+-------------+-----------+-----------------------------------------------------+---------------+-----------------------------------------------------+
| MongoDB | pymongo | :ref:`MongoDBBasePersister <syncmongoref>` |||
+-------------+-----------+-----------------------------------------------------+---------------+-----------------------------------------------------+

We follow the naming convention ``b_dependency-library``, where the ``b_`` is used to avoid name
clashing with the underlying library. We chose the library name in case we implement the same database
persister with different dependency libraries to keep the class naming convention.

If you want to implement your own state persister (to bridge it with a database), you should implement
the ``BaseStatePersister`` interface.
the ``BaseStatePersister`` or the ``AsyncBaseStatePersister`` interface.

.. autoclass:: burr.core.persistence.BaseStatePersister
:members:
Expand Down Expand Up @@ -61,23 +82,30 @@ Supported Sync Implementations

Currently we support the following, although we highly recommend you contribute your own! We will be adding more shortly.

.. _syncsqliteref:

.. autoclass:: burr.core.persistence.SQLitePersister
:members:

.. automethod:: __init__

.. _syncpostgresref:

.. autoclass:: burr.integrations.persisters.postgresql.PostgreSQLPersister
.. autoclass:: burr.integrations.persisters.b_psycopg2.PostgreSQLPersister
:members:

.. automethod:: __init__

.. _syncredisref:

.. autoclass:: burr.integrations.persisters.b_redis.RedisBasePersister
:members:

.. automethod:: __init__

.. autoclass:: burr.integrations.persisters.b_mongodb.MongoDBBasePersister
.. _syncmongoref:

.. autoclass:: burr.integrations.persisters.b_pymongo.MongoDBBasePersister
:members:

.. automethod:: __init__
Expand All @@ -90,20 +118,26 @@ although it uses different mechanisms to save state (as it tracks more than just
Supported Async Implementations
================================

.. _asyncpersistersref:

Currently we support the following, although we highly recommend you contribute your own! We will be adding more shortly.

.. _asyncpersistersref:
.. _asyncsqliteref:

.. autoclass:: burr.integrations.persisters.b_aiosqlite.AsyncSQLitePersister
:members:

.. automethod:: __init__

.. autoclass:: burr.integrations.persisters.postgresql.AsyncPostgreSQLPersister
.. _asyncpostgresref:

.. autoclass:: burr.integrations.persisters.b_asyncpg.AsyncPostgreSQLPersister
:members:

.. automethod:: __init__

.. _asyncredisref:

.. autoclass:: burr.integrations.persisters.b_redis.AsyncRedisBasePersister
:members:

Expand Down

0 comments on commit 150b844

Please # to comment.