annotate Framework/Common/RetryDatabaseFactory.h @ 434:23c7af6f671a pg-transactions

DeleteResource does not need the RemainingAncestor table anymore
author Alain Mazy <am@osimis.io>
date Wed, 13 Dec 2023 16:52:06 +0100
parents 3d6886f3e5b3
children ecd0b719cff5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
227
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
389
3d6886f3e5b3 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
3d6886f3e5b3 upgrade to year 2023
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 359
diff changeset
6 * Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
227
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 *
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * This program is free software: you can redistribute it and/or
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * modify it under the terms of the GNU Affero General Public License
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * as published by the Free Software Foundation, either version 3 of
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * the License, or (at your option) any later version.
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 *
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful, but
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * Affero General Public License for more details.
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 *
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU Affero General Public License
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 **/
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #pragma once
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "IDatabaseFactory.h"
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include <Compatibility.h>
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 namespace OrthancDatabases
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 {
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 class RetryDatabaseFactory : public IDatabaseFactory
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 {
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 private:
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 unsigned int maxConnectionRetries_;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 unsigned int connectionRetryInterval_;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 protected:
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 virtual IDatabase* TryOpen() = 0;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 public:
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 RetryDatabaseFactory(unsigned int maxConnectionRetries,
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 unsigned int connectionRetryInterval) :
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 maxConnectionRetries_(maxConnectionRetries),
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 connectionRetryInterval_(connectionRetryInterval)
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 {
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 }
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 virtual IDatabase* Open() ORTHANC_OVERRIDE;
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 };
39cb02035f54 added missing files
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 }