GPtrArray *fallback_objects;
guint64 loose_compressed_size;
guint64 min_fallback_size_bytes;
+ guint64 max_bsdiff_size_bytes;
guint64 max_chunk_size_bytes;
guint64 rollsum_size;
guint n_rollsum;
const char *from,
const char *to,
ContentBsdiff **out_bsdiff,
+ guint64 max_bsdiff_size_bytes,
GCancellable *cancellable,
- GError **error)
+ GError **error)
{
gboolean ret = FALSE;
g_autoptr(GHashTable) from_bsdiff = NULL;
cancellable, error))
goto out;
- /* TODO: make this option configurable. */
- if (g_bytes_get_size (tmp_to) + g_bytes_get_size (tmp_from) > (200 * (1 << 20)))
+ if (g_bytes_get_size (tmp_to) + g_bytes_get_size (tmp_from) > max_bsdiff_size_bytes)
{
ret = TRUE;
goto out;
if (!(opts & DELTAOPT_FLAG_DISABLE_BSDIFF))
{
if (!try_content_bsdiff (repo, from_checksum, to_checksum,
- &bsdiff, cancellable, error))
+ &bsdiff, builder->max_bsdiff_size_bytes,
+ cancellable, error))
goto out;
if (bsdiff)
* are known:
* - min-fallback-size: u: Minimume uncompressed size in megabytes to use fallback
* - max-chunk-size: u: Maximum size in megabytes of a delta part
+ * - max-bsdiff-size: u: Maximum size in megabytes to consider bsdiff compression
+ * for input files
* - compression: y: Compression type: 0=none, x=lzma, g=gzip
* - bsdiff-enabled: b: Enable bsdiff compression. Default TRUE.
* - verbose: b: Print diagnostic messages. Default FALSE.
OstreeStaticDeltaBuilder builder = { 0, };
guint i;
guint min_fallback_size;
+ guint max_bsdiff_size;
guint max_chunk_size;
GVariant *metadata_source;
DeltaOpts delta_opts = DELTAOPT_FLAG_NONE;
min_fallback_size = 4;
builder.min_fallback_size_bytes = ((guint64)min_fallback_size) * 1000 * 1000;
+ if (!g_variant_lookup (params, "max-bsdiff-size", "u", &max_bsdiff_size))
+ max_bsdiff_size = 128;
+ builder.max_bsdiff_size_bytes = ((guint64)max_bsdiff_size) * 1000 * 1000;
if (!g_variant_lookup (params, "max-chunk-size", "u", &max_chunk_size))
max_chunk_size = 32;
builder.max_chunk_size_bytes = ((guint64)max_chunk_size) * 1000 * 1000;
static char *opt_from_rev;
static char *opt_to_rev;
static char *opt_min_fallback_size;
+static char *opt_max_bsdiff_size;
static char *opt_max_chunk_size;
static gboolean opt_empty;
static gboolean opt_disable_bsdiff;
{ "to", 0, 0, G_OPTION_ARG_STRING, &opt_to_rev, "Create delta to revision REV", "REV" },
{ "disable-bsdiff", 0, 0, G_OPTION_ARG_NONE, &opt_disable_bsdiff, "Disable use of bsdiff", NULL },
{ "min-fallback-size", 0, 0, G_OPTION_ARG_STRING, &opt_min_fallback_size, "Minimum uncompressed size in megabytes for individual HTTP request", NULL},
+ { "max-bsdiff-size", 0, 0, G_OPTION_ARG_STRING, &opt_max_bsdiff_size, "Maximum size in megabytes to consider bsdiff compression for input files", NULL},
{ "max-chunk-size", 0, 0, G_OPTION_ARG_STRING, &opt_max_chunk_size, "Maximum size of delta chunks in megabytes", NULL},
{ NULL }
};
if (opt_min_fallback_size)
g_variant_builder_add (parambuilder, "{sv}",
"min-fallback-size", g_variant_new_uint32 (g_ascii_strtoull (opt_min_fallback_size, NULL, 10)));
+ if (opt_max_bsdiff_size)
+ g_variant_builder_add (parambuilder, "{sv}",
+ "max-bsdiff-size", g_variant_new_uint32 (g_ascii_strtoull (opt_max_bsdiff_size, NULL, 10)));
if (opt_max_chunk_size)
g_variant_builder_add (parambuilder, "{sv}",
"max-chunk-size", g_variant_new_uint32 (g_ascii_strtoull (opt_max_chunk_size, NULL, 10)));