Skip to content

Commit 162fb42

Browse files
authored
Merge pull request fanal#57 from aquasecurity/switch-to-raw-encoding
cache: Switch to Raw encoding.
2 parents 7ef1e5f + 7d0165c commit 162fb42

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

extractor/docker/docker.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func NewDockerExtractor(option types.DockerOption) (Extractor, error) {
101101
return NewDockerExtractorWithCache(option, bolt.Options{
102102
RootBucketName: "fanal",
103103
Path: utils.CacheDir() + "/cache.db", // TODO: Make this configurable via a public method
104-
Codec: encoding.Gob,
104+
Codec: encoding.Raw,
105105
})
106106
}
107107

@@ -200,7 +200,7 @@ func (d Extractor) SaveLocalImage(ctx context.Context, imageName string) (io.Rea
200200
return nil, xerrors.Errorf("failed to read saved image: %w", err)
201201
}
202202

203-
e, err := zstd.NewWriter(nil, zstd.WithEncoderLevel(zstd.SpeedDefault))
203+
e, err := zstd.NewWriter(nil, zstd.WithEncoderLevel(zstd.SpeedFastest))
204204
if err != nil {
205205
return nil, err
206206
}
@@ -420,7 +420,7 @@ func getFilteredTarballBuffer(tr *tar.Reader, requiredFilenames []string) (bytes
420420
func (d Extractor) storeLayerInCache(cacheBuf bytes.Buffer, dig digest.Digest) {
421421
// compress tar to zstd before storing to cache
422422
var dst bytes.Buffer
423-
w, _ := zstd.NewWriter(&dst)
423+
w, _ := zstd.NewWriter(&dst, zstd.WithEncoderLevel(zstd.SpeedFastest))
424424
_, _ = io.Copy(w, &cacheBuf)
425425
_ = w.Close()
426426

7 Bytes
Binary file not shown.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348
2020
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2
2121
github.com/pkg/errors v0.8.1
22-
github.com/simar7/gokv v0.3.2
22+
github.com/simar7/gokv v0.3.3-0.20191216080237-ab4446a6841b
2323
github.com/stretchr/testify v1.4.0
2424
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5
2525
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7

go.sum

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw
6060
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
6161
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 h1:UhxFibDNY/bfvqU5CAUmr9zpesgbU6SWc8/B4mflAE4=
6262
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNEkKy96OOhEzfZl+yxihPEzKnqJwvfuSUqbZE=
63+
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
6364
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
6465
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
6566
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
@@ -173,12 +174,8 @@ github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7z
173174
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
174175
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
175176
github.com/shurcooL/httpfs v0.0.0-20181222201310-74dc9339e414/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
176-
github.com/simar7/gokv v0.1.0 h1:5DoScIR7r6w6DCJPXFlSGKU2SOmpLeSfZkINVyVaPmI=
177-
github.com/simar7/gokv v0.1.0/go.mod h1:vixfnOzH16g5QN5Uij1q4zSVbNp3iJu2D6xgIPM4ZSE=
178-
github.com/simar7/gokv v0.3.2 h1:UAcjZs5nsoAKyGxHMOJgGZs7Q9Yeub40Gb54YRW1Fo8=
179-
github.com/simar7/gokv v0.3.2/go.mod h1:jXjPspRkuCDCRTRBgfGsfXvW8ofOGh3Y+tjZvoFr7XU=
180-
github.com/simar7/gokv v0.3.3-0.20191213063627-21f89164966d h1:lsqk9OujJz7FwE7pP7ZMjH2pWaGO4QPSPEJ7JSsuOO8=
181-
github.com/simar7/gokv v0.3.3-0.20191213063627-21f89164966d/go.mod h1:jXjPspRkuCDCRTRBgfGsfXvW8ofOGh3Y+tjZvoFr7XU=
177+
github.com/simar7/gokv v0.3.3-0.20191216080237-ab4446a6841b h1:2qPkc0Hnrd6IhlxioXb0RG/NBmIPx2b5y9Z1IKriuxQ=
178+
github.com/simar7/gokv v0.3.3-0.20191216080237-ab4446a6841b/go.mod h1:jXjPspRkuCDCRTRBgfGsfXvW8ofOGh3Y+tjZvoFr7XU=
182179
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
183180
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
184181
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=

0 commit comments

Comments
 (0)