config

package
v0.2.0-fix-5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBandwidthLimiterConfig = &localhttp.BandwidthLimiterConfig{
	Enable: false,
	R:      100,
	B:      1000,
}
View Source
var DefaultBlockSyncerConfig = &blocksyncer.Config{
	Modules:        []string{"epoch", "bucket", "object", "payment"},
	Dsn:            "localhost:3308",
	DsnSwitched:    "localhost:3308",
	RecreateTables: false,
	EnableDualDB:   false,
}

DefaultBlockSyncerConfig defines the default configuration of BlockSyncer service

View Source
var DefaultBsDBConfig = &storeconfig.SQLDBConfig{
	User:     "root",
	Passwd:   "test_pwd",
	Address:  "localhost:3306",
	Database: "block_syncer",
}

DefaultBsDBConfig defines the default configuration of Bs DB

View Source
var DefaultBsDBSwitchedConfig = &storeconfig.SQLDBConfig{
	User:     "root",
	Passwd:   "test_pwd",
	Address:  "localhost:3306",
	Database: "block_syncer_backup",
}

DefaultBsDBSwitchedConfig defines the default configuration for the switched Bs DB.

View Source
var DefaultGreenfieldChainConfig = &gnfd.GreenfieldChainConfig{
	ChainID: model.GreenfieldChainID,
	NodeAddr: []*gnfd.NodeConfig{{
		GreenfieldAddresses: []string{model.GreenfieldAddress},
		TendermintAddresses: []string{model.TendermintAddress},
	}},
}

DefaultGreenfieldChainConfig defines the default configuration of greenfield chain

View Source
var DefaultLogConfig = &LogConfig{

	Level: "debug",
	Path:  "./gnfd-sp.log",
}

DefaultLogConfig defines the default configuration of log

View Source
var DefaultMetadataConfig = &metadata.MetadataConfig{
	BsDBConfig:                 DefaultBsDBConfig,
	BsDBSwitchedConfig:         DefaultBsDBSwitchedConfig,
	IsMasterDB:                 true,
	BsDBSwitchCheckIntervalSec: 3600,
}

DefaultMetadataConfig defines the default configuration of Metadata service

View Source
var DefaultMetricsConfig = &metrics.MetricsConfig{
	Enabled:     false,
	HTTPAddress: model.MetricsHTTPAddress,
}

DefaultMetricsConfig defines the default configuration of metrics service

View Source
var DefaultP2PConfig = &p2p.NodeConfig{
	ListenAddress: model.P2PListenAddress,
	PingPeriod:    model.DefaultPingPeriod,
}

DefaultP2PConfig defines the default configuration of p2p

View Source
var DefaultPProfConfig = &pprof.PProfConfig{
	Enabled:     false,
	HTTPAddress: model.PProfHTTPAddress,
}

DefaultPProfConfig defines the default configuration of pprof service

View Source
var DefaultPieceStoreConfig = &storage.PieceStoreConfig{
	Shards: 0,
	Store: storage.ObjectStorageConfig{
		Storage:    "file",
		BucketURL:  "./data",
		MaxRetries: 5,
	},
}

DefaultPieceStoreConfig defines the default configuration of piece store

View Source
var DefaultRateLimiterConfig = &localhttp.RateLimiterConfig{
	HTTPLimitCfg: localhttp.HTTPLimitConfig{
		On:         false,
		RateLimit:  100,
		RatePeriod: "S",
	},
}

DefaultRateLimiterConfig defines the default configuration of rate limiter

View Source
var DefaultSQLDBConfig = &storeconfig.SQLDBConfig{
	User:     "root",
	Passwd:   "test_pwd",
	Address:  "localhost:3306",
	Database: "storage_provider_db",
}

DefaultSQLDBConfig defines the default configuration of SQL DB

