You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

constants.go 2.4 kB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * Copyright 2020 The Dragonfly 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. package config
  17. import (
  18. "time"
  19. )
  20. // Reason of backing to source.
  21. const (
  22. BackSourceReasonNone = 0
  23. BackSourceReasonRegisterFail = 1
  24. BackSourceReasonMd5NotMatch = 2
  25. BackSourceReasonDownloadError = 3
  26. BackSourceReasonNoSpace = 4
  27. BackSourceReasonInitError = 5
  28. BackSourceReasonWriteError = 6
  29. BackSourceReasonHostSysError = 7
  30. BackSourceReasonNodeEmpty = 8
  31. BackSourceReasonSourceError = 10
  32. BackSourceReasonUserSpecified = 100
  33. ForceNotBackSourceAddition = 1000
  34. )
  35. // Download pattern.
  36. const (
  37. PatternP2P = "p2p"
  38. PatternSeedPeer = "seed-peer"
  39. PatternSource = "source"
  40. )
  41. //// Download limit.
  42. //const (
  43. // DefaultPerPeerDownloadLimit = 20 * unit.MB
  44. // DefaultTotalDownloadLimit = 100 * unit.MB
  45. // DefaultUploadLimit = 100 * unit.MB
  46. // DefaultMinRate = 20 * unit.MB
  47. //)
  48. // Others.
  49. const (
  50. DefaultTimestampFormat = "2006-01-02 15:04:05"
  51. SchemaHTTP = "http"
  52. DefaultTaskExpireTime = 6 * time.Hour
  53. DefaultGCInterval = 1 * time.Minute
  54. DefaultDaemonAliveTime = 5 * time.Minute
  55. DefaultScheduleTimeout = 5 * time.Minute
  56. DefaultDownloadTimeout = 5 * time.Minute
  57. DefaultSchedulerSchema = "http"
  58. DefaultSchedulerIP = "127.0.0.1"
  59. DefaultSchedulerPort = 8002
  60. DefaultPieceChanSize = 16
  61. DefaultObjectMaxReplicas = 3
  62. )
  63. // Dfcache subcommand names.
  64. const (
  65. CmdStat = "stat"
  66. CmdImport = "import"
  67. CmdExport = "export"
  68. CmdDelete = "delete"
  69. )
  70. // Service defalut port of listening.
  71. const (
  72. DefaultEndPort = 65535
  73. DefaultPeerStartPort = 65000
  74. DefaultUploadStartPort = 65002
  75. DefaultObjectStorageStartPort = 65004
  76. DefaultHealthyStartPort = 40901
  77. )
  78. var (
  79. // DefaultCertValidityPeriod is default validity period of certificate.
  80. DefaultCertValidityPeriod = 180 * 24 * time.Hour
  81. )