forked from dragonflyoss/dragonfly-archived
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the storage function module (dragonflyoss#289)
* feat: refactor cdn storage module Signed-off-by: santong <[email protected]>
- Loading branch information
Showing
37 changed files
with
1,096 additions
and
1,039 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2020 The Dragonfly Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package config | ||
|
||
import ( | ||
"path/filepath" | ||
|
||
"d7y.io/dragonfly/v2/pkg/basic" | ||
) | ||
|
||
var ( | ||
DefaultDiskBaseDir = filepath.Join(basic.HomeDir, "ftp") | ||
|
||
DefaultMemoryBaseDir = "/dev/shm/dragonfly" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
base: | ||
# listenPort is the port cdn server listens on. | ||
# default: 8003 | ||
listenPort: 8003 | ||
|
||
# DownloadPort is the port for download files from cdn. | ||
# And you should start a file server firstly which listens on the download port. | ||
# default: 8001 | ||
downloadPort: 8001 | ||
|
||
# SystemReservedBandwidth is the network bandwidth reserved for system software. | ||
# default: 20 MB, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. | ||
systemReservedBandwidth: 20M | ||
|
||
# MaxBandwidth is the network bandwidth that cdn can use. | ||
# default: 1G, in format of G(B)/g/M(B)/m/K(B)/k/B, pure number will also be parsed as Byte. | ||
maxBandwidth: 1G | ||
|
||
# FailAccessInterval is the interval time after failed to access the URL. | ||
# If a task failed to be downloaded from the source, it will not be retried in the time since the last failure. | ||
# default: 3m | ||
failAccessInterval: 3m | ||
|
||
# GCInitialDelay is the delay time from the start to the first GC execution. | ||
# default: 6s | ||
gcInitialDelay: 6s | ||
|
||
# GCMetaInterval is the interval time to execute GC meta. | ||
# default: 2m0s | ||
gcMetaInterval: 2m | ||
|
||
# TaskExpireTime when a task is not accessed within the taskExpireTime, | ||
# and it will be treated to be expired. | ||
# default: 3m0s | ||
taskExpireTime: 3m | ||
|
||
# storageMode is the mode of storage policy, [disk/hybrid] | ||
storageMode: disk | ||
|
||
plugins: | ||
storageDriver: | ||
- name: disk | ||
enable: true | ||
config: | ||
baseDir: /tmp/cdnsystem2 | ||
- name: memory | ||
enable: true | ||
config: | ||
baseDir: /tmp/memory/dragonfly | ||
|
||
storageManager: | ||
- name: disk | ||
enable: true | ||
config: | ||
gcInitialDelay: 5s | ||
gcInterval: 15s | ||
driverConfigs: | ||
disk: | ||
gcConfig: | ||
youngGCThreshold: 100G | ||
fullGCThreshold: 5G | ||
cleanRatio: 1 | ||
intervalThreshold: 2h | ||
- name: hybrid | ||
enable: false | ||
config: | ||
gcInitialDelay: 5s | ||
gcInterval: 15s | ||
driverConfigs: | ||
disk: | ||
gcConfig: | ||
youngGCThreshold: 100G | ||
fullGCThreshold: 5G | ||
cleanRatio: 1 | ||
intervalThreshold: 2h | ||
memory: | ||
gcConfig: | ||
youngGCThreshold: 100G | ||
fullGCThreshold: 5G | ||
cleanRatio: 3 | ||
intervalThreshold: 2h | ||
|
||
# Console shows log on console | ||
# default: false | ||
console: false | ||
|
||
# Whether to enable debug level logger and enable pprof | ||
# default: false | ||
verbose: false | ||
|
||
# listen port for pprof, only valid when the verbose option is true | ||
# default is random port | ||
pprofPort: 0 |
Oops, something went wrong.