Documentation ¶
Index ¶
- Variables
- func SaveConfig(file string, cfg *StorageProviderConfig) error
- type LogConfig
- type StorageProviderConfig
- func (cfg *StorageProviderConfig) JSONMarshal() ([]byte, error)
- func (cfg *StorageProviderConfig) JSONUnmarshal(jsonBytes []byte) error
- func (cfg *StorageProviderConfig) MakeAuthServiceConfig() (*auth.AuthConfig, error)
- func (cfg *StorageProviderConfig) MakeBlockSyncerConfig() (*tomlconfig.TomlConfig, error)
- func (cfg *StorageProviderConfig) MakeChallengeConfig() (*challenge.ChallengeConfig, error)
- func (cfg *StorageProviderConfig) MakeDownloaderConfig() (*downloader.DownloaderConfig, error)
- func (cfg *StorageProviderConfig) MakeGatewayConfig() (*gateway.GatewayConfig, error)
- func (cfg *StorageProviderConfig) MakeManagerServiceConfig() (*manager.ManagerConfig, error)
- func (cfg *StorageProviderConfig) MakeMetadataServiceConfig() (*metadata.MetadataConfig, error)
- func (cfg *StorageProviderConfig) MakeP2PServiceConfig() (*p2p.P2PConfig, error)
- func (cfg *StorageProviderConfig) MakeReceiverConfig() (*receiver.ReceiverConfig, error)
- func (cfg *StorageProviderConfig) MakeSignerConfig() (*signer.SignerConfig, *gnfd.GreenfieldChainConfig, error)
- func (cfg *StorageProviderConfig) MakeStopServingServiceConfig() (*stopserving.StopServingConfig, error)
- func (cfg *StorageProviderConfig) MakeTaskNodeConfig() (*tasknode.TaskNodeConfig, error)
- func (cfg *StorageProviderConfig) MakeUploaderConfig() (*uploader.UploaderConfig, error)
Constants ¶
This section is empty.
Variables ¶
var DefaultBlockSyncerConfig = &blocksyncer.Config{ Modules: []string{"epoch", "bucket", "object", "payment"}, Dsn: "localhost:3308", RecreateTables: true, }
DefaultBlockSyncerConfig defines the default configuration of BlockSyncer service
var DefaultBsDBConfig = &storeconfig.SQLDBConfig{
User: "root",
Passwd: "test_pwd",
Address: "localhost:3306",
Database: "block_syncer",
}
DefaultBsDBConfig defines the default configuration of Bs DB
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.
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
var DefaultLogConfig = &LogConfig{
Level: "debug",
Path: "./gnfd-sp.log",
}
DefaultLogConfig defines the default configuration of log
var DefaultMetadataConfig = &metadata.MetadataConfig{ IsMasterDB: true, BsDBSwitchCheckIntervalSec: 3600, }
DefaultMetadataConfig defines the default configuration of Metadata service
var DefaultMetricsConfig = &metrics.MetricsConfig{ Enabled: false, HTTPAddress: model.MetricsHTTPAddress, }
DefaultMetricsConfig defines the default configuration of metrics service
var DefaultP2PConfig = &p2p.NodeConfig{ ListenAddress: model.P2PListenAddress, PingPeriod: model.DefaultPingPeriod, }
DefaultP2PConfig defines the default configuration of p2p
var DefaultPProfConfig = &pprof.PProfConfig{ Enabled: false, HTTPAddress: model.PProfHTTPAddress, }
DefaultPProfConfig defines the default configuration of pprof service
var DefaultPieceStoreConfig = &storage.PieceStoreConfig{ Shards: 0, Store: storage.ObjectStorageConfig{ Storage: "file", BucketURL: "./data", MaxRetries: 5, }, }
DefaultPieceStoreConfig defines the default configuration of piece store
var DefaultRateLimiterConfig = &localhttp.RateLimiterConfig{ HTTPLimitCfg: localhttp.HTTPLimitConfig{ On: false, RateLimit: 100, RatePeriod: "S", }, }
DefaultRateLimiterConfig defines the default configuration of rate limiter
var DefaultSQLDBConfig = &storeconfig.SQLDBConfig{
User: "root",
Passwd: "test_pwd",
Address: "localhost:3306",
Database: "storage_provider_db",
}
DefaultSQLDBConfig defines the default configuration of SQL DB
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, }
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 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 }
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 ¶
func (cfg *StorageProviderConfig) MakeSignerConfig() (*signer.SignerConfig, *gnfd.GreenfieldChainConfig, error)
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