Leosac  0.8.0
Open Source Access Control
Leosac::update::UpdateService Class Reference

This service provides various update management utilities. More...

#include <UpdateService.hpp>

+ Inheritance diagram for Leosac::update::UpdateService:
+ Collaboration diagram for Leosac::update::UpdateService:

Public Member Functions

std::vector< UpdateDescriptorPtrcheck_update ()
 
IUpdatePtr create_update (const std::string &update_descriptor_uuid, const ExecutionContext &ec)
 Create an Update object corresponding to the update descriptor whose uuid is update_descriptor_uuid. More...
 
std::vector< IUpdatePtrpending_updates ()
 Retrieve the list of pending updates. More...
 
void ack_update (IUpdatePtr update, const ExecutionContext &ec)
 
void cancel_update (IUpdatePtr update, const ExecutionContext &ec)
 
void register_backend (UpdateBackendPtr backend)
 Register a backend object. More...
 
- Public Member Functions inherited from Leosac::ExtensibleSerializer< json, IUpdate, const SecurityContext & >
json serialize (const IUpdate &input, AdditionalArgs &&... args) const
 
void register_serializer (Callable &&callable)
 Register a serializer for T. More...
 
void unregister_serializer ()
 

Private Types

using CheckUpdateT = boost::signals2::signal< std::vector< UpdateDescriptorPtr >(void), VectorAppenderCombiner< UpdateDescriptorPtr > >
 
using CreateUpdateT = boost::signals2::signal< IUpdatePtr(const UpdateDescriptor &, const ExecutionContext &), AtMostOneCombiner< IUpdatePtr > >
 
using AckUpdateT = boost::signals2::signal< void(IUpdatePtr, const ExecutionContext &)>
 
using CancelUpdateT = boost::signals2::signal< void(IUpdatePtr, const ExecutionContext &)>
 

Private Attributes

std::mutex mutex_
 
CheckUpdateT check_update_sig_
 
CreateUpdateT create_update_sig_
 
AckUpdateT ack_update_sig_
 
CancelUpdateT cancel_update_sig_
 
std::map< std::string, UpdateDescriptorPtrpublished_descriptors_
 

Additional Inherited Members

- Public Types inherited from Leosac::ExtensibleSerializer< json, IUpdate, const SecurityContext & >
using SerializationCallable = std::function< json(const IUpdate &, AdditionalArgs &&...)>
 Callable type for serialization. More...
 

Detailed Description

This service provides various update management utilities.

It's goal is to unify update management between various modules. Modules can register their UpdateBackend object against this service in order to participates in update detection.

Note
This service is considered a "core service" and is therefore always available.
Warning
The update service requires that database be enabled.

Definition at line 126 of file UpdateService.hpp.

Member Typedef Documentation

◆ AckUpdateT

using Leosac::update::UpdateService::AckUpdateT = boost::signals2::signal<void(IUpdatePtr, const ExecutionContext &)>
private

Definition at line 175 of file UpdateService.hpp.

◆ CancelUpdateT

using Leosac::update::UpdateService::CancelUpdateT = boost::signals2::signal<void(IUpdatePtr, const ExecutionContext &)>
private

Definition at line 178 of file UpdateService.hpp.

◆ CheckUpdateT

Definition at line 167 of file UpdateService.hpp.

◆ CreateUpdateT

Definition at line 172 of file UpdateService.hpp.

Member Function Documentation

◆ ack_update()

void Leosac::update::UpdateService::ack_update ( IUpdatePtr  update,
const ExecutionContext ec 
)

Definition at line 103 of file UpdateService.cpp.

◆ cancel_update()

void Leosac::update::UpdateService::cancel_update ( IUpdatePtr  update,
const ExecutionContext ec 
)

Definition at line 108 of file UpdateService.cpp.

◆ check_update()

std::vector< UpdateDescriptorPtr > Leosac::update::UpdateService::check_update ( )

Definition at line 52 of file UpdateService.cpp.

◆ create_update()

IUpdatePtr Leosac::update::UpdateService::create_update ( const std::string &  update_descriptor_uuid,
const ExecutionContext ec 
)

Create an Update object corresponding to the update descriptor whose uuid is update_descriptor_uuid.

Note
Throw if the uuid doesn't reference anything anymore.
We call create_update() for each registered backend with a reference to the update descriptor. Backends can cast the descriptor object to check whether the call is really for them or not.

Definition at line 91 of file UpdateService.cpp.

◆ pending_updates()

std::vector< IUpdatePtr > Leosac::update::UpdateService::pending_updates ( )

Retrieve the list of pending updates.

Definition at line 71 of file UpdateService.cpp.

◆ register_backend()

void Leosac::update::UpdateService::register_backend ( UpdateBackendPtr  backend)

Register a backend object.

The backend is automatically deregistered when the backend object is deleted.

Definition at line 30 of file UpdateService.cpp.

Member Data Documentation

◆ ack_update_sig_

AckUpdateT Leosac::update::UpdateService::ack_update_sig_
private

Definition at line 182 of file UpdateService.hpp.

◆ cancel_update_sig_

CancelUpdateT Leosac::update::UpdateService::cancel_update_sig_
private

Definition at line 183 of file UpdateService.hpp.

◆ check_update_sig_

CheckUpdateT Leosac::update::UpdateService::check_update_sig_
private

Definition at line 180 of file UpdateService.hpp.

◆ create_update_sig_

CreateUpdateT Leosac::update::UpdateService::create_update_sig_
private

Definition at line 181 of file UpdateService.hpp.

◆ mutex_

std::mutex Leosac::update::UpdateService::mutex_
mutableprivate

Definition at line 163 of file UpdateService.hpp.

◆ published_descriptors_

std::map<std::string, UpdateDescriptorPtr> Leosac::update::UpdateService::published_descriptors_
private

Definition at line 185 of file UpdateService.hpp.


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