ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
 
#ifndef _BSDIFF_PATCH_WRITER_FACTORY_H_
#define _BSDIFF_PATCH_WRITER_FACTORY_H_
 
#include <memory>
#include <string>
#include <vector>
 
#include "bsdiff/common.h"
#include "bsdiff/constants.h"
#include "bsdiff/patch_writer_interface.h"
 
namespace bsdiff {
 
// Create a patch writer compatible with upstream's "BSDIFF40" patch format
// using bz2 as a compressor.
BSDIFF_EXPORT
std::unique_ptr<PatchWriterInterface> CreateBsdiffPatchWriter(
    const std::string& patch_filename);
 
// Create a patch writer using the "BSDF2" patch format. It uses the compressor
// specified in |type|. And the brotli compressor will have the compression
// quality |brotli_quality|.
BSDIFF_EXPORT
std::unique_ptr<PatchWriterInterface> CreateBSDF2PatchWriter(
    const std::string& patch_filename,
    CompressorType type,
    int brotli_quality);
 
// Create a patch writer using the "BSDF2" patch format. It also tries all the
// compressors in |types| to generate the smallest patch.
BSDIFF_EXPORT
std::unique_ptr<PatchWriterInterface> CreateBSDF2PatchWriter(
    const std::string& patch_filename,
    const std::vector<CompressorType>& types,
    int brotli_quality);
 
// Create a patch writer compatible with Android Play Store bsdiff patches.
// The data will be written to the passed |patch| vector, which must be valid
// until Close() is called or this patch is destroyed. The data will be
// compressed using the compressor type |type|. To get an uncompressed patch,
// pass CompressortType::kNoCompression.
BSDIFF_EXPORT
std::unique_ptr<PatchWriterInterface> CreateEndsleyPatchWriter(
    std::vector<uint8_t>* patch,
    CompressorType type,
    int brotli_quality);
 
// Helper function to create an Endsley patch writer with no compression.
BSDIFF_EXPORT
std::unique_ptr<PatchWriterInterface> CreateEndsleyPatchWriter(
    std::vector<uint8_t>* patch);
 
 
}  // namespace bsdiff
 
#endif  // _BSDIFF_PATCH_WRITER_FACTORY_H_