Documentation
¶
Index ¶
- Constants
- Variables
- func FromFile(path string, def interface{}) (interface{}, error)
- func FromReader(reader io.Reader, def interface{}) (interface{}, error)
- func GenerateConfigComment(t interface{}) ([]byte, error)
- func GenerateConfigUpdate(cfgCur, cfgDef interface{}, comment bool) ([]byte, error)
- type CandidateCfg
- type DocField
- type Duration
- type EdgeCfg
- type LocatorCfg
- type SchedulerCfg
Constants ¶
const ( // RetrievalPricingDefault configures the node to use the default retrieval pricing policy. RetrievalPricingDefaultMode = "default" // RetrievalPricingExternal configures the node to use the external retrieval pricing script // configured by the user. RetrievalPricingExternalMode = "external" )
Variables ¶
var Doc = map[string][]DocField{
"CandidateCfg": {
{
Name: "TCPSrvAddr",
Type: "string",
Comment: ``,
},
{
Name: "IpfsAPIURL",
Type: "string",
Comment: ``,
},
},
"EdgeCfg": {
{
Name: "ListenAddress",
Type: "string",
Comment: `host address and port the edge node api will listen on`,
},
{
Name: "Timeout",
Type: "string",
Comment: `used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function`,
},
{
Name: "NodeID",
Type: "string",
Comment: `deivce id`,
},
{
Name: "Secret",
Type: "string",
Comment: `used auth when connect to scheduler`,
},
{
Name: "CarfileStorePath",
Type: "string",
Comment: `carfilestore path`,
},
{
Name: "BandwidthUp",
Type: "int64",
Comment: `upload file bandwidth, unit is B/s`,
},
{
Name: "BandwidthDown",
Type: "int64",
Comment: `download file bandwidth, unit is B/s`,
},
{
Name: "Locator",
Type: "bool",
Comment: `if true, get scheduler url from locator`,
},
{
Name: "InsecureSkipVerify",
Type: "bool",
Comment: `InsecureSkipVerify skip tls verify`,
},
{
Name: "CertificatePath",
Type: "string",
Comment: `used for http3 server
be used if InsecureSkipVerify is true`,
},
{
Name: "PrivateKeyPath",
Type: "string",
Comment: `used for http3 server
be used if InsecureSkipVerify is true`,
},
{
Name: "CaCertificatePath",
Type: "string",
Comment: `self sign certificate, use for client`,
},
{
Name: "FetchBlockTimeout",
Type: "int",
Comment: `FetchTimeout get block timeout`,
},
{
Name: "FetchBlockRetry",
Type: "int",
Comment: `FetchBlockFailedRetry retry when get block failed`,
},
},
"LocatorCfg": {
{
Name: "ListenAddress",
Type: "string",
Comment: `host address and port the edge node api will listen on`,
},
{
Name: "Timeout",
Type: "string",
Comment: `used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function`,
},
{
Name: "GeoDBPath",
Type: "string",
Comment: `geodb path`,
},
{
Name: "DatabaseAddress",
Type: "string",
Comment: `mysql db address`,
},
{
Name: "UUID",
Type: "string",
Comment: `uuid`,
},
{
Name: "InsecureSkipVerify",
Type: "bool",
Comment: `InsecureSkipVerify skip tls verify`,
},
{
Name: "CertificatePath",
Type: "string",
Comment: `used for http3 server
be used if InsecureSkipVerify is true`,
},
{
Name: "PrivateKeyPath",
Type: "string",
Comment: `used for http3 server
be used if InsecureSkipVerify is true`,
},
{
Name: "CaCertificatePath",
Type: "string",
Comment: `self sign certificate, use for client`,
},
},
"SchedulerCfg": {
{
Name: "ExternalAddress",
Type: "string",
Comment: `host external address and port`,
},
{
Name: "ListenAddress",
Type: "string",
Comment: `host address and port the edge node api will listen on`,
},
{
Name: "DatabaseAddress",
Type: "string",
Comment: `database address`,
},
{
Name: "AreaID",
Type: "string",
Comment: `area id`,
},
{
Name: "InsecureSkipVerify",
Type: "bool",
Comment: `InsecureSkipVerify skip tls verify`,
},
{
Name: "CertificatePath",
Type: "string",
Comment: `used for http3 server
be used if InsecureSkipVerify is true`,
},
{
Name: "PrivateKeyPath",
Type: "string",
Comment: `used for http3 server
be used if InsecureSkipVerify is true`,
},
{
Name: "CaCertificatePath",
Type: "string",
Comment: `self sign certificate, use for client`,
},
{
Name: "SchedulerServer1",
Type: "string",
Comment: `test nat type`,
},
{
Name: "SchedulerServer2",
Type: "string",
Comment: `test nat type`,
},
{
Name: "EnableValidate",
Type: "bool",
Comment: `config to enabled node validation, default: true`,
},
{
Name: "EtcdAddresses",
Type: "[]string",
Comment: `etcd server addresses`,
},
{
Name: "CandidateReplicaCachesCount",
Type: "int",
Comment: `Cache to the number of candidate nodes (does not contain 'seedCacheCount')`,
},
},
}
var MaxTraversalLinks uint64 = 32 * (1 << 20)
MaxTraversalLinks configures the maximum number of links to traverse in a DAG while calculating CommP and traversing a DAG with graphsync; invokes a budget on DAG depth and density.
Functions ¶
func FromFile ¶
FromFile loads config from a specified file overriding defaults specified in the def parameter. If file does not exist or is empty defaults are assumed.
func FromReader ¶
FromReader loads config from a reader instance.
func GenerateConfigComment ¶
GenerateConfigComment generates a commented version of the specified configuration, with comments describing each configuration field.
func GenerateConfigUpdate ¶
GenerateConfigUpdate generates an updated configuration based on the current configuration and the specified defaults. If 'comment' is true, the updated configuration will contain comments describing each configuration field.
Types ¶
type CandidateCfg ¶
type CandidateCfg struct {
EdgeCfg
}
CandidateCfg candidate node config
func DefaultCandidateCfg ¶
func DefaultCandidateCfg() *CandidateCfg
DefaultCandidateCfg returns the default candidate config
type Duration ¶
Duration is a wrapper type for time.Duration for decoding and encoding from/to TOML
func (Duration) MarshalText ¶
MarshalText implements interface for TOML encoding
func (*Duration) UnmarshalText ¶
UnmarshalText implements interface for TOML decoding
type EdgeCfg ¶
type EdgeCfg struct {
// host address and port the edge node api will listen on
ListenAddress string
// used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function
Timeout string
// node id
NodeID string
// area id
AreaID string
// used auth when connect to scheduler
Secret string
// metadata path
MetadataPath string
// assets path
AssetsPaths []string
// upload file bandwidth, unit is B/s
BandwidthUp int64
// download file bandwidth, unit is B/s
BandwidthDown int64
// if true, get scheduler url from locator
Locator bool
// InsecureSkipVerify skip tls verify
InsecureSkipVerify bool
// used for http3 server
// be used if InsecureSkipVerify is true
CertificatePath string
// used for http3 server
// be used if InsecureSkipVerify is true
PrivateKeyPath string
// self sign certificate, use for client
CaCertificatePath string
// PullBlockTimeout get block timeout
PullBlockTimeout int
// PullBlockRetry retry when get block failed
PullBlockRetry int
// PullBlockParallel the number of goroutine to pull block
PullBlockParallel int
TCPSrvAddr string
IPFSAPIURL string
// seconds
ValidateDuration int
}
EdgeCfg edge node config
type LocatorCfg ¶
type LocatorCfg struct {
// host address and port the edge node api will listen on
ListenAddress string
// used when 'ListenAddress' is unspecified. must be a valid duration recognized by golang's time.ParseDuration function
Timeout string
// geodb path
GeoDBPath string
// InsecureSkipVerify skip tls verify
InsecureSkipVerify bool
// used for http3 server
// be used if InsecureSkipVerify is false
CertificatePath string
// used for http3 server
// be used if InsecureSkipVerify is false
PrivateKeyPath string
// self sign certificate, use for client
CaCertificatePath string
// etcd server addresses
EtcdAddresses []string
DefaultAreaID string
}
LocatorCfg locator config
func DefaultLocatorCfg ¶
func DefaultLocatorCfg() *LocatorCfg
DefaultLocatorCfg returns the default locator config
type SchedulerCfg ¶
type SchedulerCfg struct {
// host external address and port
ExternalURL string
// host address and port the edge node api will listen on
ListenAddress string
// database address
DatabaseAddress string
// area id
AreaID string
// InsecureSkipVerify skip tls verify
InsecureSkipVerify bool
// used for http3 server
// be used if InsecureSkipVerify is true
CertificatePath string
// used for http3 server
// be used if InsecureSkipVerify is true
PrivateKeyPath string
// self sign certificate, use for client
CaCertificatePath string
// config to enabled node validation, default: true
EnableValidation bool
// etcd server addresses
EtcdAddresses []string
// Number of candidate node replicas (does not contain 'seed')
CandidateReplicas int
// Proportion of validator in candidate nodes (0 ~ 1)
ValidatorRatio float64
// The base downstream bandwidth per validator window (unit : MiB)
ValidatorBaseBwDn int
// Increased profit after node validation passes
ValidationProfit float64
}
SchedulerCfg scheduler config
func DefaultSchedulerCfg ¶
func DefaultSchedulerCfg() *SchedulerCfg
DefaultSchedulerCfg returns the default scheduler config