1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2000-2012 Free Software Foundation Europe e.V.
5    Copyright (C) 2011-2012 Planets Communications B.V.
6    Copyright (C) 2019-2019 Bareos GmbH & Co. KG
7 
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version three of the GNU Affero General Public
10    License as published by the Free Software Foundation and included
11    in the file LICENSE.
12 
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    Affero General Public License for more details.
17 
18    You should have received a copy of the GNU Affero General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22 */
23 
24 #ifndef BAREOS_LIB_RECENT_JOB_RESULTS_LIST_H
25 #define BAREOS_LIB_RECENT_JOB_RESULTS_LIST_H
26 
27 namespace RecentJobResultsList {
28 
29 struct JobResult {
30   // !! this plain data structure will be written to a file
31   char pad[16]{0};
32   int32_t Errors = 0;  // FD/SD errors
33   int32_t JobType = 0;
34   int32_t JobStatus = 0;
35   int32_t JobLevel = 0;
36   uint32_t JobId = 0;
37   uint32_t VolSessionId = 0;
38   uint32_t VolSessionTime = 0;
39   uint32_t JobFiles = 0;
40   uint64_t JobBytes = 0;
41   utime_t start_time = 0;
42   utime_t end_time = 0;
43   char Job[MAX_NAME_LENGTH]{0};
44 };
45 
46 void Append(JobControlRecord* jcr);
47 
48 std::vector<RecentJobResultsList::JobResult> Get();
49 RecentJobResultsList::JobResult GetMostRecentJobResult();
50 std::size_t Count();
51 bool IsEmpty();
52 
53 bool ExportToFile(std::ofstream& f);
54 bool ImportFromFile(std::ifstream& f);
55 
56 void Cleanup();
57 
58 }  // namespace RecentJobResultsList
59 
60 
61 #endif  // BAREOS_LIB_RECENT_JOB_RESULTS_LIST_H
62