Skip to content

Commit

Permalink
Improved infrastructure documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbywater committed Dec 13, 2017
1 parent ad6db6c commit f74e7dc
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions docs/topics/infrastructure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ sequenced item namedtuple.
SQLAlchemy
----------

To run the examples below, please install the library with the
To run the example below, please install the library with the
'sqlalchemy' option.

.. code::
Expand Down Expand Up @@ -315,7 +315,7 @@ Django ORM
The library also has a concrete active record strategy for the Django ORM provided by
``DjangoActiveRecordStrategy`` class.

To run the examples below, please install the library with the
To run the example below, please install the library with the
'django' option.

.. code::
Expand Down Expand Up @@ -454,22 +454,36 @@ have been tested with PostgreSQL, MySQL, SQLite.
Apache Cassandra
----------------

To run the examples below, please install the library with the
The library also has a concrete active record strategy for
`Apache Cassandra <http://cassandra.apache.org/>`__
provided by the ``CassandraActiveRecordStrategy`` class.

To run the example below, please install the library with the
'cassandra' option.

.. code::
$ pip install eventsourcing[cassandra]
It takes a while to build the driver. If you want to do that last step
quickly, set the environment variable ``CASS_DRIVER_NO_CYTHON``.

.. code::
$ CASS_DRIVER_NO_CYTHON=1 pip install eventsourcing[cassandra]
The library also has a concrete active record strategy for Apache Cassandra provided by
``CassandraActiveRecordStrategy`` class.
For the ``CassandraActiveRecordStrategy``, the ``IntegerSequencedItemRecord``
from ``eventsourcing.infrastructure.cassandra.activerecords`` matches the ``SequencedItem``
namedtuple. The ``StoredEventRecord`` from the same module matches the ``StoredEvent``
namedtuple. There is also a ``TimestampSequencedItemRecord`` and a ``SnapshotRecord``.


The ``CassandraDatastore`` and ``CassandraSettings`` can be used in the same was as
``SQLAlchemyDatastore`` and ``SQLAlchemySettings`` above. Please investigate
library class :class:`~eventsourcing.infrastructure.cassandra.datastore.CassandraSettings`
for information about configuring away from default settings.

.. code:: python
from eventsourcing.infrastructure.cassandra.datastore import CassandraDatastore, CassandraSettings
Expand All @@ -482,6 +496,13 @@ namedtuple. There is also a ``TimestampSequencedItemRecord`` and a ``SnapshotRe
cassandra_datastore.setup_connection()
cassandra_datastore.setup_tables()
With the database setup, the ``CassandraActiveRecordStrategy`` can be constructed,
and used to store events using Apache Cassandra.

.. code:: python
cassandra_active_record_strategy = CassandraActiveRecordStrategy(
active_record_class=StoredEventRecord,
sequenced_item_class=StoredEvent,
Expand All @@ -499,12 +520,6 @@ namedtuple. There is also a ``TimestampSequencedItemRecord`` and a ``SnapshotRe
cassandra_datastore.close_connection()
The ``CassandraDatastore`` and ``CassandraSettings`` are be used in the same was as
``SQLAlchemyDatastore`` and ``SQLAlchemySettings`` above. Please investigate
library class :class:`~eventsourcing.infrastructure.cassandra.datastore.CassandraSettings`
for information about configuring away from default settings.


Sequenced item conflicts
------------------------

Expand Down

0 comments on commit f74e7dc

Please sign in to comment.