Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: removed network topology #3547

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions client/config/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ var (
DefaultAnnouncerSchedulerInterval = 30 * time.Second
)

const (
// DefaultProbeInterval is the default interval of probing host.
DefaultProbeInterval = 20 * time.Minute
)

const (
// DefaultLogRotateMaxSize is the default maximum size in megabytes of log files before rotation.
DefaultLogRotateMaxSize = 1024
Expand Down
46 changes: 13 additions & 33 deletions client/config/peerhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,19 @@ type DaemonOption struct {
DataDirMode uint32 `mapstructure:"dataDirMode" yaml:"dataDirMode"`
KeepStorage bool `mapstructure:"keepStorage" yaml:"keepStorage"`

Security GlobalSecurityOption `mapstructure:"security" yaml:"security"`
Scheduler SchedulerOption `mapstructure:"scheduler" yaml:"scheduler"`
Host HostOption `mapstructure:"host" yaml:"host"`
Download DownloadOption `mapstructure:"download" yaml:"download"`
Proxy *ProxyOption `mapstructure:"proxy" yaml:"proxy"`
Upload UploadOption `mapstructure:"upload" yaml:"upload"`
ObjectStorage ObjectStorageOption `mapstructure:"objectStorage" yaml:"objectStorage"`
Storage StorageOption `mapstructure:"storage" yaml:"storage"`
Health *HealthOption `mapstructure:"health" yaml:"health"`
Reload ReloadOption `mapstructure:"reload" yaml:"reload"`
Network *NetworkOption `mapstructure:"network" yaml:"network"`
Announcer AnnouncerOption `mapstructure:"announcer" yaml:"announcer"`
NetworkTopology NetworkTopologyOption `mapstructure:"networkTopology" yaml:"networkTopology"`
PeerExchange PeerExchangeOption `mapstructure:"peerExchange" yaml:"peerExchange"`
Security GlobalSecurityOption `mapstructure:"security" yaml:"security"`
Scheduler SchedulerOption `mapstructure:"scheduler" yaml:"scheduler"`
Host HostOption `mapstructure:"host" yaml:"host"`
Download DownloadOption `mapstructure:"download" yaml:"download"`
Proxy *ProxyOption `mapstructure:"proxy" yaml:"proxy"`
Upload UploadOption `mapstructure:"upload" yaml:"upload"`
ObjectStorage ObjectStorageOption `mapstructure:"objectStorage" yaml:"objectStorage"`
Storage StorageOption `mapstructure:"storage" yaml:"storage"`
Health *HealthOption `mapstructure:"health" yaml:"health"`
Reload ReloadOption `mapstructure:"reload" yaml:"reload"`
Network *NetworkOption `mapstructure:"network" yaml:"network"`
Announcer AnnouncerOption `mapstructure:"announcer" yaml:"announcer"`
PeerExchange PeerExchangeOption `mapstructure:"peerExchange" yaml:"peerExchange"`
}

func NewDaemonConfig() *DaemonOption {
Expand Down Expand Up @@ -226,12 +225,6 @@ func (p *DaemonOption) Validate() error {
}
}

if p.NetworkTopology.Enable {
if p.NetworkTopology.Probe.Interval <= 0 {
return errors.New("probe requires parameter interval")
}
}

return nil
}

Expand Down Expand Up @@ -965,19 +958,6 @@ type AnnouncerOption struct {
SchedulerInterval time.Duration `mapstructure:"schedulerInterval" yaml:"schedulerInterval"`
}

type NetworkTopologyOption struct {
// Enable network topology service.
Enable bool `mapstructure:"enable" yaml:"enable"`

// Probe is the configuration of probe.
Probe ProbeOption `mapstructure:"probe" yaml:"probe"`
}

type ProbeOption struct {
// Interval is the interval of probing hosts.
Interval time.Duration `mapstructure:"interval" yaml:"interval"`
}

