File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ package state
2
+
3
+ import (
4
+ "github.com/distribution/reference"
5
+ "github.com/opencontainers/go-digest"
6
+ )
7
+
8
+ type Pull interface {
9
+ Ref () reference.Named
10
+ Digest () * digest.Digest // can be nil when the pull is not yet complete
11
+ Layers () []Layer
12
+ Layer (id string ) Layer
13
+ }
14
+
15
+ type Layer interface {
16
+ Id () string
17
+ Status () string
18
+ }
19
+
20
+ type pullBase struct {
21
+ ref reference.Named
22
+ layers []Layer
23
+ }
24
+
25
+ func (p * pullBase ) Ref () reference.Named {
26
+ return p .ref
27
+ }
28
+
29
+ func (p * pullBase ) Digest () * digest.Digest {
30
+ return nil
31
+ }
32
+
33
+ func (p * pullBase ) Layers () []Layer {
34
+ return p .layers
35
+ }
36
+
37
+ func (p * pullBase ) Layer (id string ) Layer {
38
+ for _ , l := range p .layers {
39
+ if l .Id () == id {
40
+ return l
41
+ }
42
+ }
43
+ return nil
44
+ }
45
+
46
+ type layerBase struct {
47
+ id string
48
+ }
49
+
50
+ func (l * layerBase ) Id () string {
51
+ return l .id
52
+ }
You can’t perform that action at this time.
0 commit comments