BuildCache
s3_cache_provider.hpp
1 //--------------------------------------------------------------------------------------------------
2 // Copyright (c) 2019 Marcus Geelnard
3 //
4 // This software is provided 'as-is', without any express or implied warranty. In no event will the
5 // authors be held liable for any damages arising from the use of this software.
6 //
7 // Permission is granted to anyone to use this software for any purpose, including commercial
8 // applications, and to alter it and redistribute it freely, subject to the following restrictions:
9 //
10 // 1. The origin of this software must not be misrepresented; you must not claim that you wrote
11 // the original software. If you use this software in a product, an acknowledgment in the
12 // product documentation would be appreciated but is not required.
13 //
14 // 2. Altered source versions must be plainly marked as such, and must not be misrepresented as
15 // being the original software.
16 //
17 // 3. This notice may not be removed or altered from any source distribution.
18 //--------------------------------------------------------------------------------------------------
19 
20 #ifndef BUILDCACHE_S3_CACHE_PROVIDER_HPP_
21 #define BUILDCACHE_S3_CACHE_PROVIDER_HPP_
22 
23 #include <cache/http_cache_provider.hpp>
24 
25 namespace bcache {
26 
28 public:
29  // Override S3 specific parts of the http_cache_provider_t.
30  bool connect(const std::string& host_description) override;
31 
32 private:
36  std::string sign_string(const std::string& str) const;
37 
38  std::vector<std::string> get_header(const std::string& method,
39  const std::string& key) const override;
40 
41  std::string m_access;
42  std::string m_secret;
43 };
44 
45 } // namespace bcache
46 
47 #endif // BUILDCACHE_S3_CACHE_PROVIDER_HPP_
bcache::s3_cache_provider_t
Definition: s3_cache_provider.hpp:27
bcache::http_cache_provider_t
Definition: http_cache_provider.hpp:27
bcache
The top level namespace.
Definition: compressor.cpp:34
bcache::s3_cache_provider_t::get_header
std::vector< std::string > get_header(const std::string &method, const std::string &key) const override
Get the headers for the HTTP request.
Definition: s3_cache_provider.cpp:72
bcache::s3_cache_provider_t::connect
bool connect(const std::string &host_description) override
Connect to the remote cache.
Definition: s3_cache_provider.cpp:59
bcache::s3_cache_provider_t::sign_string
std::string sign_string(const std::string &str) const
Sign a string (to create an AWS authorization string).
Definition: s3_cache_provider.cpp:89