Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
ostree_ref.h
1 #ifndef SOTA_CLIENT_TOOLS_OSTREE_REF_H_
2 #define SOTA_CLIENT_TOOLS_OSTREE_REF_H_
3 
4 #include <sstream>
5 
6 #include <curl/curl.h>
7 #include <boost/filesystem.hpp>
8 
9 #include "ostree_hash.h"
10 #include "ostree_repo.h"
11 #include "treehub_server.h"
12 
13 class OSTreeRef {
14  public:
15  OSTreeRef(const OSTreeRepo& repo, const std::string& ref_name);
16  OSTreeRef(const TreehubServer& serve_repo, std::string ref_name);
17  OSTreeRef(OSTreeRef&& rhs) = default;
18 
19  void PushRef(const TreehubServer& push_target, CURL* curl_handle) const;
20 
21  OSTreeHash GetHash() const;
22  std::string GetName() const { return ref_name_; };
23 
24  bool IsValid() const;
25 
26  private:
27  std::string Url() const;
28  bool is_valid{};
29 
30  std::string ref_content_;
31  const std::string ref_name_; // OSTree name of the object
32  std::stringstream http_response_;
33 
34  static size_t curl_handle_write(void* buffer, size_t size, size_t nmemb, void* userp);
35 };
36 
37 // vim: set tabstop=2 shiftwidth=2 expandtab:
38 #endif // SOTA_CLIENT_TOOLS_OSTREE_REF_H_
OSTreeHash
Definition: ostree_hash.h:10
TreehubServer
Definition: treehub_server.h:11
OSTreeRepo
A source repository to read OSTree objects from.
Definition: ostree_repo.h:19
OSTreeRef
Definition: ostree_ref.h:13