View Source
var DefaultStorageProviderConfig = &StorageProviderConfig{
	Service: []string{
		model.GatewayService,
		model.UploaderService,
		model.DownloaderService,
		model.ChallengeService,
		model.TaskNodeService,
		model.ReceiverService,
		model.SignerService,
		model.MetadataService,
		model.ManagerService,
		model.P2PService,
		model.AuthService,
		model.StopServingService,
	},
	ListenAddress: map[string]string{
		model.GatewayService:    model.GatewayHTTPAddress,
		model.UploaderService:   model.UploaderGRPCAddress,
		model.DownloaderService: model.DownloaderGRPCAddress,
		model.ChallengeService:  model.ChallengeGRPCAddress,
		model.ReceiverService:   model.ReceiverGRPCAddress,
		model.TaskNodeService:   model.TaskNodeGRPCAddress,
		model.SignerService:     model.SignerGRPCAddress,
		model.MetadataService:   model.MetadataGRPCAddress,
		model.P2PService:        model.P2PGRPCAddress,
		model.AuthService:       model.AuthGRPCAddress,
	},
	Endpoint: map[string]string{
		model.GatewayService:    "gnfd.test-sp.com",
		model.UploaderService:   model.UploaderGRPCAddress,
		model.DownloaderService: model.DownloaderGRPCAddress,
		model.ChallengeService:  model.ChallengeGRPCAddress,
		model.ReceiverService:   model.ReceiverGRPCAddress,
		model.TaskNodeService:   model.TaskNodeGRPCAddress,
		model.SignerService:     model.SignerGRPCAddress,
		model.MetadataService:   model.MetadataGRPCAddress,
		model.P2PService:        model.P2PGRPCAddress,
		model.AuthService:       model.AuthGRPCAddress,
	},
	SpOperatorAddress:  hex.EncodeToString([]byte(model.SpOperatorAddress)),
	SpDBConfig:         DefaultSQLDBConfig,
	BsDBConfig:         DefaultBsDBConfig,
	BsDBSwitchedConfig: DefaultBsDBSwitchedConfig,
	PieceStoreConfig:   DefaultPieceStoreConfig,
	ChainConfig:        DefaultGreenfieldChainConfig,
	SignerCfg:          signer.DefaultSignerChainConfig,
	BlockSyncerCfg:     DefaultBlockSyncerConfig,
	P2PCfg:             DefaultP2PConfig,
	LogCfg:             DefaultLogConfig,
	MetricsCfg:         DefaultMetricsConfig,
	PProfCfg:           DefaultPProfConfig,
	RateLimiter:        DefaultRateLimiterConfig,
	DiscontinueCfg:     stopserving.DefaultDiscontinueConfig,
	MetadataCfg:        DefaultMetadataConfig,
	BandwidthLimiter:   DefaultBandwidthLimiterConfig,
}

DefaultStorageProviderConfig defines the default configuration of storage provider services

Functions

func SaveConfig

func SaveConfig(file string, cfg *StorageProviderConfig) error

SaveConfig write the config to disk

Types

type LogConfig

type LogConfig struct {
	Level string
	Path  string
}

type StorageProviderConfig

type StorageProviderConfig struct {
	Service            []string
	SpOperatorAddress  string
	Endpoint           map[string]string
	ListenAddress      map[string]string
	SpDBConfig         *config.SQLDBConfig
	BsDBConfig         *config.SQLDBConfig
	BsDBSwitchedConfig *config.SQLDBConfig
	PieceStoreConfig   *storage.PieceStoreConfig
	ChainConfig        *gnfd.GreenfieldChainConfig
	SignerCfg          *signer.SignerConfig
	BlockSyncerCfg     *blocksyncer.Config
	P2PCfg             *p2p.NodeConfig
	LogCfg             *LogConfig
	MetricsCfg         *metrics.MetricsConfig
	PProfCfg           *pprof.PProfConfig
	RateLimiter        *localhttp.RateLimiterConfig
	DiscontinueCfg     *stopserving.DiscontinueConfig
	MetadataCfg        *metadata.MetadataConfig
	BandwidthLimiter   *localhttp.BandwidthLimiterConfig
}