type PeerExchangeOption struct {
// Enable peer exchange service.
Enable bool `mapstructure:"enable" yaml:"enable"`
Expand Down
6 changes: 0 additions & 6 deletions client/config/peerhost_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ var peerHostConfig = func() *DaemonOption {
Announcer: AnnouncerOption{
SchedulerInterval: DefaultAnnouncerSchedulerInterval,
},
NetworkTopology: NetworkTopologyOption{
Enable: false,
Probe: ProbeOption{
Interval: DefaultProbeInterval,
},
},
LogMaxSize: DefaultLogRotateMaxSize,
LogMaxAge: DefaultLogRotateMaxAge,
LogMaxBackups: DefaultLogRotateMaxBackups,
Expand Down
6 changes: 0 additions & 6 deletions client/config/peerhost_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,6 @@ var peerHostConfig = func() *DaemonOption {
Announcer: AnnouncerOption{
SchedulerInterval: DefaultAnnouncerSchedulerInterval,
},
NetworkTopology: NetworkTopologyOption{
Enable: false,
Probe: ProbeOption{
Interval: DefaultProbeInterval,
},
},
LogMaxSize: DefaultLogRotateMaxSize,
LogMaxAge: DefaultLogRotateMaxAge,
LogMaxBackups: DefaultLogRotateMaxBackups,
Expand Down
24 changes: 0 additions & 24 deletions client/config/peerhost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,6 @@ func TestPeerHostOption_Load(t *testing.T) {
Announcer: AnnouncerOption{
SchedulerInterval: 1000000000,
},
NetworkTopology: NetworkTopologyOption{
Enable: true,
Probe: ProbeOption{
Interval: 20 * time.Minute,
},
},
}

peerHostOptionYAML := &DaemonOption{}
Expand Down Expand Up @@ -763,24 +757,6 @@ func TestPeerHostOption_Validate(t *testing.T) {
assert.EqualError(err, "certSpec requires parameter validityPeriod")
},
},
{
name: "probe requires parameter interval",
config: NewDaemonConfig(),
mock: func(cfg *DaemonConfig) {
cfg.Scheduler.NetAddrs = []dfnet.NetAddr{
{
Type: dfnet.TCP,
Addr: "127.0.0.1:8002",
},
}
cfg.NetworkTopology.Enable = true
cfg.NetworkTopology.Probe.Interval = 0
},
expect: func(t *testing.T, err error) {
assert := assert.New(t)
assert.EqualError(err, "probe requires parameter interval")
},
},
}

for _, tc := range tests {
Expand Down
5 changes: 0 additions & 5 deletions client/config/testdata/config/daemon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,3 @@ network:

announcer:
schedulerInterval: 1s

networkTopology:
enable: true
probe:
interval: 20m
19 changes: 0 additions & 19 deletions client/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import (
"d7y.io/dragonfly/v2/client/daemon/announcer"
"d7y.io/dragonfly/v2/client/daemon/gc"
"d7y.io/dragonfly/v2/client/daemon/metrics"
"d7y.io/dragonfly/v2/client/daemon/networktopology"
"d7y.io/dragonfly/v2/client/daemon/objectstorage"
"d7y.io/dragonfly/v2/client/daemon/peer"
"d7y.io/dragonfly/v2/client/daemon/pex"
Expand Down Expand Up @@ -113,7 +112,6 @@ type clientDaemon struct {
schedulerClient schedulerclient.V1
certifyClient *certify.Certify
announcer announcer.Announcer
networkTopology networktopology.NetworkTopology
}

func New(opt *config.DaemonOption, d dfpath.Dfpath) (Daemon, error) {
Expand Down Expand Up @@ -790,19 +788,6 @@ func (cd *clientDaemon) Serve() error {
}
}()

// serve network topology
if cd.Option.NetworkTopology.Enable {
cd.networkTopology, err = networktopology.NewNetworkTopology(&cd.Option, cd.schedPeerHost.Id, cd.schedPeerHost.RpcPort, cd.schedPeerHost.DownPort, cd.schedulerClient)
if err != nil {
logger.Errorf("failed to create network topology: %v", err)
return err
}

// serve network topology service
logger.Infof("serve network topology")
go cd.networkTopology.Serve()
}

if cd.Option.AliveTime.Duration > 0 {
g.Go(func() error {
for {
Expand Down Expand Up @@ -955,10 +940,6 @@ func (cd *clientDaemon) Stop() {
logger.Errorf("announcer stop failed %s", err)
}

if cd.networkTopology != nil {
cd.networkTopology.Stop()
}

if err := cd.dynconfig.Stop(); err != nil {
logger.Errorf("dynconfig client closed failed %s", err)
} else {
Expand Down
63 changes: 0 additions & 63 deletions client/daemon/networktopology/mocks/network_topology_mock.go

This file was deleted.

Loading
Loading