1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2018-2018 Bareos GmbH & Co. KG
5 
6    This program is Free Software; you can redistribute it and/or
7    modify it under the terms of version three of the GNU Affero General Public
8    License as published by the Free Software Foundation and included
9    in the file LICENSE.
10 
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14    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, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19    02110-1301, USA.
20 */
21 
22 #ifndef BAREOS_DIRD_JOB_H_
23 #define BAREOS_DIRD_JOB_H_
24 
25 class JobControlRecord;
26 
27 namespace directordaemon {
28 
29 class UaContext;
30 class JobResource;
31 class UnifiedStorageResource;
32 class RunResource;
33 
34 bool AllowDuplicateJob(JobControlRecord* jcr);
35 JobControlRecord* NewDirectorJcr();
36 void SetJcrDefaults(JobControlRecord* jcr, JobResource* job);
37 void CreateUniqueJobName(JobControlRecord* jcr, const char* base_name);
38 void UpdateJobEndRecord(JobControlRecord* jcr);
39 bool GetOrCreateClientRecord(JobControlRecord* jcr);
40 bool GetOrCreateFilesetRecord(JobControlRecord* jcr);
41 DBId_t GetOrCreatePoolRecord(JobControlRecord* jcr, char* pool_name);
42 bool GetLevelSinceTime(JobControlRecord* jcr);
43 void ApplyPoolOverrides(JobControlRecord* jcr, bool force = false);
44 JobId_t RunJob(JobControlRecord* jcr);
45 bool CancelJob(UaContext* ua, JobControlRecord* jcr);
46 void GetJobStorage(UnifiedStorageResource* store,
47                    JobResource* job,
48                    RunResource* run);
49 void InitJcrJobRecord(JobControlRecord* jcr);
50 void UpdateJobEnd(JobControlRecord* jcr, int TermCode);
51 bool SetupJob(JobControlRecord* jcr, bool suppress_output = false);
52 void ExecuteJob(JobControlRecord* jcr);
53 void CreateClones(JobControlRecord* jcr);
54 int CreateRestoreBootstrapFile(JobControlRecord* jcr);
55 void DirdFreeJcr(JobControlRecord* jcr);
56 void DirdFreeJcrPointers(JobControlRecord* jcr);
57 void CancelStorageDaemonJob(JobControlRecord* jcr);
58 bool RunConsoleCommand(JobControlRecord* jcr, const char* cmd);
59 void SdMsgThreadSendSignal(JobControlRecord* jcr, int sig);
60 void InitJobServer(int max_workers);
61 void TermJobServer();
62 
63 } /* namespace directordaemon */
64 #endif  // BAREOS_DIRD_JOB_H_
65