...
1 package cache
2
3 import (
4 "bytes"
5 "io"
6
7 "edge-infra.dev/pkg/f8n/warehouse/oci/layer"
8 )
9
10
11 type cachingLayer struct {
12 layer.Layer
13 cache *LazyCache
14 data []byte
15 }
16
17
18
19 func Layer(l layer.Layer, c *LazyCache, data []byte) layer.Layer {
20 return &cachingLayer{
21 Layer: l,
22 cache: c,
23 data: data,
24 }
25 }
26
27 func (c *cachingLayer) Compressed() (io.ReadCloser, error) {
28
29 return io.NopCloser(bytes.NewReader(c.data)), nil
30 }
31
32 func (c *cachingLayer) Uncompressed() (io.ReadCloser, error) {
33 return io.NopCloser(bytes.NewReader(c.data)), nil
34 }
35
View as plain text