github.com/uber/kraken@v0.1.4/lib/store/config.go (about) 1 // Copyright (c) 2016-2019 Uber Technologies, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 package store 15 16 // Volume - if provided, volumes are used to store the actual files. 17 // Symlinks will be created under state directories. 18 // This configuration is needed on hosts with multiple disks. 19 type Volume struct { 20 Location string 21 Weight int 22 } 23 24 // CAStoreConfig defines CAStore configuration. 25 type CAStoreConfig struct { 26 UploadDir string `yaml:"upload_dir"` 27 CacheDir string `yaml:"cache_dir"` 28 Volumes []Volume `yaml:"volumes"` 29 Capacity int `yaml:"capacity"` 30 UploadCleanup CleanupConfig `yaml:"upload_cleanup"` 31 CacheCleanup CleanupConfig `yaml:"cache_cleanup"` 32 } 33 34 func (c CAStoreConfig) applyDefaults() CAStoreConfig { 35 if c.Capacity == 0 { 36 c.Capacity = 1 << 20 // 1 million 37 } 38 return c 39 } 40 41 // SimpleStoreConfig defines SimpleStore configuration. 42 type SimpleStoreConfig struct { 43 UploadDir string `yaml:"upload_dir"` 44 CacheDir string `yaml:"cache_dir"` 45 UploadCleanup CleanupConfig `yaml:"upload_cleanup"` 46 CacheCleanup CleanupConfig `yaml:"cache_cleanup"` 47 } 48 49 // CADownloadStoreConfig defines CADownloadStore configuration. 50 // TODO(evelynl94): rename 51 type CADownloadStoreConfig struct { 52 DownloadDir string `yaml:"download_dir"` 53 CacheDir string `yaml:"cache_dir"` 54 DownloadCleanup CleanupConfig `yaml:"download_cleanup"` 55 CacheCleanup CleanupConfig `yaml:"cache_cleanup"` 56 }