stack.texi (2493B)
1 @node chainqueue-architecture 2 @section State storage 3 4 Chainqueue enables separate implementations of the state storage layer backend. 5 6 Included in the package are state storage for sql using the SQLAlchemy dependency, as well as state using native filesystem backend (without any additional dependencies). 7 8 The backend interface is defined in the @code{chainqueue.backend} module. It provides the following methods: 9 10 @itemize 11 @item Create a new queue item 12 @item Add cached data to queue item 13 @item Get a single queue item 14 @item Get multiple queue items based on given criteria 15 @item Dispatch a queue item to the network 16 @item Connect / disconnect to backend 17 @end itemize 18 19 20 @subsection SQL backend 21 22 This backend is Contained in the module @code{chainqueue.sql.backend.SQLBackend}. It translates high-level calls to invididual method calls in the query, state and tx submodules of @code{chainqueue.sql.backend}. 23 24 The @code{SQLBackend} object should provide all methods required to make practical use of the chainqueue package. However, all other modules in @code{chainqueue.sql} are also intended for public consumption. 25 26 The @code{chainqueue.sql.backend} in turn calls methods in the SQLAlchemy database model layer in @code{chainqueue.db.models}. The consumer is not intended to interface directly with @code{chainqueue.db.models}. 27 28 29 @subsection Filesystem backend 30 31 The filesystem state storage is provided by the @code{chainqueue.fs} module. is at the moment missing the @code{chainqueue.backend.Backend} implementation. Please refer to the code in @file{tests/tests_fs*.py} to learn how to use in its current state. 32 33 34 @section Adapters 35 36 The adapter layer enables chain specific code to be combined with an arbitrary storage backend. Typically, chain specific code is required to: 37 38 @itemize 39 @item Translate transaction wire format to generic transaction representation 40 @item Send transactions to the network 41 @end itemize 42 43 The adapter consumes a backend, and delegates calls to it as required. 44 45 Since adapters are chain specific, @code{chainqueue} only provides a base class that must be extended the chain implementer code. Specifically, the methods to extend are: 46 47 @table @code 48 @item Add 49 Add a transaction to the queue 50 @item Upcoming 51 Get queued transactions ready to be sent to network 52 @item Dispatch 53 Send a queued transaction to the network 54 @item Translate 55 Decode details of a transaction 56 @item Create_session, release_session 57 Session management to control queue state integrity 58 @end table