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

Del deprecated network update interval sec; added Log and Metric #25

Merged
merged 2 commits into from
Jul 2, 2024
Merged
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
44 changes: 23 additions & 21 deletions any-sync-network/cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ type GeneralNodeConfig struct {
} `yaml:"quic"`
Network Network `yaml:"network"`
NetworkStorePath string `yaml:"networkStorePath"`
Log struct {
Production bool `yaml:"production"`
DefaultLevel string `yaml:"defaultLevel"`
NamedLevels struct {
} `yaml:"namedLevels"`
} `yaml:"log"`
Metric struct {
Addr string `yaml:"addr"`
} `yaml:"metric"`
}

type CoordinatorNodeConfig struct {
Expand All @@ -59,12 +68,10 @@ type ConsensusNodeConfig struct {
Database string `yaml:"database"`
LogCollection string `yaml:"logCollection"`
} `yaml:"mongo"`
NetworkUpdateIntervalSec int `yaml:"networkUpdateIntervalSec"`
}

type SyncNodeConfig struct {
GeneralNodeConfig `yaml:".,inline"`
NetworkUpdateIntervalSec int `yaml:"networkUpdateIntervalSec"`
Space struct {
GcTTL int `yaml:"gcTTL"`
SyncPeriod int `yaml:"syncPeriod"`
Expand All @@ -76,20 +83,13 @@ type SyncNodeConfig struct {
SyncOnStart bool `yaml:"syncOnStart"`
PeriodicSyncHours int `yaml:"periodicSyncHours"`
} `yaml:"nodeSync"`
Log struct {
Production bool `yaml:"production"`
DefaultLevel string `yaml:"defaultLevel"`
NamedLevels struct {
} `yaml:"namedLevels"`
} `yaml:"log"`
ApiServer struct {
ListenAddr string `yaml:"listenAddr"`
} `yaml:"apiServer"`
}

type FileNodeConfig struct {
GeneralNodeConfig `yaml:".,inline"`
NetworkUpdateIntervalSec int `yaml:"networkUpdateIntervalSec"`
DefaultLimit int `yaml:"defaultLimit"`
S3Store struct {
Endpoint string `yaml:"endpoint,omitempty"`
Expand Down Expand Up @@ -724,6 +724,20 @@ func defaultGeneralNode() GeneralNodeConfig {
DialTimeoutSec: 10,
},
NetworkStorePath: "/networkStore",
Log: struct {
Production bool "yaml:\"production\""
DefaultLevel string "yaml:\"defaultLevel\""
NamedLevels struct{} "yaml:\"namedLevels\""
}{
Production: false,
DefaultLevel: "",
NamedLevels: struct{}{},
},
Metric: struct {
Addr string "yaml:\"addr\""
}{
Addr: "0.0.0.0:8000",
},
}
}

Expand Down Expand Up @@ -763,14 +777,12 @@ func defaultConsensusNode() ConsensusNodeConfig {
}{
LogCollection: "log",
},
NetworkUpdateIntervalSec: 600,
}
}

func defaultSyncNode() SyncNodeConfig {
return SyncNodeConfig{
GeneralNodeConfig: defaultGeneralNode(),
NetworkUpdateIntervalSec: 600,
Space: struct {
GcTTL int "yaml:\"gcTTL\""
SyncPeriod int "yaml:\"syncPeriod\""
Expand All @@ -790,15 +802,6 @@ func defaultSyncNode() SyncNodeConfig {
SyncOnStart: true,
PeriodicSyncHours: 2,
},
Log: struct {
Production bool "yaml:\"production\""
DefaultLevel string "yaml:\"defaultLevel\""
NamedLevels struct{} "yaml:\"namedLevels\""
}{
Production: false,
DefaultLevel: "",
NamedLevels: struct{}{},
},
ApiServer: struct {
ListenAddr string "yaml:\"listenAddr\""
}{
Expand All @@ -810,7 +813,6 @@ func defaultSyncNode() SyncNodeConfig {
func defaultFileNode() FileNodeConfig {
return FileNodeConfig{
GeneralNodeConfig: defaultGeneralNode(),
NetworkUpdateIntervalSec: 600,
DefaultLimit: cfg.AnySyncFilenode.DefaultLimit,
S3Store: struct {
Endpoint string "yaml:\"endpoint,omitempty\""
Expand Down
Loading