libzypp  17.36.7
zckhelper.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 ----------------------------------------------------------------------/
9 *
10 * This file contains private API, this might break at any time between releases.
11 * You have been warned!
12 *
13 */
14 #ifndef ZYPPNG_CURL_ZCKHELPER_H_INCLUDED
15 #define ZYPPNG_CURL_ZCKHELPER_H_INCLUDED
16 
19 
20 namespace zyppng {
21 
22  class ZckHelper {
23  public:
24 
25  using Block = RangeDesc;
26 
27  struct PrepareResult {
28  enum Code {
29  Error, // we got an error
30  NothingToDo, // Target file is already complete
31  ExceedsMaxLen, // Zchunk header reports a different filesize than what was expected
32  Success // Returns a list of blocks to fetch
33  };
34 
36  std::vector<Block> _blocks;
38  std::string _message;
39  };
40 
44  static bool isZchunkFile(const zypp::Pathname &file);
45 
50  static PrepareResult prepareZck ( const zypp::Pathname &delta, const zypp::Pathname &target, const zypp::ByteCount &expectedFileSize );
51 
55  static bool validateZckFile( const zypp::Pathname &file, std::string &error );
56  };
57 }
58 #endif
zypp::ByteCount _bytesReused
Definition: zckhelper.h:37
Store and operate with byte count.
Definition: ByteCount.h:31
std::vector< Block > _blocks
Definition: zckhelper.h:36
static bool isZchunkFile(const zypp::Pathname &file)
Definition: zckhelper.cc:21
static bool validateZckFile(const zypp::Pathname &file, std::string &error)
Definition: zckhelper.cc:169
static PrepareResult prepareZck(const zypp::Pathname &delta, const zypp::Pathname &target, const zypp::ByteCount &expectedFileSize)
Definition: zckhelper.cc:34