libkazvisa[sans-io](https://sans-io.readthedocs.io/) library based on [lager](https://github.com/arximboldi/lager) implementing the [Matrix client-server API](https://spec.matrix.org/v1.11/client-server-api/).
Ontheotherhand,thecurrentvalueofthemodelcanbeobtainedfromthestoreviaa[**cursor**](https://sinusoid.es/lager/cursors.html). For the purpose of the Kazv Project, the most-used cursor is a read-only one called `lager::reader`. The `get()` method on the cursor returns the current value stored in it.
[Lenses](https://sinusoid.es/lager/lenses.html) are relationships between two values (usually a whole and a part). For the purpose of libkazv, you can see it as a similar transformation as `map`, but more concise. Commonly used lenses include:
Notethatallcursoroperations(`get()`andtransformations)needtohappeninthethreadoftheeventloop.(see<https://github.com/arximboldi/lager/issues/118>) If you need to operate on cursors in another thread, you need to create a **secondary root**. This is done by creating another store with an event loop running in the desired thread, with the action type being the same as the model type, and then watching the primary root:
libkazvusesastrongerstore(`Kazv::Store`)thanlager'sbuiltinstore,allowing**then-continuations**(see<https://github.com/arximboldi/lager/issues/96>). We take the concept of **Promises** from [Promises/A+](https://promisesaplus.com/). It is similar to C++'s `std::future`. A `Promise` can be **then**-ed with a **continuation callback**, which is executed after the Promise **resolves**. A Promise can contain data, and the Promise is said to have resolved when the data is ready. For the case of libkazv, the data contained is of type `Kazv::EffectStatus`.
```cpp
autopromise=ctx.dispatch(action);
promise.then([](autostatus){
// this will be run after the reducer for action is run,
// and after the effect returned by the reducer is run.
// `status` will contain the value returned from the effect.
Writea**unittest**toensurethecorrectrequestismade.Thisisimportantbecauseweauto-generatetheC++codeforthejobs,andtheorderoftheparametersinthejobconstructorcandifferfromversiontoversionoftheMatrixspecdocs.Weuse[Catch2-3](https://github.com/catchorg/Catch2) for unit testing.
```cpp
// src/tests/client/xxx-test.cpp
#include"client/actions/xxx.hpp"
usingnamespaceKazv;
usingnamespaceKazv::Factory;
TEST_CASE("XXXAction","[client][xxx]")// add test tags as needed
{
autoclient=makeClient();// see design-docs/libkazvfixtures.md