admin

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DatabaseMetricsCollectionSuccess = promauto.NewGauge(prometheus.GaugeOpts{
		Namespace: "synaps3", Subsystem: "database_metrics", Name: "collection_success",
		Help: "Whether the most recent database metrics collection succeeded",
	})
	DatabaseMetricsLastSuccess = promauto.NewGauge(prometheus.GaugeOpts{
		Namespace: "synaps3", Subsystem: "database_metrics", Name: "last_success_timestamp_seconds",
		Help: "Unix timestamp of the last successful database metrics collection",
	})
	// 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",
	})

	// 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"})

	// 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

func (*EventHub) Publish

func (h *EventHub) Publish(topic string, payload map[string]any)

type EventPublisher

type EventPublisher interface {
	Publish(topic string, payload map[string]any)
}

type ProviderIdentityResolver

type ProviderIdentityResolver struct {
	// contains filtered or unexported fields
}

ProviderIdentityResolver caches only Filecoin fields derived from a saved service provider address.

func NewProviderIdentityResolver

func NewProviderIdentityResolver(rpcURL string, logger *slog.Logger) *ProviderIdentityResolver

func (*ProviderIdentityResolver) EnrichActors

func (r *ProviderIdentityResolver) EnrichActors(identities map[string]*providerIdentityResponse) map[string]*providerIdentityResponse

func (*ProviderIdentityResolver) Run

func (*ProviderIdentityResolver) SetProviderIdentityPublisher

func (r *ProviderIdentityResolver) SetProviderIdentityPublisher(publish func(string))

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) Run

func (s *Server) Run(ctx context.Context) error

Run starts the admin HTTP server at its configured address.

func (*Server) RunDatabaseMetrics

func (s *Server) RunDatabaseMetrics(ctx context.Context)

RunDatabaseMetrics samples read-only database statistics until cancellation.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, listener net.Listener) error

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) WithCommitPolicy

func (s *Server) WithCommitPolicy(policy config.TaskWorkerConfig, legacyLimit uint64) *Server

func (*Server) WithEventHub

func (s *Server) WithEventHub(events *EventHub) *Server

func (*Server) WithEvictionPolicy added in v0.1.1

func (s *Server) WithEvictionPolicy(policy cache.EvictionPolicy) *Server

WithEvictionPolicy applies the cache eviction policy to admin downloads.

func (*Server) WithFilecoinReadiness

func (s *Server) WithFilecoinReadiness(probe filecoinReadinessProbe) *Server

WithFilecoinReadiness enables Filecoin readiness API routes.

func (*Server) WithMonitoring

func (s *Server) WithMonitoring(monitor *observability.RuntimeMonitor, counters *observability.TransferCounters) *Server

WithMonitoring connects the runtime's resource history and transfer counters.

func (*Server) WithObjectStorage

func (s *Server) WithObjectStorage(storage synapse.StorageClient) *Server

WithObjectStorage enables provider-backed object reads for admin downloads.

func (*Server) WithObjectUploader

func (s *Server) WithObjectUploader(uploader objectUploader) *Server

WithObjectUploader enables admin object uploads through the existing object write path.

func (*Server) WithObjectVersionRestorer

func (s *Server) WithObjectVersionRestorer(restorer objectVersionRestorer) *Server

WithObjectVersionRestorer enables admin object version restore operations.

func (*Server) WithObservability

func (s *Server) WithObservability(service *observability.Service) *Server

func (*Server) WithProviderIdentityResolver

func (s *Server) WithProviderIdentityResolver(resolver providerIdentityLookup) *Server

WithProviderIdentityResolver enables provider identity enrichment for admin APIs.

func (*Server) WithProviderReplacement

func (s *Server) WithProviderReplacement(selector providerReplacementSelector) *Server

WithProviderReplacement enables the provider replacement endpoints. Without it they report that Filecoin storage is unavailable.

func (*Server) WithProviderTier

func (s *Server) WithProviderTier(tier providerselect.Tier) *Server

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) WithTaskMessages

func (s *Server) WithTaskMessages(replacement, copyRetry *taskengine.Messenger) *Server

func (*Server) WithTaskService

func (s *Server) WithTaskService(service *taskengine.Service) *Server

func (*Server) WithTrustedProxies

func (s *Server) WithTrustedProxies(values []string) error

func (*Server) WithUploadSpeedTest

func (s *Server) WithUploadSpeedTest(cfg config.FilecoinUploadSpeedTestConfig) *Server

WithUploadSpeedTest supplies the running provider test policy.

func (*Server) WithWarmStorageMarket

func (s *Server) WithWarmStorageMarket(market WarmStorageMarket, chainID uint64, usdfcAddress string) *Server

type SettingsService

type SettingsService struct {
	// contains filtered or unexported fields
}

func NewSettingsService

func NewSettingsService(effective *config.Config, source config.Source) (*SettingsService, error)

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) ListReplacementProviderObservations

func (s *StorageProviderSelector) ListReplacementProviderObservations(ctx context.Context, providerID *idtypes.OnChainID) ([]observability.ProviderObservation, error)

ListReplacementProviderObservations reads the same observed inventory shown by storage topology; eligibility is decided by the caller.

type WarmStorageMarket

type WarmStorageMarket interface {
	GetPriceList(context.Context) (*warmstorage.PriceList, error)
	IsProviderApproved(context.Context, sdktypes.BigInt) (bool, error)
	FWSSAddress() common.Address
}

type WorkerHealthChecker

type WorkerHealthChecker interface {
	WorkerHealth() map[string]bool
}

WorkerHealthChecker provides worker liveness info. Implemented by worker.Manager.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址