Documentation
¶
Index ¶
- Constants
- func Load[T Validatable]() (T, error)
- func SetDefaults()
- type API
- type AggregateManagerConfig
- type AggregationConfig
- type AggregatorConfig
- type Client
- type CommpConfig
- type ContractAddresses
- type Credentials
- type DatabaseConfig
- type EgressTrackerServiceConfig
- type FullServerConfig
- type GasConfig
- type GasMaxFeeConfig
- type IdentityConfig
- type IndexingServiceConfig
- type JobQueueConfig
- type Key
- type LocalConfig
- type Normalizable
- type PDPServiceConfig
- type PostgresConfig
- type PublisherServiceConfig
- type RepoConfig
- type S3Config
- type ServerConfig
- type ServicesConfig
- type SigningServiceConfig
- type TelemetryCollectorConfig
- type TelemetryConfig
- type UCANConfig
- type UCANServerConfig
- type UCANServiceConfig
- type UploadServiceConfig
- type Validatable
Constants ¶
const DefaultMinimumEgressBatchSize int64 = 10 * 1024 * 1024
DefaultMinimumEgressBatchSize is the minimum allowed egress tracker batch size (10 MiB).
Variables ¶
This section is empty.
Functions ¶
func Load ¶
func Load[T Validatable]() (T, error)
func SetDefaults ¶ added in v0.2.3
func SetDefaults()
SetDefaults sets all viper defaults for configuration. Called before viper.Unmarshal() to ensure defaults are available.
Types ¶
type API ¶ added in v0.0.13
type API struct {
// The URL of the node to establish an API connection with
Endpoint string `mapstructure:"endpoint" validate:"required" flag:"node-url"`
}
type AggregateManagerConfig ¶ added in v0.2.3
type AggregateManagerConfig struct {
// PollInterval is how often the aggregation manager flushes its buffer.
PollInterval time.Duration `mapstructure:"poll_interval" toml:"poll_interval,omitempty"`
// MaxBatchSize is the maximum number of aggregates per batch submission.
BatchSize uint `mapstructure:"batch_size" toml:"batch_size,omitempty"`
JobQueue JobQueueConfig `mapstructure:"job_queue" toml:"job_queue,omitempty"`
}
func (AggregateManagerConfig) ToAppConfig ¶ added in v0.2.3
func (a AggregateManagerConfig) ToAppConfig() (app.AggregateManagerConfig, error)
type AggregationConfig ¶ added in v0.2.3
type AggregationConfig struct {
CommP CommpConfig `mapstructure:"commp" toml:"commp,omitempty"`
Aggregator AggregatorConfig `mapstructure:"aggregator" toml:"aggregator,omitempty"`
Manager AggregateManagerConfig `mapstructure:"manager" toml:"manager,omitempty"`
}
AggregationConfig configures the PDP aggregation system.
func DefaultAggregationConfig ¶ added in v0.2.3
func DefaultAggregationConfig() AggregationConfig
DefaultAggregationConfig returns an AggregationConfig with sensible defaults. These values match the viper defaults in defaults.go.
func (AggregationConfig) ToAppConfig ¶ added in v0.2.3
func (c AggregationConfig) ToAppConfig() (app.AggregationConfig, error)
type AggregatorConfig ¶ added in v0.2.3
type AggregatorConfig struct {
JobQueue JobQueueConfig `mapstructure:"job_queue" toml:"job_queue,omitempty"`
}
type Client ¶ added in v0.0.13
type Client struct {
Identity IdentityConfig `mapstructure:"identity"`
API API `mapstructure:"api"`
UCAN UCANConfig `mapstructure:"ucan" toml:"ucan"`
}
type CommpConfig ¶ added in v0.2.3
type CommpConfig struct {
JobQueue JobQueueConfig `mapstructure:"job_queue" toml:"job_queue,omitempty"`
}
type ContractAddresses ¶ added in v0.1.0
type ContractAddresses struct {
Verifier string `mapstructure:"verifier" validate:"required" flag:"verifier-address" toml:"verifier,omitempty"`
ProviderRegistry string `mapstructure:"provider_registry" validate:"required" flag:"provider-registry-address" toml:"provider_registry,omitempty"`
Service string `mapstructure:"service" validate:"required" flag:"service-address" toml:"service,omitempty"`
ServiceView string `mapstructure:"service_view" validate:"required" flag:"service-view-address" toml:"service_view,omitempty"`
Payments string `mapstructure:"payments" flag:"payments-address" toml:"payments,omitempty"`
USDFCToken string `mapstructure:"usdfc_token" flag:"usdfc-token-address" toml:"usdfc_token,omitempty"`
}
type Credentials ¶ added in v0.1.1
type Credentials struct {
AccessKeyID string `mapstructure:"access_key_id" toml:"access_key_id"`
SecretAccessKey string `mapstructure:"secret_access_key" toml:"secret_access_key"`
}
Credentials configures access credentials for S3-compatible storage.
type DatabaseConfig ¶ added in v0.2.3
type DatabaseConfig struct {
// Type is the database backend: "sqlite" (default) or "postgres"
Type string `mapstructure:"type" validate:"omitempty,oneof=sqlite postgres" toml:"type,omitempty"`
Postgres PostgresConfig `mapstructure:"postgres" validate:"omitempty" toml:"postgres,omitempty"`
}
DatabaseConfig configures the database backend.
func (DatabaseConfig) ToAppConfig ¶ added in v0.2.3
func (c DatabaseConfig) ToAppConfig() (app.DatabaseConfig, error)
ToAppConfig converts DatabaseConfig to app.DatabaseConfig.
type EgressTrackerServiceConfig ¶ added in v0.0.15
type EgressTrackerServiceConfig struct {
DID string `mapstructure:"did" flag:"egress-tracker-service-did" toml:"did,omitempty"`
URL string `mapstructure:"url" flag:"egress-tracker-service-url" toml:"url,omitempty"`
ReceiptsEndpoint string `mapstructure:"receipts_endpoint" flag:"egress-tracker-service-receipts-endpoint" toml:"receipts_endpoint,omitempty"`
// According to the spec, batch size should be between 10MiB and 1GiB
// (see https://github.com/storacha/specs/blob/main/w3-egress-tracking.md)
MaxBatchSizeBytes int64 `` /* 163-byte string literal not displayed */
Proof string `mapstructure:"proof" flag:"egress-tracker-service-proof" toml:"proof,omitempty"`
}
func (*EgressTrackerServiceConfig) ToAppConfig ¶ added in v0.0.15
func (c *EgressTrackerServiceConfig) ToAppConfig() (app.EgressTrackerServiceConfig, error)
func (*EgressTrackerServiceConfig) Validate ¶ added in v0.0.15
func (c *EgressTrackerServiceConfig) Validate() error
type FullServerConfig ¶ added in v0.0.13
type FullServerConfig struct {
Network string `mapstructure:"network" flag:"network" toml:"network,omitempty"`
Identity IdentityConfig `mapstructure:"identity" toml:"identity"`
Repo RepoConfig `mapstructure:"repo" toml:"repo"`
Server ServerConfig `mapstructure:"server" toml:"server"`
PDPService PDPServiceConfig `mapstructure:"pdp" toml:"pdp"`
UCANService UCANServiceConfig `mapstructure:"ucan" toml:"ucan"`
Telemetry TelemetryConfig `mapstructure:"telemetry" toml:"telemetry,omitempty"`
}
func (*FullServerConfig) Normalize ¶ added in v0.1.1
func (f *FullServerConfig) Normalize()
Normalize applies compatibility fixes before validation.
func (FullServerConfig) ToAppConfig ¶ added in v0.0.13
func (f FullServerConfig) ToAppConfig() (app.AppConfig, error)
func (FullServerConfig) Validate ¶ added in v0.0.13
func (f FullServerConfig) Validate() error
type GasConfig ¶ added in v0.2.3
type GasConfig struct {
MaxFee GasMaxFeeConfig `mapstructure:"max_fee" toml:"max_fee,omitempty"`
RetryWait time.Duration `mapstructure:"retry_wait" toml:"retry_wait,omitempty"`
}
GasConfig configures per-message-type gas fee limits.
func (GasConfig) ToAppConfig ¶ added in v0.2.3
type GasMaxFeeConfig ¶ added in v0.2.3
type GasMaxFeeConfig struct {
Prove uint `mapstructure:"prove" toml:"prove,omitempty"`
ProvingPeriod uint `mapstructure:"proving_period" toml:"proving_period,omitempty"`
ProvingInit uint `mapstructure:"proving_init" toml:"proving_init,omitempty"`
AddRoots uint `mapstructure:"add_roots" toml:"add_roots,omitempty"`
Default uint `mapstructure:"default" toml:"default,omitempty"`
}
GasMaxFeeConfig holds per-message-type maximum gas fees in wei.
type IdentityConfig ¶ added in v0.0.13
type IdentityConfig struct {
KeyFile string `mapstructure:"key_file" validate:"required" flag:"key-file" toml:"key_file"`
}
func (IdentityConfig) ToAppConfig ¶ added in v0.0.13
func (i IdentityConfig) ToAppConfig() (app.IdentityConfig, error)
func (IdentityConfig) Validate ¶ added in v0.0.13
func (i IdentityConfig) Validate() error
type IndexingServiceConfig ¶ added in v0.0.13
type IndexingServiceConfig struct {
DID string `mapstructure:"did" validate:"required" flag:"indexing-service-did" toml:"did,omitempty"`
URL string `mapstructure:"url" validate:"required,url" flag:"indexing-service-url" toml:"url,omitempty"`
Proof string `mapstructure:"proof" flag:"indexing-service-proof" toml:"proof,omitempty"`
}
func (*IndexingServiceConfig) ToAppConfig ¶ added in v0.0.13
func (s *IndexingServiceConfig) ToAppConfig() (app.IndexingServiceConfig, error)
func (*IndexingServiceConfig) Validate ¶ added in v0.0.13
func (s *IndexingServiceConfig) Validate() error
type JobQueueConfig ¶ added in v0.2.3
type JobQueueConfig struct {
// The number of jobs the queue can process in parallel.
Workers uint `mapstructure:"workers" toml:"workers,omitempty"`
// The number of times a job can be retried before being considered failed.
Retries uint `mapstructure:"retries" toml:"retries,omitempty"`
// The duration between successive retries
RetryDelay time.Duration `mapstructure:"retry_delay" toml:"retry_delay,omitempty"`
}
func (JobQueueConfig) ToAppConfig ¶ added in v0.2.3
func (j JobQueueConfig) ToAppConfig() (app.JobQueueConfig, error)
type Key ¶ added in v0.2.3
type Key string
Key is a configuration key path used with Viper.
const ( CommPJobQueueWorkers Key = "pdp.aggregation.commp.job_queue.workers" CommPJobQueueRetries Key = "pdp.aggregation.commp.job_queue.retries" CommPJobQueueRetryDelay Key = "pdp.aggregation.commp.job_queue.retry_delay" )
PDP Aggregation - CommP
const ( AggregatorJobQueueWorkers Key = "pdp.aggregation.aggregator.job_queue.workers" AggregatorJobQueueRetries Key = "pdp.aggregation.aggregator.job_queue.retries" AggregatorJobQueueRetryDelay Key = "pdp.aggregation.aggregator.job_queue.retry_delay" )
PDP Aggregation - Aggregator
const ( ManagerPollInterval Key = "pdp.aggregation.manager.poll_interval" ManagerBatchSize Key = "pdp.aggregation.manager.batch_size" ManagerJobQueueWorkers Key = "pdp.aggregation.manager.job_queue.workers" ManagerJobQueueRetries Key = "pdp.aggregation.manager.job_queue.retries" ManagerJobQueueRetryDelay Key = "pdp.aggregation.manager.job_queue.retry_delay" )
PDP Aggregation - Manager (these are dynamic - can change at runtime)
const ( GasMaxFeeProve Key = "pdp.gas.max_fee.prove" GasMaxFeeProvingPeriod Key = "pdp.gas.max_fee.proving_period" GasMaxFeeProvingInit Key = "pdp.gas.max_fee.proving_init" GasMaxFeeAddRoots Key = "pdp.gas.max_fee.add_roots" GasMaxFeeDefault Key = "pdp.gas.max_fee.default" GasRetryWait Key = "pdp.gas.retry_wait" )
PDP Gas Fee Limits (dynamic - can change at runtime)
type LocalConfig ¶ added in v0.0.13
type LocalConfig struct {
Repo RepoConfig `mapstructure:"repo"`
}
func (LocalConfig) Validate ¶ added in v0.0.13
func (l LocalConfig) Validate() error
type Normalizable ¶ added in v0.1.1
type Normalizable interface {
Normalize()
}
Normalizable allows configs to adjust legacy/default values prior to validation.
type PDPServiceConfig ¶ added in v0.0.13
type PDPServiceConfig struct {
OwnerAddress string `mapstructure:"owner_address" validate:"required" flag:"owner-address" toml:"owner_address"`
LotusEndpoint string `mapstructure:"lotus_endpoint" validate:"required" flag:"lotus-endpoint" toml:"lotus_endpoint"`
SigningService SigningServiceConfig `mapstructure:"signing_service" validate:"required" toml:"signing_service,omitempty"`
Contracts ContractAddresses `mapstructure:"contracts" validate:"required" toml:"contracts,omitempty"`
ChainID string `mapstructure:"chain_id" validate:"required" flag:"chain-id" toml:"chain_id,omitempty"`
PayerAddress string `mapstructure:"payer_address" validate:"required" flag:"payer-address" toml:"payer_address,omitempty"`
Aggregation AggregationConfig `mapstructure:"aggregation" toml:"aggregation,omitempty"`
Gas GasConfig `mapstructure:"gas" toml:"gas,omitempty"`
}
func (PDPServiceConfig) ToAppConfig ¶ added in v0.0.13
func (c PDPServiceConfig) ToAppConfig() (app.PDPServiceConfig, error)
func (PDPServiceConfig) Validate ¶ added in v0.0.13
func (c PDPServiceConfig) Validate() error
type PostgresConfig ¶ added in v0.2.3
type PostgresConfig struct {
// URL is the PostgreSQL connection string (only used when type is "postgres")
// Format: postgres://user:password@host:port/dbname?sslmode=disable
URL string `mapstructure:"url" flag:"db-url" toml:"url,omitempty"`
// MaxOpenConns is the maximum number of open connections to the database.
// Only used for PostgreSQL. Default: 5
MaxOpenConns int `mapstructure:"max_open_conns" toml:"max_open_conns,omitempty"`
// MaxIdleConns is the maximum number of idle connections in the pool.
// Only used for PostgreSQL. Default: 5
MaxIdleConns int `mapstructure:"max_idle_conns" toml:"max_idle_conns,omitempty"`
// ConnMaxLifetime is the maximum amount of time a connection may be reused.
// Only used for PostgreSQL. Accepts Go duration strings (e.g., "30m", "1h"). Default: "30m"
ConnMaxLifetime string `mapstructure:"conn_max_lifetime" toml:"conn_max_lifetime,omitempty"`
}
func (PostgresConfig) ToAppConfig ¶ added in v0.2.3
func (c PostgresConfig) ToAppConfig() (app.PostgresConfig, error)
ToAppConfig converts PostgresConfig to app.PostgresConfig. Parses the URL string and duration string into their typed equivalents.
type PublisherServiceConfig ¶ added in v0.0.13
type PublisherServiceConfig struct {
AnnounceURLs []string `` /* 130-byte string literal not displayed */
}
func (*PublisherServiceConfig) ToAppConfig ¶ added in v0.0.13
func (s *PublisherServiceConfig) ToAppConfig(publicURL url.URL) (app.PublisherServiceConfig, error)
func (*PublisherServiceConfig) Validate ¶ added in v0.0.13
func (s *PublisherServiceConfig) Validate() error
type RepoConfig ¶ added in v0.0.13
type RepoConfig struct {
DataDir string `mapstructure:"data_dir" validate:"required" flag:"data-dir" toml:"data_dir"`
TempDir string `mapstructure:"temp_dir" validate:"required" flag:"temp-dir" toml:"temp_dir"`
Database DatabaseConfig `mapstructure:"database" validate:"omitempty" toml:"database,omitempty"`
S3 *S3Config `mapstructure:"s3" validate:"omitempty" toml:"s3,omitempty"`
}
func (RepoConfig) ToAppConfig ¶ added in v0.0.13
func (r RepoConfig) ToAppConfig() (app.StorageConfig, error)
func (RepoConfig) Validate ¶ added in v0.0.13
func (r RepoConfig) Validate() error
type S3Config ¶ added in v0.2.3
type S3Config struct {
Endpoint string `mapstructure:"endpoint" validate:"required" toml:"endpoint"`
BucketPrefix string `mapstructure:"bucket_prefix" validate:"required" toml:"bucket_prefix"`
Credentials Credentials `mapstructure:"credentials" toml:"credentials,omitempty"`
Insecure bool `mapstructure:"insecure" toml:"insecure,omitempty"`
}
S3Config configures S3-compatible storage (e.g., MinIO, AWS S3). When configured, all supported stores use S3 with separate buckets named using the BucketPrefix (e.g., "piri-blobs", "piri-allocations").
func (*S3Config) IsConfigured ¶ added in v0.2.3
IsConfigured returns true if any S3 configuration is provided.
type ServerConfig ¶ added in v0.0.13
type ServerConfig struct {
Port uint `mapstructure:"port" validate:"required,min=1,max=65535" flag:"port" toml:"port"`
Host string `mapstructure:"host" validate:"required" flag:"host" toml:"host"`
PublicURL string `mapstructure:"public_url" validate:"omitempty,url" flag:"public-url" toml:"public_url"`
}
func (ServerConfig) ToAppConfig ¶ added in v0.0.13
func (s ServerConfig) ToAppConfig() (app.ServerConfig, error)
func (ServerConfig) Validate ¶ added in v0.0.13
func (s ServerConfig) Validate() error
type ServicesConfig ¶ added in v0.0.13
type ServicesConfig struct {
ServicePrincipalMapping map[string]string `mapstructure:"principal_mapping" flag:"service-principal-mapping" toml:"principal_mapping,omitempty"`
Indexer IndexingServiceConfig `mapstructure:"indexer" validate:"required" toml:"indexer,omitempty"`
EgressTracker EgressTrackerServiceConfig `mapstructure:"etracker" toml:"etracker,omitempty"`
Upload UploadServiceConfig `mapstructure:"upload" validate:"required" toml:"upload,omitempty"`
Publisher PublisherServiceConfig `mapstructure:"publisher" validate:"required" toml:"publisher,omitempty"`
}
func (*ServicesConfig) Normalize ¶ added in v0.1.1
func (s *ServicesConfig) Normalize()
Normalize applies compatibility fixes before validation.
func (ServicesConfig) ToAppConfig ¶ added in v0.0.13
func (s ServicesConfig) ToAppConfig(publicURL url.URL) (app.ExternalServicesConfig, error)
func (ServicesConfig) Validate ¶ added in v0.0.13
func (s ServicesConfig) Validate() error
type SigningServiceConfig ¶ added in v0.0.17
type SigningServiceConfig struct {
// Identity of the signing service
DID string `mapstructure:"did" toml:"did,omitempty"`
// URL endpoint for remote signing service (if using HTTP client)
URL string `mapstructure:"url" toml:"url,omitempty"`
// Private key for in-process signing (if using local signer)
// This should be a hex-encoded private key string
// NB: this should only be used for development purposes
PrivateKey string `mapstructure:"private_key" toml:"private_key,omitempty"`
}
SigningServiceConfig configures the signing service for PDP operations
func (SigningServiceConfig) ToAppConfig ¶ added in v0.0.17
func (c SigningServiceConfig) ToAppConfig() (app.SigningServiceConfig, error)
func (SigningServiceConfig) Validate ¶ added in v0.0.17
func (c SigningServiceConfig) Validate() error
type TelemetryCollectorConfig ¶ added in v0.2.1
type TelemetryCollectorConfig struct {
Endpoint string `mapstructure:"endpoint" validate:"required" toml:"endpoint"`
Insecure bool `mapstructure:"insecure" toml:"insecure,omitempty"`
Headers map[string]string `mapstructure:"headers" toml:"headers,omitempty"`
PublishInterval time.Duration `mapstructure:"publish_interval" toml:"publish_interval,omitempty"`
}
type TelemetryConfig ¶ added in v0.2.1
type TelemetryConfig struct {
Metrics []TelemetryCollectorConfig `mapstructure:"metrics" toml:"metrics,omitempty"`
Traces []TelemetryCollectorConfig `mapstructure:"traces" toml:"traces,omitempty"`
DisableStorachaAnalytics bool `mapstructure:"disable_storacha_analytics" toml:"disable_storacha_analytics,omitempty"`
}
func (TelemetryConfig) ToAppConfig ¶ added in v0.2.1
func (t TelemetryConfig) ToAppConfig() app.TelemetryConfig
func (TelemetryConfig) Validate ¶ added in v0.2.1
func (t TelemetryConfig) Validate() error
type UCANConfig ¶ added in v0.1.0
type UCANConfig struct {
ProofSetID uint64 `mapstructure:"proof_set" toml:"proof_set"`
}
type UCANServerConfig ¶ added in v0.0.13
type UCANServerConfig struct {
Identity IdentityConfig `mapstructure:"identity"`
Repo RepoConfig `mapstructure:"repo"`
Server ServerConfig `mapstructure:"server"`
UCANService UCANServiceConfig `mapstructure:"ucan"`
}
func (*UCANServerConfig) Normalize ¶ added in v0.1.1
func (u *UCANServerConfig) Normalize()
Normalize applies compatibility fixes before validation.
func (UCANServerConfig) Validate ¶ added in v0.0.13
func (u UCANServerConfig) Validate() error
type UCANServiceConfig ¶ added in v0.0.13
type UCANServiceConfig struct {
Services ServicesConfig `mapstructure:"services" toml:"services"`
ProofSetID uint64 `mapstructure:"proof_set" flag:"proof-set" toml:"proof_set"`
// InsecureDIDResolution enables HTTP (instead of HTTPS) for did:web resolution.
// NB: this should only be used for development purposes.
InsecureDIDResolution bool `mapstructure:"insecure_did_resolution" toml:"insecure_did_resolution,omitempty"`
}
func (*UCANServiceConfig) Normalize ¶ added in v0.1.1
func (s *UCANServiceConfig) Normalize()
Normalize applies compatibility fixes before validation.
func (UCANServiceConfig) ToAppConfig ¶ added in v0.0.13
func (s UCANServiceConfig) ToAppConfig(publicURL url.URL) (app.UCANServiceConfig, error)
func (UCANServiceConfig) Validate ¶ added in v0.0.13
func (s UCANServiceConfig) Validate() error
type UploadServiceConfig ¶ added in v0.0.13
type UploadServiceConfig struct {
DID string `mapstructure:"did" validate:"required" flag:"upload-service-did" toml:"did,omitempty"`
URL string `mapstructure:"url" validate:"required,url" flag:"upload-service-url" toml:"url,omitempty"`
}
func (*UploadServiceConfig) ToAppConfig ¶ added in v0.0.13
func (s *UploadServiceConfig) ToAppConfig() (app.UploadServiceConfig, error)
func (*UploadServiceConfig) Validate ¶ added in v0.0.13
func (s *UploadServiceConfig) Validate() error
type Validatable ¶
type Validatable interface {
Validate() error
}