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) 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) 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 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 DefaultMetricsConfig = &metrics.MetricsConfig{ Enabled: false, HTTPAddress: model.MetricsHTTPAddress, }
DefaultMetricsConfig defines the default config of Metrics service
var DefaultP2PConfig = &p2p.NodeConfig{ ListenAddress: model.P2PListenAddress, PingPeriod: model.DefaultPingPeriod, }
var DefaultPieceStoreConfig = &storage.PieceStoreConfig{ Shards: 0, Store: storage.ObjectStorageConfig{ Storage: "file", BucketURL: "./data", MaxRetries: 5, }, }
DefaultPieceStoreConfig defines the default configuration of piece store
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, }, 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 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 ¶
func (cfg *StorageProviderConfig) MakeSignerConfig() (*signer.SignerConfig, *gnfd.GreenfieldChainConfig, error)
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