Documentation
¶
Index ¶
- Variables
- type EventHub
- type EventPublisher
- type ProviderIdentityResolver
- type ProviderRegistry
- type Server
- func (s *Server) Run(ctx context.Context) error
- func (s *Server) Serve(ctx context.Context, listener net.Listener) error
- func (s *Server) WithAuthConfig(cfg config.AdminAuthConfig) error
- func (s *Server) WithEventHub(events *EventHub) *Server
- func (s *Server) WithEvictMaxRetries(maxRetries int) *Server
- func (s *Server) WithFilecoinReadiness(probe filecoinReadinessProbe) *Server
- func (s *Server) WithObjectStorage(storage synapse.StorageClient) *Server
- func (s *Server) WithObjectUploader(uploader objectUploader) *Server
- func (s *Server) WithObjectVersionRestorer(restorer objectVersionRestorer) *Server
- func (s *Server) WithObservability(service *observability.Service) *Server
- func (s *Server) WithProviderIdentityResolver(resolver providerIdentityLookup) *Server
- func (s *Server) WithProviderReplacement(selector providerReplacementSelector) *Server
- func (s *Server) WithProviderReplacementMaxRetries(maxRetries int) *Server
- func (s *Server) WithS3IAM(iam auth.IAMService, rootAccess string) *Server
- func (s *Server) WithSettings(settings *SettingsService) *Server
- func (s *Server) WithStorageCleanupMaxRetries(maxRetries int) *Server
- func (s *Server) WithTaskDiagnosticStatusChecker(checker taskDiagnosticStatusChecker) *Server
- func (s *Server) WithTrustedProxies(values []string) error
- func (s *Server) WithUploadMaxRetries(maxRetries int) *Server
- type SettingsService
- func (s *SettingsService) FilecoinDraftConfig(req *settingsFilecoinUpdate) (*config.Config, []config.FieldError)
- func (s *SettingsService) Snapshot(writable bool) settingsResponse
- func (s *SettingsService) Update(req settingsUpdateRequest, writable bool) (settingsResponse, []config.FieldError, error)
- func (s *SettingsService) Validate(req settingsUpdateRequest) ([]config.FieldError, error)
- type StorageProviderSelector
- type WorkerHealthChecker
Constants ¶
This section is empty.
Variables ¶
var ( // ObjectOperationsTotal counts S3 object operations by type and status. ObjectOperationsTotal = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: "synaps3", Subsystem: "backend", Name: "object_operations_total", Help: "Total S3 object operations by type and status", }, []string{"operation", "status"}) // CacheUsedBytes tracks current cache usage in bytes. CacheUsedBytes = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: "synaps3", Subsystem: "cache", Name: "used_bytes", Help: "Current cache usage in bytes", }) // CacheHitsTotal counts cache hits (object found locally). CacheHitsTotal = promauto.NewCounter(prometheus.CounterOpts{ Namespace: "synaps3", Subsystem: "cache", Name: "hits_total", Help: "Total cache hits (object found locally)", }) // CacheMissesTotal counts cache misses (object not found locally). CacheMissesTotal = promauto.NewCounter(prometheus.CounterOpts{ Namespace: "synaps3", Subsystem: "cache", Name: "misses_total", Help: "Total cache misses (object not found locally)", }) // CacheLRUEvictionPaused reports whether LRU eviction is paused because // recent cache access could not be retained safely. CacheLRUEvictionPaused = promauto.NewGauge(prometheus.GaugeOpts{ Namespace: "synaps3", Subsystem: "cache", Name: "lru_eviction_paused", Help: "Whether LRU cache eviction is paused because recent cache access could not be retained safely", }) // WorkerTasksProcessed counts tasks processed by worker type and result. WorkerTasksProcessed = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: "synaps3", Subsystem: "worker", Name: "tasks_processed_total", Help: "Total tasks processed by worker type and result", }, []string{"worker", "result"}) // TasksExhaustedTotal counts tasks that entered exhausted status by worker type and task type. TasksExhaustedTotal = promauto.NewCounterVec(prometheus.CounterOpts{ Namespace: "synaps3", Subsystem: "worker", Name: "tasks_exhausted_total", Help: "Total tasks that entered exhausted status", }, []string{"worker", "task_type"}) // TaskQueueDepth tracks active task count by type and status. TaskQueueDepth = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "synaps3", Subsystem: "task", Name: "queue_depth", Help: "Number of tasks by type and status", }, []string{"type", "status"}) // WorkerTaskDuration tracks per-task processing duration in seconds. WorkerTaskDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{ Namespace: "synaps3", Subsystem: "worker", Name: "task_duration_seconds", Help: "Task processing duration in seconds by worker", Buckets: prometheus.ExponentialBuckets(0.1, 2, 12), }, []string{"worker"}) // ObjectStateDistribution tracks object count by state. ObjectStateDistribution = promauto.NewGaugeVec(prometheus.GaugeOpts{ Namespace: "synaps3", Subsystem: "object", Name: "state_distribution", Help: "Number of objects by state", }, []string{"state"}) )
Functions ¶
This section is empty.
Types ¶
type EventHub ¶
type EventHub struct {
// contains filtered or unexported fields
}
func NewEventHub ¶
func NewEventHub() *EventHub
type EventPublisher ¶
type ProviderIdentityResolver ¶
type ProviderIdentityResolver struct {
// contains filtered or unexported fields
}
ProviderIdentityResolver asynchronously enriches Registry provider IDs for admin API responses.
func NewProviderIdentityResolver ¶
func NewProviderIdentityResolver(registry *spregistry.Service, rpcURL string, logger *slog.Logger) *ProviderIdentityResolver
NewProviderIdentityResolver creates a cached provider identity resolver backed by the Registry and Filecoin RPC.
func (*ProviderIdentityResolver) ProviderIdentities ¶
func (r *ProviderIdentityResolver) ProviderIdentities(providerIDs []idtypes.OnChainID) map[string]*providerIdentityResponse
func (*ProviderIdentityResolver) Run ¶
func (r *ProviderIdentityResolver) Run(ctx context.Context)
func (*ProviderIdentityResolver) SetProviderIdentityPublisher ¶
func (r *ProviderIdentityResolver) SetProviderIdentityPublisher(publish func(*providerIdentityResponse))
type ProviderRegistry ¶
type ProviderRegistry interface {
ListProviderObservations(ctx context.Context, opts observability.ListOptions) (observability.ProviderObservationPage, error)
}
ProviderRegistry lists the storage providers a replacement can move to. It is an interface so provider selection stays testable without live observability.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides /healthz and /metrics endpoints on a separate port.
func New ¶
func New( addr string, db *bun.DB, c cache.Cache, cacheGate *cacheaccess.Gate, cacheAccessTracker *cacheaccess.Tracker, cacheMaxBytes int64, repos *repository.Repositories, wh WorkerHealthChecker, wallet synapse.WalletQuerier, filecoinDefaultCopies int, logger *slog.Logger, ) *Server
New creates a new admin HTTP server.
func NewSetup ¶
func NewSetup(addr string, settings *SettingsService, logger *slog.Logger) *Server
NewSetup creates an admin HTTP server for first-run/setup mode.
func (*Server) Serve ¶
Serve serves the admin API on listener until ctx is cancelled. The listener is owned by Serve and closed during shutdown.
func (*Server) WithAuthConfig ¶
func (s *Server) WithAuthConfig(cfg config.AdminAuthConfig) error
func (*Server) WithEventHub ¶
func (*Server) WithEvictMaxRetries ¶
WithEvictMaxRetries configures max retries for eviction tasks created by admin actions.
func (*Server) WithFilecoinReadiness ¶
WithFilecoinReadiness enables Filecoin readiness API routes.
func (*Server) WithObjectStorage ¶
func (s *Server) WithObjectStorage(storage synapse.StorageClient) *Server
WithObjectStorage enables provider-backed object reads for admin downloads.
func (*Server) WithObjectUploader ¶
WithObjectUploader enables admin object uploads through the existing object write path.
func (*Server) WithObjectVersionRestorer ¶
WithObjectVersionRestorer enables admin object version restore operations.
func (*Server) WithObservability ¶
func (s *Server) WithObservability(service *observability.Service) *Server
func (*Server) WithProviderIdentityResolver ¶
WithProviderIdentityResolver enables provider identity enrichment for admin APIs.
func (*Server) WithProviderReplacement ¶
WithProviderReplacement enables the provider replacement endpoints. Without it they report that the storage service is unavailable.
func (*Server) WithProviderReplacementMaxRetries ¶
WithProviderReplacementMaxRetries sets the provider replacement retry limit.
func (*Server) WithS3IAM ¶
func (s *Server) WithS3IAM(iam auth.IAMService, rootAccess string) *Server
WithS3IAM enables S3 user management API routes.
func (*Server) WithSettings ¶
func (s *Server) WithSettings(settings *SettingsService) *Server
WithSettings enables settings API routes on a full admin server.
func (*Server) WithStorageCleanupMaxRetries ¶
WithStorageCleanupMaxRetries configures max retries for storage cleanup tasks created by admin actions.
func (*Server) WithTaskDiagnosticStatusChecker ¶
func (*Server) WithTrustedProxies ¶
func (*Server) WithUploadMaxRetries ¶
WithUploadMaxRetries sets the retry budget replacement coordinators inherit.
type SettingsService ¶
type SettingsService struct {
// contains filtered or unexported fields
}
func NewSettingsService ¶
func (*SettingsService) FilecoinDraftConfig ¶
func (s *SettingsService) FilecoinDraftConfig(req *settingsFilecoinUpdate) (*config.Config, []config.FieldError)
func (*SettingsService) Snapshot ¶
func (s *SettingsService) Snapshot(writable bool) settingsResponse
func (*SettingsService) Update ¶
func (s *SettingsService) Update(req settingsUpdateRequest, writable bool) (settingsResponse, []config.FieldError, error)
func (*SettingsService) Validate ¶
func (s *SettingsService) Validate(req settingsUpdateRequest) ([]config.FieldError, error)
type StorageProviderSelector ¶
type StorageProviderSelector struct {
// contains filtered or unexported fields
}
StorageProviderSelector reports which storage providers a replacement can use. It resolves candidates only; the paid service itself is created later by the worker, after the operator has confirmed.
func NewStorageProviderSelector ¶
func NewStorageProviderSelector(providers ProviderRegistry) *StorageProviderSelector
NewStorageProviderSelector builds the provider inventory used by replacement.
func (*StorageProviderSelector) ListReplacementProviders ¶
func (s *StorageProviderSelector) ListReplacementProviders(ctx context.Context) ([]idtypes.OnChainID, error)
ListReplacementProviders returns the providers currently reachable and able to take a data set, lowest registry ID first so the same inventory always yields the same choice. Which of them a given replica can take is decided by replacementProviderCandidates, which owns that rule alone.
It reads the same provider observations the storage topology reports and applies the same availability filter, so the two views cannot disagree: a provider an operator sees listed as available there is offered here, and one that is unreachable is offered in neither. Reading the registry directly would drop the health signal and offer providers that cannot answer.
The inventory is deliberately not narrowed to the storage service's approved-provider list. That list governs the SDK's automatic selection only -- naming a provider outright bypasses it -- so filtering on it here would hide providers replacement can in fact use, and it is small enough for one bucket to exhaust.
type WorkerHealthChecker ¶
WorkerHealthChecker provides worker liveness info. Implemented by worker.Manager.
Source Files
¶
- api_bucket_storage_health.go
- api_buckets.go
- api_copy_health.go
- api_filecoin_readiness.go
- api_object_upload.go
- api_object_version_restore.go
- api_observability.go
- api_overview.go
- api_replacement.go
- api_s3_users.go
- api_settings.go
- api_storage_confirmations.go
- api_system.go
- api_task_diagnostics.go
- api_tasks.go
- api_wallet.go
- auth.go
- events.go
- metrics.go
- provider_identity.go
- replacement_candidates.go
- replacement_selector.go
- server.go
- spa.go
- wallet_cache.go