aboutsummaryrefslogtreecommitdiffstats
path: root/document/src/main/java/com/yahoo/document/CompressionConfig.java
blob: 2fa4e40d5b6bd06e124b837650dfe42fea8b467d (plain) (blame)
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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.document;

import com.yahoo.compress.CompressionType;


public class CompressionConfig {

    public CompressionConfig(CompressionType type,
                             int level,
                             float threshold,
                             long minSize)
    {
        this.type = type;
        this.compressionLevel = level;
        this.threshold = threshold;
        this.minsize = minSize;
    }

    public CompressionConfig() {
        this(CompressionType.NONE, 9, 95, 0);
    }

    public CompressionConfig(CompressionType type) {
        this(type, 9, 95, 0);
    }

    public CompressionConfig(CompressionType type, int level, float threshold) {
        this(type, level, threshold, 0);
    }

    public final CompressionType type;
    public int compressionLevel;
    public float threshold;
    public final long minsize;

    /** get a multiplier for comparing compressed and original size */
    public float thresholdFactor() { return 0.01f * threshold; }
}