Leosac  0.8.0
Open Source Access Control
Update.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #include "Update.hpp"
21 
22 namespace Leosac
23 {
24 namespace update
25 {
26 
28  : id_(0)
29  , generated_at_(std::chrono::system_clock::now())
30  , status_(Status::TRANSIENT)
31  , odb_version_(0)
32 {
33 }
34 
36 {
37  return id_;
38 }
39 
41 {
42  return generated_at_;
43 }
44 
45 
47 {
48  return status_;
49 }
50 
52 {
53  status_updated_at_ = std::chrono::system_clock::now();
54  status_ = st;
55 }
56 
58 {
59  return status_updated_at_;
60 }
61 
63 {
64  checkpoint_.last(audit);
65 }
66 
68 {
69  return checkpoint_.last_id();
70 }
71 
72 const std::string &Update::source_module() const
73 {
74  return source_module_;
75 }
76 
77 void Update::source_module(const std::string &s)
78 {
79  source_module_ = s;
80 }
81 
82 const std::string &Update::description() const
83 {
84  return description_;
85 }
86 void Update::description(const std::string &d)
87 {
88  description_ = d;
89 }
90 }
91 }
Leosac::update::Update::status_updated_at_
TimePoint status_updated_at_
Last timepoint when status was updated.
Definition: Update.hpp:81
Leosac::update::Update::status_
Status status_
Definition: Update.hpp:96
Leosac::update::Update::status_updated_at
virtual const TimePoint & status_updated_at() const override
Definition: Update.cpp:57
Leosac::Audit::AuditEntryPtr
std::shared_ptr< AuditEntry > AuditEntryPtr
Definition: AuditFwd.hpp:81
Leosac::update::Update::status
virtual Status status() const override
Definition: Update.cpp:46
Leosac::Audit::AuditEntryId
unsigned long AuditEntryId
Definition: AuditFwd.hpp:31
Leosac::Audit::AuditTracker::last
void last(AuditEntryLPtr)
Set the last tracked audit entry.
Definition: AuditTracker.cpp:35
Leosac::update::Update::source_module_
std::string source_module_
The name (as returned by get_module_name()) that created this update.
Definition: Update.hpp:89
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::update::Update::description
virtual const std::string & description() const override
Definition: Update.cpp:82
Leosac::update::Update::generated_at_
TimePoint generated_at_
Definition: Update.hpp:68
Leosac::update::Update::set_checkpoint
virtual void set_checkpoint(Audit::AuditEntryPtr) override
Set the checkpoint for the update object.
Definition: Update.cpp:62
Leosac::update::Status
Status
Definition: UpdateFwd.hpp:30
Leosac::update::IUpdate::TimePoint
std::chrono::system_clock::time_point TimePoint
Definition: IUpdate.hpp:33
Leosac::update::Update::generated_at
virtual const TimePoint & generated_at() const override
Definition: Update.cpp:40
Leosac::update::Update::get_checkpoint
virtual Audit::AuditEntryId get_checkpoint() const override
Definition: Update.cpp:67
Leosac::update::Update::Update
Update()
Definition: Update.cpp:27
Leosac::Audit::AuditTracker::last_id
virtual AuditEntryId last_id() const
Definition: AuditTracker.cpp:28
Leosac::update::Update::id_
UpdateId id_
Definition: Update.hpp:66
Leosac::update::Update::description_
std::string description_
Optional description for the update.
Definition: Update.hpp:94
Leosac::update::Update::checkpoint_
Audit::AuditTracker checkpoint_
Tracks the audit entry that represents the point in time of this update.
Definition: Update.hpp:74
Leosac::update::Update::source_module
virtual const std::string & source_module() const override
Definition: Update.cpp:72
Leosac::update::Update::id
virtual UpdateId id() const override
Definition: Update.cpp:35
Update.hpp
Leosac::update::UpdateId
unsigned long UpdateId
Definition: UpdateFwd.hpp:56
Leosac::update::Status::TRANSIENT
@ TRANSIENT