Debian Codegraph @

src/fileops/davmeta.hpp

raw
1 /*
2 * This File is part of Davix, The IO library for HTTP based protocols
3 * Copyright (C) CERN 2013
4 * Author: Adrien Devresse <[email protected]>
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library 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 GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #ifndef DAVMETA_HPP
23 #define DAVMETA_HPP
24
25 #include <davixcontext.hpp>
26 #include <params/davixrequestparams.hpp>
27 #include <file/davfile.hpp>
28 #include <fileops/httpiochain.hpp>
29
30 namespace Davix{
31
32 struct DirHandle;
33
34 ///
35 /// \brief The HttpMetaOps class
36 ///
37 /// The HttpMetaOps handle all meta-data operations related to HTTP/Webdav
38 class HttpMetaOps : public HttpIOChain{
39 public:
40 HttpMetaOps();
41 virtual ~HttpMetaOps();
42
43 // calculate hecksum
44 virtual void checksum(IOChainContext & iocontext, std::string & checksm, const std::string & chk_algo);
45
46 // delete resource
47 virtual void deleteResource(IOChainContext & iocontext);
48
49 // make collection
50 virtual void makeCollection(IOChainContext & iocontext);
51
52 // move/rename resource
53 virtual void move(IOChainContext & iocontext, const std::string & target_url);
54
55 // get statInfo
56 virtual StatInfo & statInfo(IOChainContext & iocontext, StatInfo & st_info);
57
58 // get quota info
59 virtual QuotaInfo & quotaInfo(IOChainContext & iocontext, QuotaInfo &info);
60
61 virtual bool nextSubItem(IOChainContext &iocontext, std::string &entry_name, StatInfo &info);
62
63 private:
64
65 std::unique_ptr<DirHandle> directoryItem;
66 };
67
68
69 /// The HttpMetaOps handle all meta-data operations related to Aws S3
70 class S3MetaOps : public HttpIOChain{
71 public:
72 S3MetaOps();
73 virtual ~S3MetaOps();
74
75 // S3 + HTTP checksum computation
76 virtual void checksum(IOChainContext & iocontext, std::string & checksm, const std::string & chk_algo);
77
78 // move/rename resource
79 virtual void move(IOChainContext & iocontext, const std::string & target_url);
80
81 // get statInfo
82 virtual StatInfo & statInfo(IOChainContext & iocontext, StatInfo & st_info);
83
84 // make collection
85 virtual void makeCollection(IOChainContext & iocontext);
86
87 // listing
88 virtual bool nextSubItem(IOChainContext &iocontext, std::string &entry_name, StatInfo &info);
89
90 private:
91 std::unique_ptr<DirHandle> directoryItem;
92
93 };
94
95 /// Handle all meta-data operations related to Azure
96 class AzureMetaOps : public HttpIOChain{
97 public:
98 AzureMetaOps();
99 virtual ~AzureMetaOps();
100
101 // Azure + HTTP checksum computation
102 //virtual void checksum(IOChainContext & iocontext, std::string & checksm, const std::string & chk_algo);
103
104 // get statInfo
105 virtual StatInfo & statInfo(IOChainContext & iocontext, StatInfo & st_info);
106
107 // make collection
108 //virtual void makeCollection(IOChainContext & iocontext);
109
110 // listing
111 virtual bool nextSubItem(IOChainContext &iocontext, std::string &entry_name, StatInfo &info);
112
113 private:
114 std::unique_ptr<DirHandle> directoryItem;
115
116 };
117
118 /// Handle all meta-data operations related to Swift
119 class SwiftMetaOps : public HttpIOChain{
120 public:
121 SwiftMetaOps();
122 virtual ~SwiftMetaOps();
123
124 // move/rename resource
125 virtual void move(IOChainContext & iocontext, const std::string & target_url);
126
127 // get statInfo
128 virtual StatInfo & statInfo(IOChainContext & iocontext, StatInfo & st_info);
129
130 // listing
131 virtual bool nextSubItem(IOChainContext &iocontext, std::string &entry_name, StatInfo &info);
132
133 private:
134 std::unique_ptr<DirHandle> directoryItem;
135
136 };
137
138
139 } // Davix
140
141
142 #endif // DAVMETA_HPP