libkazv
Kazv::Sdk< EventLoop, Xform, Enhancers > Class Template Reference

Contain the single source of truth of a matrix sdk. More...

#include <sdk.hpp>

Public Member Functions

 Sdk (ModelT model, JobInterface &jobHandler, EventInterface &eventEmitter, EventLoop &&eventLoop, Xform &&xform, Enhancers &&...enhancers)
 
ContextT context () const
 Get the context associated with this. More...
 
Client client () const
 Get a Client representing this. More...
 
template<class EL >
auto createSecondaryRoot (EL &&eventLoop, ModelT initialModel=ModelT{}) const
 Create a secondary root for this Sdk. More...
 
Client clientFromSecondaryRoot (lager::reader< ModelT > sr) const
 Get a Client representing this. More...
 

Detailed Description

template<class EventLoop, class Xform, class ... Enhancers>
class Kazv::Sdk< EventLoop, Xform, Enhancers >

Contain the single source of truth of a matrix sdk.

Constructor & Destructor Documentation

◆ Sdk()

template<class EventLoop , class Xform , class ... Enhancers>
Kazv::Sdk< EventLoop, Xform, Enhancers >::Sdk ( ModelT  model,
JobInterface jobHandler,
EventInterface eventEmitter,
EventLoop &&  eventLoop,
Xform &&  xform,
Enhancers &&...  enhancers 
)
inline

Member Function Documentation

◆ client()

template<class EventLoop , class Xform , class ... Enhancers>
Client Kazv::Sdk< EventLoop, Xform, Enhancers >::client ( ) const
inline

Get a Client representing this.

The returned Client belongs to the thread where the promise handler runs.

◆ clientFromSecondaryRoot()

template<class EventLoop , class Xform , class ... Enhancers>
Client Kazv::Sdk< EventLoop, Xform, Enhancers >::clientFromSecondaryRoot ( lager::reader< ModelT sr) const
inline

Get a Client representing this.

The returned Client belongs to the same thread as sr.

This function is thread-safe, but it must be called from the thread where sr belongs.

Parameters
srThe secondary root cursor that represents this sdk.
Returns
A Client representing this in the same thread as sr.

◆ context()

template<class EventLoop , class Xform , class ... Enhancers>
ContextT Kazv::Sdk< EventLoop, Xform, Enhancers >::context ( ) const
inline

Get the context associated with this.

The returned context is thread-safe if every thread calls with different instances.

◆ createSecondaryRoot()

template<class EventLoop , class Xform , class ... Enhancers>
template<class EL >
auto Kazv::Sdk< EventLoop, Xform, Enhancers >::createSecondaryRoot ( EL &&  eventLoop,
ModelT  initialModel = ModelT{} 
) const
inline

Create a secondary root for this Sdk.

Parameters
eventLoopAn event loop passed to lager::make_store. The resulting secondary root will belong to the thread of this event loop.
initialModelThe initial value for the model on the secondary root.
Returns
A lager::store that belongs to the thread of eventLoop. The store will be kept update with this sdk.

The documentation for this class was generated from the following file: