config

package
v0.1.0-fix-8 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultBlockSyncerConfig = &blocksyncer.Config{
	Modules:        []string{"epoch", "bucket", "object", "payment"},
	Dsn:            "localhost:3308",
	RecreateTables: true,
}

DefaultBlockSyncerConfig defines the default configuration of BlockSyncer service

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 DefaultMetricsConfig = &metrics.MetricsConfig{
	Enabled:     false,
	HTTPAddress: model.MetricsHTTPAddress,
}

DefaultMetricsConfig defines the default config of Metrics service

View Source
var DefaultP2PConfig = &p2p.NodeConfig{
	ListenAddress: model.P2PListenAddress,
	PingPeriod:    model.DefaultPingPeriod,
}
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 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,
	},
	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,
	},
	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,
	},
	SpOperatorAddress: hex.EncodeToString([]byte(model.SpOperatorAddress)),
	SpDBConfig:        DefaultSQLDBConfig,
	PieceStoreConfig:  DefaultPieceStoreConfig,
	ChainConfig:       DefaultGreenfieldChainConfig,
	SignerCfg:         signer.DefaultSignerChainConfig,
	BlockSyncerCfg:    DefaultBlockSyncerConfig,
	P2PCfg:            DefaultP2PConfig,
	LogCfg:            DefaultLogConfig,
	MetricsCfg:        DefaultMetricsConfig,
}

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
	PieceStoreConfig  *storage.PieceStoreConfig
	ChainConfig       *gnfd.GreenfieldChainConfig
	SignerCfg         *signer.SignerConfig
	BlockSyncerCfg    *blocksyncer.Config
	P2PCfg            *p2p.NodeConfig
	LogCfg            *LogConfig
	MetricsCfg        *metrics.MetricsConfig
}

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) 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) 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