package storage import "time" // Config defines the storage configuration for a Tutus node. type Config struct { // Provider specifies the active storage backend Provider string `yaml:"provider"` // NeoFS configuration (when Provider = "neofs") NeoFS NeoFSConfig `yaml:"neofs"` // Local configuration (when Provider = "local") Local LocalConfig `yaml:"local"` // S3 configuration (when Provider = "s3") S3 S3Config `yaml:"s3"` } // NeoFSConfig configures the NeoFS storage adapter. type NeoFSConfig struct { // Endpoints is a list of NeoFS node addresses Endpoints []string `yaml:"endpoints"` // Container is the NeoFS container ID for block storage Container string `yaml:"container"` // Timeout for NeoFS operations Timeout time.Duration `yaml:"timeout"` // Key is the path to the wallet key file for authentication Key string `yaml:"key"` // DialTimeout for initial connection DialTimeout time.Duration `yaml:"dial_timeout"` // StreamTimeout for streaming operations StreamTimeout time.Duration `yaml:"stream_timeout"` // HealthcheckTimeout for node health verification HealthcheckTimeout time.Duration `yaml:"healthcheck_timeout"` // RebalanceInterval for endpoint rotation RebalanceInterval time.Duration `yaml:"rebalance_interval"` // SessionExpirationDuration for session tokens SessionExpirationDuration uint64 `yaml:"session_expiration_duration"` } // LocalConfig configures local filesystem storage. type LocalConfig struct { // Path is the base directory for storage Path string `yaml:"path"` // MaxSize is the maximum storage size in bytes (0 = unlimited) MaxSize int64 `yaml:"max_size"` // Compression enables data compression Compression bool `yaml:"compression"` } // S3Config configures S3-compatible storage. type S3Config struct { // Endpoint is the S3 API endpoint (empty for AWS) Endpoint string `yaml:"endpoint"` // Region is the AWS region or equivalent Region string `yaml:"region"` // Bucket is the S3 bucket name Bucket string `yaml:"bucket"` // AccessKey for authentication AccessKey string `yaml:"access_key"` // SecretKey for authentication SecretKey string `yaml:"secret_key"` // UsePathStyle forces path-style URLs (required for some providers) UsePathStyle bool `yaml:"use_path_style"` // DisableSSL for non-TLS endpoints (not recommended for production) DisableSSL bool `yaml:"disable_ssl"` } // DefaultConfig returns a configuration with sensible defaults. func DefaultConfig() Config { return Config{ Provider: "local", NeoFS: NeoFSConfig{ Timeout: 30 * time.Second, DialTimeout: 5 * time.Second, StreamTimeout: 60 * time.Second, HealthcheckTimeout: 10 * time.Second, RebalanceInterval: 60 * time.Second, SessionExpirationDuration: 28800, // 8 hours in blocks }, Local: LocalConfig{ Path: "./storage", Compression: true, }, S3: S3Config{ Region: "us-east-1", }, } }