Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
ostree_http_repo.h
1 #ifndef SOTA_CLIENT_TOOLS_OSTREE_HTTP_REPO_H_
2 #define SOTA_CLIENT_TOOLS_OSTREE_HTTP_REPO_H_
3 
4 #include <boost/filesystem.hpp>
5 
6 #include "ostree_ref.h"
7 #include "ostree_repo.h"
8 #include "treehub_server.h"
9 
10 class OSTreeHttpRepo : public OSTreeRepo {
11  public:
12  explicit OSTreeHttpRepo(TreehubServer* server, const boost::filesystem::path& root_in = "")
13  : server_(server), root_(root_in) {
14  if (root_.empty()) {
15  root_ = root_tmp_.Path();
16  }
17  }
18  ~OSTreeHttpRepo() override = default;
19 
20  bool LooksValid() const override;
21  OSTreeRef GetRef(const std::string& refname) const override;
22  const boost::filesystem::path root() const override { return root_; }
23 
24  private:
25  bool FetchObject(const boost::filesystem::path& path) const override;
26  static size_t curl_handle_write(void* buffer, size_t size, size_t nmemb, void* userp);
27 
28  TreehubServer* server_;
29  boost::filesystem::path root_;
30  const TemporaryDirectory root_tmp_;
31 };
32 
33 // vim: set tabstop=2 shiftwidth=2 expandtab:
34 #endif // SOTA_CLIENT_TOOLS_OSTREE_HTTP_REPO_H_
TreehubServer
Definition: treehub_server.h:11
TemporaryDirectory
Definition: utils.h:82
OSTreeRepo
A source repository to read OSTree objects from.
Definition: ostree_repo.h:19
OSTreeHttpRepo
Definition: ostree_http_repo.h:10
OSTreeRef
Definition: ostree_ref.h:13