StorageProviderConfig defines the configuration of storage provider

func LoadConfig

func LoadConfig(path string) *StorageProviderConfig

LoadConfig loads the config file from path

func (*StorageProviderConfig) JSONMarshal

func (cfg *StorageProviderConfig) JSONMarshal() ([]byte, error)

JSONMarshal marshal the StorageProviderConfig to json format

func (*StorageProviderConfig) JSONUnmarshal

func (cfg *StorageProviderConfig) JSONUnmarshal(jsonBytes []byte) error

JSONUnmarshal unmarshal bytes to StorageProviderConfig struct

func (*StorageProviderConfig) MakeAuthServiceConfig added in v0.1.2

func (cfg *StorageProviderConfig) MakeAuthServiceConfig() (*auth.AuthConfig, error)

MakeAuthServiceConfig make auth service config from StorageProviderConfig

func (*StorageProviderConfig) MakeBlockSyncerConfig

func (cfg *StorageProviderConfig) MakeBlockSyncerConfig() (*tomlconfig.TomlConfig, error)

MakeBlockSyncerConfig make block syncer service config from StorageProviderConfig

func (*StorageProviderConfig) MakeChallengeConfig

func (cfg *StorageProviderConfig) MakeChallengeConfig() (*challenge.ChallengeConfig, error)

MakeChallengeConfig make challenge service config from StorageProviderConfig

func (*StorageProviderConfig) MakeDownloaderConfig

func (cfg *StorageProviderConfig) MakeDownloaderConfig() (*downloader.DownloaderConfig, error)

MakeDownloaderConfig make downloader service config from StorageProviderConfig

func (*StorageProviderConfig) MakeGatewayConfig

func (cfg *StorageProviderConfig) MakeGatewayConfig() (*gateway.GatewayConfig, error)

MakeGatewayConfig make gateway service config from StorageProviderConfig

func (*StorageProviderConfig) MakeManagerServiceConfig

func (cfg *StorageProviderConfig) MakeManagerServiceConfig() (*manager.ManagerConfig, error)

MakeManagerServiceConfig make manager service config from StorageProviderConfig

func (*StorageProviderConfig) MakeMetadataServiceConfig

func (cfg *StorageProviderConfig) MakeMetadataServiceConfig() (*metadata.MetadataConfig, error)

MakeMetadataServiceConfig make meta data service config from StorageProviderConfig

func (*StorageProviderConfig) MakeP2PServiceConfig

func (cfg *StorageProviderConfig) MakeP2PServiceConfig() (*p2p.P2PConfig, error)

MakeP2PServiceConfig make p2p service config from StorageProviderConfig

func (*StorageProviderConfig) MakeReceiverConfig

func (cfg *StorageProviderConfig) MakeReceiverConfig() (*receiver.ReceiverConfig, error)

MakeReceiverConfig make receiver service config from StorageProviderConfig

func (*StorageProviderConfig) MakeSignerConfig

MakeSignerConfig make singer service config from StorageProviderConfig

func (*StorageProviderConfig) MakeStopServingServiceConfig added in v0.2.0

func (cfg *StorageProviderConfig) MakeStopServingServiceConfig() (*stopserving.StopServingConfig, error)

MakeStopServingServiceConfig make stop serving service config from StorageProviderConfig

func (*StorageProviderConfig) MakeTaskNodeConfig

func (cfg *StorageProviderConfig) MakeTaskNodeConfig() (*tasknode.TaskNodeConfig, error)

MakeTaskNodeConfig make task node service config from StorageProviderConfig

func (*StorageProviderConfig) MakeUploaderConfig

func (cfg *StorageProviderConfig) MakeUploaderConfig() (*uploader.UploaderConfig, error)

MakeUploaderConfig make uploader service config from StorageProviderConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL