feat: remove callsystem and pattern (#1925)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2022-12-13 15:35:20 +08:00
parent 73ebf093bb
commit 91454c8a60
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
46 changed files with 28 additions and 163 deletions

View File

@ -18,7 +18,6 @@ dfcache delete <-i cid> [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -18,7 +18,6 @@ dfcache doc [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -18,7 +18,6 @@ dfcache export <-i cid> <output>|<-O output> [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -18,7 +18,6 @@ dfcache import <-i cid> <file>|<-I file> [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -18,7 +18,6 @@ dfcache plugin [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -19,7 +19,6 @@ dfcache stat <-i cid> [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -18,7 +18,6 @@ dfcache version [flags]
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -22,7 +22,6 @@ network.
.IP
.nf
\f[C]
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -18,7 +18,6 @@ responsibility to go back to source and add file into P2P network.
## OPTIONS
```
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache delete <-i cid> [flags]
## OPTIONS
```shell
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache doc [flags]
## OPTIONS
```
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache export <-i cid> <output>|<-O output> [flags]
## OPTIONS
```shell
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache import <-i cid> <file>|<-I file> [flags]
## OPTIONS
```shell
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache plugin [flags]
## OPTIONS
```shell
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache stat <-i cid> [flags]
## OPTIONS
```shell
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -15,7 +15,6 @@ dfcache version [flags]
## OPTIONS
```shell
--callsystem string The caller name which is mainly used for statistics and access control
-i, --cid string content or cache ID, e.g. sha256 digest of the content
--config string the path of configuration file with yaml extension name, default is /etc/dragonfly/dfcache.yaml, it can also be set by env var: DFCACHE_CONFIG
--console whether logger output records to the stdout

View File

@ -22,7 +22,6 @@ and so on.
.nf
\f[C]
--accept-regex string Recursively download only. Specify a regular expression to accept the complete URL. In this case, you have to enclose the pattern into quotes to prevent your shell from expanding it
--callsystem string The caller name which is mainly used for statistics and access control
--config string the path of configuration file with yaml extension name, it can also be set by env var: DFGET_CONFIG
--console whether logger output records to the stdout
--daemon-sock string Download socket path of daemon. In linux, default value is /var/run/dfdaemon.sock, in macos(just for testing), default value is /tmp/dfdaemon.sock

View File

@ -15,7 +15,6 @@ functionality, such as network bandwidth limit, transmission encryption and so o
```shell
--accept-regex string Recursively download only. Specify a regular expression to accept the complete URL. In this case, you have to enclose the pattern into quotes to prevent your shell from expanding it
--callsystem string The caller name which is mainly used for statistics and access control
--config string the path of configuration file with yaml extension name, it can also be set by env var: DFGET_CONFIG
--console whether logger output records to the stdout
--daemon-sock string Download socket path of daemon. In linux, default value is /var/run/dfdaemon.sock, in macos(just for testing), default value is /tmp/dfdaemon.sock

View File

@ -38,13 +38,6 @@ const (
ForceNotBackSourceAddition = 1000
)
// Download pattern.
const (
PatternP2P = "p2p"
PatternSeedPeer = "seed-peer"
PatternSource = "source"
)
// Download limit.
const (
DefaultPerPeerDownloadLimit = 512 * unit.MB

View File

@ -49,9 +49,6 @@ type CacheOption struct {
// Timeout operation timeout(second).
Timeout time.Duration `yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"`
// CallSystem optional system name
CallSystem string `yaml:"callSystem,omitempty" mapstructure:"callSystem,omitempty"`
// LogDir is log directory of dfcache.
LogDir string `yaml:"logDir,omitempty" mapstructure:"logDir,omitempty"`

View File

@ -73,11 +73,6 @@ type ClientOption struct {
// DaemonSock is daemon download socket path.
DaemonSock string `yaml:"daemonSock,omitempty" mapstructure:"daemon-sock,omitempty"`
// Deprecated: use Priority instead
// Pattern download pattern, must be 'p2p' or 'seed-peer' or 'source',
// default:`p2p`.
Pattern string `yaml:"pattern,omitempty" mapstructure:"pattern,omitempty"`
// Priority scheduler will schedule tasks according to priority
Priority int32 `yaml:"priority,omitempty" mapstructure:"priority,omitempty"`

View File

@ -38,7 +38,6 @@ var dfgetConfig = ClientOption{
DigestValue: "",
Tag: "",
Application: "",
Pattern: "",
Priority: 0,
Cacerts: nil,
Filter: "",

View File

@ -36,7 +36,6 @@ var dfgetConfig = ClientOption{
DigestValue: "",
Tag: "",
Application: "",
Pattern: "",
Priority: 0,
Cacerts: nil,
Filter: "",

View File

@ -36,7 +36,6 @@ import (
"d7y.io/dragonfly/v2/client/util"
"d7y.io/dragonfly/v2/cmd/dependency/base"
logger "d7y.io/dragonfly/v2/internal/dflog"
"d7y.io/dragonfly/v2/pkg/dfnet"
"d7y.io/dragonfly/v2/pkg/net/ip"
"d7y.io/dragonfly/v2/pkg/types"
@ -193,29 +192,9 @@ func (p *DaemonOption) Validate() error {
return errors.New("reload interval too short, must great than 1 second")
}
switch p.Download.DefaultPattern {
case PatternP2P, PatternSeedPeer, PatternSource:
default:
return errors.New("available pattern: p2p, seed-peer, source")
}
return nil
}
func ConvertPattern(p string, defaultPattern commonv1.Pattern) commonv1.Pattern {
switch p {
case PatternP2P:
return commonv1.Pattern_P2P
case PatternSeedPeer:
return commonv1.Pattern_SEED_PEER
case PatternSource:
return commonv1.Pattern_SOURCE
case "":
return defaultPattern
}
logger.Warnf("unknown pattern, use default pattern: %s", commonv1.Pattern_name[int32(defaultPattern)])
return defaultPattern
}
type GlobalSecurityOption struct {
// AutoIssueCert indicates to issue client certificates for all grpc call
// if AutoIssueCert is false, any other option in Security will be ignored
@ -292,7 +271,6 @@ type HostOption struct {
}
type DownloadOption struct {
DefaultPattern string `mapstructure:"defaultPattern" yaml:"defaultPattern"`
TotalRateLimit util.RateLimit `mapstructure:"totalRateLimit" yaml:"totalRateLimit"`
PerPeerRateLimit util.RateLimit `mapstructure:"perPeerRateLimit" yaml:"perPeerRateLimit"`
TrafficShaperType string `mapstructure:"trafficShaperType" yaml:"trafficShaperType"`

View File

@ -64,7 +64,6 @@ var peerHostConfig = func() *DaemonOption {
NetTopology: "",
},
Download: DownloadOption{
DefaultPattern: PatternP2P,
CalculateDigest: true,
PieceDownloadTimeout: 30 * time.Second,
GRPCDialTimeout: 10 * time.Second,

View File

@ -64,7 +64,6 @@ var peerHostConfig = func() *DaemonOption {
NetTopology: "",
},
Download: DownloadOption{
DefaultPattern: PatternP2P,
CalculateDigest: true,
PieceDownloadTimeout: 30 * time.Second,
GRPCDialTimeout: 10 * time.Second,

View File

@ -291,7 +291,6 @@ func TestPeerHostOption_Load(t *testing.T) {
AdvertiseIP: "0.0.0.0",
},
Download: DownloadOption{
DefaultPattern: PatternP2P,
TotalRateLimit: util.RateLimit{
Limit: 1024 * 1024 * 1024,
},

View File

@ -40,7 +40,6 @@ import (
"google.golang.org/grpc/credentials/insecure"
zapadapter "logur.dev/adapter/zap"
commonv1 "d7y.io/api/pkg/apis/common/v1"
schedulerv1 "d7y.io/api/pkg/apis/scheduler/v1"
"d7y.io/dragonfly/v2/client/config"
@ -125,7 +124,6 @@ func New(opt *config.DaemonOption, d dfpath.Dfpath) (Daemon, error) {
var (
managerClient managerclient.Client
certifyClient *certify.Certify
defaultPattern = config.ConvertPattern(opt.Download.DefaultPattern, commonv1.Pattern_P2P)
)
if opt.Scheduler.Manager.Enable {
@ -288,13 +286,13 @@ func New(opt *config.DaemonOption, d dfpath.Dfpath) (Daemon, error) {
peerServerOption = append(peerServerOption, grpc.Creds(tlsCredentials))
}
rpcManager, err := rpcserver.New(host, peerTaskManager, storageManager, defaultPattern,
rpcManager, err := rpcserver.New(host, peerTaskManager, storageManager,
opt.Download.RecursiveConcurrent.GoroutineCount, opt.Download.CacheRecursiveMetadata, downloadServerOption, peerServerOption)
if err != nil {
return nil, err
}
proxyManager, err := proxy.NewProxyManager(host, peerTaskManager, defaultPattern, opt.Proxy)
proxyManager, err := proxy.NewProxyManager(host, peerTaskManager, opt.Proxy)
if err != nil {
return nil, err
}

View File

@ -39,7 +39,6 @@ type FileTaskRequest struct {
Output string
Limit float64
DisableBackSource bool
Callsystem string
Range *util.Range
KeepOriginalOffset bool
}
@ -63,8 +62,6 @@ type fileTask struct {
// disableBackSource indicates not back source when failed
disableBackSource bool
pattern string
callsystem string
}
type ProgressState struct {
@ -113,7 +110,6 @@ func (ptm *peerTaskManager) newFileTask(
progressCh: make(chan *FileTaskProgress),
progressStopCh: make(chan bool),
disableBackSource: request.DisableBackSource,
callsystem: request.Callsystem,
}
return ctx, pt, nil
}

View File

@ -270,7 +270,6 @@ func (ptm *peerTaskManager) prefetchParentTask(request *schedulerv1.PeerTaskRequ
PeerHost: ptm.PeerHost,
HostLoad: request.HostLoad,
IsMigrating: request.IsMigrating,
Pattern: request.Pattern,
UrlMeta: &commonv1.UrlMeta{
Digest: request.UrlMeta.Digest,
Tag: request.UrlMeta.Tag,
@ -342,7 +341,6 @@ func (ptm *peerTaskManager) StartStreamTask(ctx context.Context, req *StreamTask
PeerHost: ptm.PeerHost,
HostLoad: nil,
IsMigrating: false,
Pattern: req.Pattern,
}
if ptm.Multiplex {

View File

@ -777,7 +777,6 @@ func (ts *testSpec) runSeedTaskTest(_ *testifyassert.Assertions, require *testif
IsMigrating: false,
},
Limit: 0,
Callsystem: "",
Range: nil,
})

View File

@ -32,7 +32,6 @@ import (
type SeedTaskRequest struct {
schedulerv1.PeerTaskRequest
Limit float64
Callsystem string
Range *util.Range
}

View File

@ -45,8 +45,6 @@ type StreamTaskRequest struct {
Range *util.Range
// peer's id and must be global uniqueness
PeerID string
// Pattern to register to scheduler
Pattern commonv1.Pattern
}
// StreamTask represents a peer task with stream io for reading directly without once more disk io

View File

@ -104,9 +104,6 @@ type Proxy struct {
// defaultApplication is used when http request without X-Dragonfly-Application Header
defaultApplication string
// DEPRECATED
defaultPattern commonv1.Pattern
// defaultPriority is used for scheduling
defaultPriority commonv1.Priority
@ -249,14 +246,6 @@ func WithDefaultPriority(priority commonv1.Priority) Option {
}
}
// WithDefaultPattern sets default pattern for downloading
func WithDefaultPattern(pattern commonv1.Pattern) Option {
return func(p *Proxy) *Proxy {
p.defaultPattern = pattern
return p
}
}
// WithBasicAuth sets basic auth info for proxy
func WithBasicAuth(auth *config.BasicAuth) Option {
return func(p *Proxy) *Proxy {
@ -527,7 +516,6 @@ func (proxy *Proxy) newTransport(tlsConfig *tls.Config) http.RoundTripper {
transport.WithTLS(tlsConfig),
transport.WithCondition(proxy.shouldUseDragonfly),
transport.WithDefaultFilter(proxy.defaultFilter),
transport.WithDefaultPattern(proxy.defaultPattern),
transport.WithDefaultTag(proxy.defaultTag),
transport.WithDefaultApplication(proxy.defaultApplication),
transport.WithDefaultPriority(proxy.defaultPriority),

View File

@ -32,7 +32,6 @@ import (
"github.com/spf13/viper"
"gopkg.in/yaml.v3"
commonv1 "d7y.io/api/pkg/apis/common/v1"
schedulerv1 "d7y.io/api/pkg/apis/scheduler/v1"
"d7y.io/dragonfly/v2/client/config"
@ -60,7 +59,7 @@ type proxyManager struct {
var _ Manager = (*proxyManager)(nil)
func NewProxyManager(peerHost *schedulerv1.PeerHost, peerTaskManager peer.TaskManager, defaultPattern commonv1.Pattern, proxyOption *config.ProxyOption) (Manager, error) {
func NewProxyManager(peerHost *schedulerv1.PeerHost, peerTaskManager peer.TaskManager, proxyOption *config.ProxyOption) (Manager, error) {
// proxy is option, when nil, just disable it
if proxyOption == nil {
logger.Infof("proxy config is empty, disabled")
@ -82,7 +81,6 @@ func NewProxyManager(peerHost *schedulerv1.PeerHost, peerTaskManager peer.TaskMa
WithDefaultTag(proxyOption.DefaultTag),
WithDefaultApplication(proxyOption.DefaultApplication),
WithDefaultPriority(proxyOption.DefaultPriority),
WithDefaultPattern(defaultPattern),
WithBasicAuth(proxyOption.BasicAuth),
WithDumpHTTPContent(proxyOption.DumpHTTPContent),
}

View File

@ -79,7 +79,6 @@ type server struct {
peerHost *schedulerv1.PeerHost
peerTaskManager peer.TaskManager
storageManager storage.Manager
defaultPattern commonv1.Pattern
downloadServer *grpc.Server
peerServer *grpc.Server
@ -96,15 +95,13 @@ func init() {
}
func New(peerHost *schedulerv1.PeerHost, peerTaskManager peer.TaskManager,
storageManager storage.Manager, defaultPattern commonv1.Pattern,
recursiveConcurrent int, cacheRecursiveMetadata time.Duration,
storageManager storage.Manager, recursiveConcurrent int, cacheRecursiveMetadata time.Duration,
downloadOpts []grpc.ServerOption, peerOpts []grpc.ServerOption) (Server, error) {
s := &server{
KeepAlive: util.NewKeepAlive("rpc server"),
peerHost: peerHost,
peerTaskManager: peerTaskManager,
storageManager: storageManager,
defaultPattern: defaultPattern,
recursiveConcurrent: recursiveConcurrent,
cacheRecursiveMetadata: cacheRecursiveMetadata,
@ -443,7 +440,6 @@ func (s *server) recursiveDownloadWithP2PMetadata(
URL: purl.String(),
URLMeta: &urlMeta,
PeerID: idgen.PeerID(s.peerHost.Ip),
Pattern: config.ConvertPattern(req.Pattern, s.defaultPattern),
})
if err != nil {
log.Errorf("start stream task for metadata error: %s", err)
@ -656,8 +652,6 @@ func copyDownRequest(req *dfdaemonv1.DownRequest) *dfdaemonv1.DownRequest {
Limit: req.Limit,
DisableBackSource: req.DisableBackSource,
UrlMeta: req.UrlMeta,
Pattern: req.Pattern,
Callsystem: req.Callsystem,
Uid: req.Uid,
Gid: req.Gid,
KeepOriginalOffset: req.KeepOriginalOffset,
@ -700,12 +694,10 @@ func (s *server) download(ctx context.Context, req *dfdaemonv1.DownRequest, stre
UrlMeta: req.UrlMeta,
PeerId: peerID,
PeerHost: s.peerHost,
Pattern: config.ConvertPattern(req.Pattern, s.defaultPattern),
},
Output: req.Output,
Limit: req.Limit,
DisableBackSource: req.DisableBackSource,
Callsystem: req.Callsystem,
KeepOriginalOffset: req.KeepOriginalOffset,
}
if len(req.UrlMeta.Range) > 0 {
@ -959,8 +951,6 @@ func (s *server) exportFromPeers(ctx context.Context, log *logger.SugaredLoggerO
Limit: req.Limit,
DisableBackSource: true,
UrlMeta: req.UrlMeta,
Pattern: "",
Callsystem: req.Callsystem,
Uid: req.Uid,
Gid: req.Gid,
}

View File

@ -71,10 +71,9 @@ func TestServer_New(t *testing.T) {
mockpeerHost := &schedulerv1.PeerHost{}
mockpeerTaskManager := peer.NewMockTaskManager(ctrl)
mockStorageManger := mocks.NewMockManager(ctrl)
var defaultPattern commonv1.Pattern = 0
var mockdownloadOpts []grpc.ServerOption
var mockpeerOpts []grpc.ServerOption
_, err := New(mockpeerHost, mockpeerTaskManager, mockStorageManger, defaultPattern, 16, 0, mockdownloadOpts, mockpeerOpts)
_, err := New(mockpeerHost, mockpeerTaskManager, mockStorageManger, 16, 0, mockdownloadOpts, mockpeerOpts)
tc.expect(t, err)
})
}
@ -216,7 +215,6 @@ func TestServer_ExportTask(t *testing.T) {
UrlMeta: &commonv1.UrlMeta{
Tag: "unit test",
},
Callsystem: "",
},
mock: func(mockStorageManger *mocks.MockManagerMockRecorder, mockTaskManager *peer.MockTaskManagerMockRecorder, mocktsd *mocks.MockTaskStorageDriver, mockPieceManager *peer.MockPieceManager) {
mockStorageManger.FindCompletedTask(gomock.Any()).Return(nil)
@ -690,8 +688,6 @@ func TestServer_ServeDownload(t *testing.T) {
UrlMeta: &commonv1.UrlMeta{
Tag: "unit test",
},
Pattern: "p2p",
Callsystem: "",
}
down, err := client.Download(context.Background(), request)
assert.Nil(err, "client download grpc call should be ok")

View File

@ -75,7 +75,6 @@ func (s *seeder) ObtainSeeds(seedRequest *cdnsystemv1.SeedRequest, seedsServer c
IsMigrating: false,
},
Limit: 0,
Callsystem: "",
Range: nil, // following code will update Range
}

View File

@ -72,9 +72,6 @@ type transport struct {
// defaultFilter is used when http request without X-Dragonfly-Filter Header
defaultFilter string
// defaultFilter is used for registering steam task
defaultPattern commonv1.Pattern
// defaultTag is used when http request without X-Dragonfly-Tag Header
defaultTag string
@ -133,14 +130,6 @@ func WithDefaultFilter(f string) Option {
}
}
// WithDefaultPattern sets default pattern
func WithDefaultPattern(pattern commonv1.Pattern) Option {
return func(rt *transport) *transport {
rt.defaultPattern = pattern
return rt
}
}
// WithDefaultTag sets default tag for http requests with X-Dragonfly-Tag Header
func WithDefaultTag(b string) Option {
return func(rt *transport) *transport {

View File

@ -242,7 +242,6 @@ func newDownRequest(cfg *config.DfgetConfig, hdr map[string]string) *dfdaemonv1.
Application: cfg.Application,
Priority: commonv1.Priority(cfg.Priority),
},
Pattern: cfg.Pattern,
Uid: int64(os.Getuid()),
Gid: int64(os.Getgid()),
KeepOriginalOffset: cfg.KeepOriginalOffset,

View File

@ -82,7 +82,6 @@ func init() {
flags.StringP("cid", "i", "", "content or cache ID, e.g. sha256 digest of the content")
flags.StringP("tag", "t", "", "different tags for the same cid will be recognized as different files in P2P network")
flags.Duration("timeout", dfcacheConfig.Timeout, "Timeout for this cache operation, 0 is infinite")
flags.String("callsystem", dfcacheConfig.CallSystem, "The caller name which is mainly used for statistics and access control")
flags.String("workhome", dfcacheConfig.WorkHome, "Dfcache working directory")
flags.String("logdir", dfcacheConfig.LogDir, "Dfcache log directory")

View File

@ -41,7 +41,6 @@ import (
"d7y.io/dragonfly/v2/pkg/os/user"
"d7y.io/dragonfly/v2/pkg/rpc/dfdaemon/client"
"d7y.io/dragonfly/v2/pkg/source"
"d7y.io/dragonfly/v2/pkg/types"
"d7y.io/dragonfly/v2/pkg/unit"
"d7y.io/dragonfly/v2/version"
)
@ -158,11 +157,6 @@ func init() {
flagSet.Bool("disable-back-source", dfgetConfig.DisableBackSource,
"Disable downloading directly from source when the daemon fails to download file")
flagSet.StringP("pattern", "p", dfgetConfig.Pattern, "The downloading pattern: p2p/seed-peer/source")
if err := flagSet.MarkDeprecated("pattern", "please use --priority instead"); err != nil {
panic(err)
}
flagSet.Int32P("priority", "P", dfgetConfig.Priority, "Scheduler will schedule task according to priority")
flagSet.BoolP("show-progress", "b", dfgetConfig.ShowProgress, "Show progress bar, it conflicts with --console")
@ -235,14 +229,12 @@ func runDfget(dfgetLockPath, daemonSockPath string) error {
err error
)
if dfgetConfig.Pattern != types.SourcePattern {
logger.Info("start to check and spawn daemon")
if dfdaemonClient, err = checkAndSpawnDaemon(dfgetLockPath, daemonSockPath); err != nil {
logger.Errorf("check and spawn daemon error: %v", err)
} else {
logger.Info("check and spawn daemon success")
}
}
return dfget.Download(dfgetConfig, dfdaemonClient)
}

6
go.mod
View File

@ -3,7 +3,7 @@ module d7y.io/dragonfly/v2
go 1.19
require (
d7y.io/api v1.3.9
d7y.io/api v1.4.0
github.com/RichardKnop/machinery v1.10.6
github.com/Showmax/go-fqdn v1.0.0
github.com/VividCortex/mysqlerr v1.0.0
@ -104,7 +104,7 @@ require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/envoyproxy/protoc-gen-validate v0.9.0 // indirect
github.com/envoyproxy/protoc-gen-validate v0.9.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-echarts/go-echarts/v2 v2.2.4 // indirect
@ -206,7 +206,7 @@ require (
golang.org/x/net v0.2.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/tools v0.2.0 // indirect
golang.org/x/tools v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221018160656-63c7b68cfc55 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect

14
go.sum
View File

@ -69,8 +69,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y=
d7y.io/api v1.3.9 h1:u5HgSTLDz/hMtDN4Ha9JI6KKFfBOfBbSe2nd+Cz94Tc=
d7y.io/api v1.3.9/go.mod h1:HERD+sbavL0vJXkd37RZxJvpu+nXZ6ipffm4EFUbF2w=
d7y.io/api v1.4.0 h1:KXjKfHpqZdy+kuwK7vo1WA2kHApaZnqwO5xWsPtkI80=
d7y.io/api v1.4.0/go.mod h1:nxtfwYYTCN7Mvx79lLk8xUfvldIUDyzYIfgOmyln+8M=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20201218220906-28db891af037/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U=
@ -255,8 +255,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/envoyproxy/protoc-gen-validate v0.9.0 h1:wyv+mWIshClA4g6hTlKD9xb6fiNAnDu3+8qYf7KSuSE=
github.com/envoyproxy/protoc-gen-validate v0.9.0/go.mod h1:aUb/JIPT9p8VQ1hMxCrB3/NZSvKoF7fPIE1ULgCIVz0=
github.com/envoyproxy/protoc-gen-validate v0.9.1 h1:PS7VIOgmSVhWUEeZwTe7z7zouA22Cr590PzXKbZHOVY=
github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
@ -1291,7 +1291,7 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.1-0.20210830214625-1b1db11ec8f4/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -1601,8 +1601,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM=
golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

View File

@ -39,17 +39,6 @@ const (
DfstoreName = "dfstore"
)
const (
// SourcePattern is back-to-source download pattern.
SourcePattern = "source"
// SeedPeerPattern is seed peer download pattern.
SeedPeerPattern = "seed-peer"
// P2PPattern is p2p download pattern.
P2PPattern = "p2p"
)
const (
// MetricsNamespace is namespace of metrics.
MetricsNamespace = "dragonfly"

View File

@ -69,8 +69,6 @@ func main() {
"awsS3ForcePathStyle": "true",
},
},
Pattern: "",
Callsystem: "",
Uid: 1000, // target uid
Gid: 1000, // target gid
KeepOriginalOffset: false,