Mercurial > hg > orthanc-object-storage
annotate Common/IStorage.h @ 207:ee2c53ebdf3e
todo
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Wed, 26 Jun 2024 17:55:56 +0200 |
parents | 6dd8bb916573 |
children |
rev | line source |
---|---|
1 | 1 /** |
2 * Cloud storage plugins for Orthanc | |
145
3c7e0374f28e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
3 * Copyright (C) 2020-2023 Osimis S.A., Belgium |
3c7e0374f28e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
4 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
3c7e0374f28e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
111
diff
changeset
|
5 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU Affero General Public License | |
9 * as published by the Free Software Foundation, either version 3 of | |
10 * the License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Affero General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Affero General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
56
b922ae86bbe1
full static linking against AWS SDK
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
39
diff
changeset
|
21 |
1 | 22 #pragma once |
23 | |
24 #include <orthanc/OrthancCPlugin.h> | |
25 #include <OrthancPluginCppWrapper.h> | |
26 | |
27 class StoragePluginException : public std::runtime_error | |
28 { | |
29 public: | |
153 | 30 explicit StoragePluginException(const std::string& what) |
1 | 31 : std::runtime_error(what) |
32 { | |
33 } | |
34 }; | |
35 | |
36 | |
37 | |
38 | |
39 // each "plugin" must also provide these global methods | |
40 //class XXXStoragePluginFactory | |
41 //{ | |
42 //public: | |
43 // const char* GetStoragePluginName(); | |
78 | 44 // IStorage* CreateStorage(const OrthancPlugins::OrthancConfiguration& orthancConfig); |
1 | 45 //}; |
46 | |
153 | 47 class IStorage : public boost::noncopyable |
1 | 48 { |
49 public: | |
50 class IWriter | |
51 { | |
52 public: | |
53 IWriter() | |
54 {} | |
55 | |
56 virtual ~IWriter() {} | |
57 virtual void Write(const char* data, size_t size) = 0; | |
58 }; | |
59 | |
60 class IReader | |
61 { | |
62 public: | |
63 IReader() | |
64 {} | |
65 | |
66 virtual ~IReader() {} | |
67 virtual size_t GetSize() = 0; | |
39
50d0be413c42
implemented ReadRange (only in Azure plugin right now)
Alain Mazy <am@osimis.io>
parents:
37
diff
changeset
|
68 virtual void ReadWhole(char* data, size_t size) = 0; |
50d0be413c42
implemented ReadRange (only in Azure plugin right now)
Alain Mazy <am@osimis.io>
parents:
37
diff
changeset
|
69 virtual void ReadRange(char* data, size_t size, size_t fromOffset) = 0; |
1 | 70 }; |
71 | |
77 | 72 std::string nameForLogs_; |
1 | 73 public: |
78 | 74 IStorage(const std::string& nameForLogs): |
77 | 75 nameForLogs_(nameForLogs) |
76 {} | |
77 | |
153 | 78 virtual ~IStorage() |
79 { | |
80 } | |
81 | |
20 | 82 virtual void SetRootPath(const std::string& rootPath) = 0; |
1 | 83 |
84 virtual IWriter* GetWriterForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0; | |
85 virtual IReader* GetReaderForObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0; | |
77 | 86 virtual void DeleteObject(const char* uuid, OrthancPluginContentType type, bool encryptionEnabled) = 0; // returns true only if 100% sure that the file has been deleted, false otherwise |
87 | |
88 const std::string& GetNameForLogs() {return nameForLogs_;} | |
111
407bd022b0cf
in /move-storage: now detecting if file should be moved or not
Alain Mazy <am@osimis.io>
parents:
78
diff
changeset
|
89 |
407bd022b0cf
in /move-storage: now detecting if file should be moved or not
Alain Mazy <am@osimis.io>
parents:
78
diff
changeset
|
90 virtual bool HasFileExists() = 0; |
407bd022b0cf
in /move-storage: now detecting if file should be moved or not
Alain Mazy <am@osimis.io>
parents:
78
diff
changeset
|
91 virtual bool FileExists(const std::string& uuid, OrthancPluginContentType type, bool encryptionEnabled) {return false;} |
1 | 92 }; |