| 1 |
/* |
| 2 |
Copyright The containerd Authors. |
| 3 |
|
| 4 |
Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
you may not use this file except in compliance with the License. |
| 6 |
You may obtain a copy of the License at |
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software |
| 11 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
See the License for the specific language governing permissions and |
| 14 |
limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
/* |
| 18 |
Copyright 2019 The Go Authors. All rights reserved. |
| 19 |
Use of this source code is governed by a BSD-style |
| 20 |
license that can be found in the NOTICE.md file. |
| 21 |
*/ |
| 22 |
|
| 23 |
package config |
| 24 |
|
| 25 |
const ( |
| 26 |
// TargetSkipVerifyLabel is a snapshot label key that indicates to skip content |
| 27 |
// verification for the layer. |
| 28 |
TargetSkipVerifyLabel = "containerd.io/snapshot/remote/stargz.skipverify" |
| 29 |
|
| 30 |
// TargetPrefetchSizeLabel is a snapshot label key that indicates size to prefetch |
| 31 |
// the layer. If the layer is eStargz and contains prefetch landmarks, these config |
| 32 |
// will be respeced. |
| 33 |
TargetPrefetchSizeLabel = "containerd.io/snapshot/remote/stargz.prefetch" |
| 34 |
) |
| 35 |
|
| 36 |
type Config struct { |
| 37 |
HTTPCacheType string `toml:"http_cache_type"` |
| 38 |
FSCacheType string `toml:"filesystem_cache_type"` |
| 39 |
// ResolveResultEntryTTLSec is TTL (in sec) to cache resolved layers for |
| 40 |
// future use. (default 120s) |
| 41 |
ResolveResultEntryTTLSec int `toml:"resolve_result_entry_ttl_sec"` |
| 42 |
ResolveResultEntry int `toml:"resolve_result_entry"` // deprecated |
| 43 |
PrefetchSize int64 `toml:"prefetch_size"` |
| 44 |
PrefetchTimeoutSec int64 `toml:"prefetch_timeout_sec"` |
| 45 |
NoPrefetch bool `toml:"noprefetch"` |
| 46 |
NoBackgroundFetch bool `toml:"no_background_fetch"` |
| 47 |
Debug bool `toml:"debug"` |
| 48 |
AllowNoVerification bool `toml:"allow_no_verification"` |
| 49 |
DisableVerification bool `toml:"disable_verification"` |
| 50 |
MaxConcurrency int64 `toml:"max_concurrency"` |
| 51 |
NoPrometheus bool `toml:"no_prometheus"` |
| 52 |
|
| 53 |
// BlobConfig is config for layer blob management. |
| 54 |
BlobConfig `toml:"blob"` |
| 55 |
|
| 56 |
// DirectoryCacheConfig is config for directory-based cache. |
| 57 |
DirectoryCacheConfig `toml:"directory_cache"` |
| 58 |
|
| 59 |
FuseConfig `toml:"fuse"` |
| 60 |
} |
| 61 |
|
| 62 |
type BlobConfig struct { |
| 63 |
ValidInterval int64 `toml:"valid_interval"` |
| 64 |
CheckAlways bool `toml:"check_always"` |
| 65 |
// ChunkSize is the granularity at which background fetch and on-demand reads |
| 66 |
// are fetched from the remote registry. |
| 67 |
ChunkSize int64 `toml:"chunk_size"` |
| 68 |
FetchTimeoutSec int64 `toml:"fetching_timeout_sec"` |
| 69 |
ForceSingleRangeMode bool `toml:"force_single_range_mode"` |
| 70 |
// PrefetchChunkSize is the maximum bytes transferred per http GET from remote registry |
| 71 |
// during prefetch. It is recommended to have PrefetchChunkSize > ChunkSize. |
| 72 |
// If PrefetchChunkSize < ChunkSize prefetch bytes will be fetched as a single http GET, |
| 73 |
// else total GET requests for prefetch = ceil(PrefetchSize / PrefetchChunkSize). |
| 74 |
PrefetchChunkSize int64 `toml:"prefetch_chunk_size"` |
| 75 |
|
| 76 |
MaxRetries int `toml:"max_retries"` |
| 77 |
MinWaitMSec int `toml:"min_wait_msec"` |
| 78 |
MaxWaitMSec int `toml:"max_wait_msec"` |
| 79 |
} |
| 80 |
|
| 81 |
type DirectoryCacheConfig struct { |
| 82 |
MaxLRUCacheEntry int `toml:"max_lru_cache_entry"` |
| 83 |
MaxCacheFds int `toml:"max_cache_fds"` |
| 84 |
SyncAdd bool `toml:"sync_add"` |
| 85 |
Direct bool `toml:"direct" default:"true"` |
| 86 |
} |
| 87 |
|
| 88 |
type FuseConfig struct { |
| 89 |
// AttrTimeout defines overall timeout attribute for a file system in seconds. |
| 90 |
AttrTimeout int64 `toml:"attr_timeout"` |
| 91 |
|
| 92 |
// EntryTimeout defines TTL for directory, name lookup in seconds. |
| 93 |
EntryTimeout int64 `toml:"entry_timeout"` |
| 94 |
} |