@@ -36,24 +36,20 @@ import (
36
36
)
37
37
38
38
type localTransferService struct {
39
- leases leases.Manager
40
- content content.Store
41
- images images.Store
42
- verifiers map [string ]imageverifier.ImageVerifier
39
+ content content.Store
40
+ images images.Store
43
41
// limiter for upload
44
42
limiterU * semaphore.Weighted
45
43
// limiter for download operation
46
44
limiterD * semaphore.Weighted
47
45
config TransferConfig
48
46
}
49
47
50
- func NewTransferService (lm leases. Manager , cs content.Store , is images.Store , vfs map [ string ]imageverifier. ImageVerifier , tc * TransferConfig ) transfer.Transferrer {
48
+ func NewTransferService (cs content.Store , is images.Store , tc TransferConfig ) transfer.Transferrer {
51
49
ts := & localTransferService {
52
- leases : lm ,
53
- content : cs ,
54
- images : is ,
55
- verifiers : vfs ,
56
- config : * tc ,
50
+ content : cs ,
51
+ images : is ,
52
+ config : tc ,
57
53
}
58
54
if tc .MaxConcurrentUploadedLayers > 0 {
59
55
ts .limiterU = semaphore .NewWeighted (int64 (tc .MaxConcurrentUploadedLayers ))
@@ -142,7 +138,10 @@ func (ts *localTransferService) withLease(ctx context.Context, opts ...leases.Op
142
138
return ctx , nop , nil
143
139
}
144
140
145
- ls := ts .leases
141
+ ls := ts .config .Leases
142
+ if ls == nil {
143
+ return ctx , nop , nil
144
+ }
146
145
147
146
if len (opts ) == 0 {
148
147
// Use default lease configuration if no options provided
@@ -164,6 +163,9 @@ func (ts *localTransferService) withLease(ctx context.Context, opts ...leases.Op
164
163
}
165
164
166
165
type TransferConfig struct {
166
+ // Leases manager is used to create leases during operations if none, exists
167
+ Leases leases.Manager
168
+
167
169
// MaxConcurrentDownloads is the max concurrent content downloads for pull.
168
170
MaxConcurrentDownloads int
169
171
// MaxConcurrentUploadedLayers is the max concurrent uploads for push
@@ -182,6 +184,9 @@ type TransferConfig struct {
182
184
// UnpackPlatforms are used to specify supported combination of platforms and snapshotters
183
185
UnpackPlatforms []unpack.Platform
184
186
187
+ // ImageVerifiers verify the image before saving into the image store.
188
+ Verifiers map [string ]imageverifier.ImageVerifier
189
+
185
190
// RegistryConfigPath is a path to the root directory containing registry-specific configurations
186
191
RegistryConfigPath string
187
192
}
0 commit comments