Documentation
¶
Index ¶
- Variables
- type Option
- type PreviewFunc
- type PreviewResult
- type Schemas
- type Service
- func (s *Service) Aliases() map[string]string
- func (s *Service) ApplyConfig(ctx context.Context, cfg runtimeconfig.StorageConfig) error
- func (s *Service) GetProfile(ctx context.Context, name string) (*storage.Profile, error)
- func (s *Service) ListProfiles(ctx context.Context) ([]storage.Profile, error)
- func (s *Service) PreviewProfile(ctx context.Context, profile storage.Profile) (PreviewResult, error)
- func (s *Service) ResolveAlias(alias string) (string, bool)
- func (s *Service) Schemas() Schemas
- func (s *Service) ValidateConfig(cfg runtimeconfig.StorageConfig) error
- func (s *Service) ValidateProfile(profile storage.Profile, aliases map[string]string) error
- type Validator
Constants ¶
This section is empty.
Variables ¶
var ErrConfigInvalid = errors.New("adminstorage: storage configuration is invalid")
ErrConfigInvalid indicates configuration validation failed.
var ErrPreviewUnsupported = errors.New("adminstorage: preview not supported")
ErrPreviewUnsupported indicates the service was constructed without a preview helper.
var ErrRepositoryRequired = errors.New("adminstorage: repository is required")
ErrRepositoryRequired indicates the service was constructed without a repository.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Service)
Option mutates the service configuration.
func WithAuditRecorder ¶
func WithAuditRecorder(recorder jobs.AuditRecorder) Option
WithAuditRecorder overrides the audit recorder dependency.
func WithPreviewer ¶
func WithPreviewer(preview PreviewFunc) Option
WithPreviewer wires a preview helper used to verify storage profiles before activation.
func WithValidator ¶
WithValidator overrides the configuration validator used by the service.
type PreviewFunc ¶
PreviewFunc attempts to initialise a storage profile without mutating runtime state.
type PreviewResult ¶
type PreviewResult struct {
Profile storage.Profile `json:"profile"`
Capabilities storage.Capabilities `json:"capabilities"`
Diagnostics map[string]any `json:"diagnostics,omitempty"`
Warnings []string `json:"warnings,omitempty"`
}
PreviewResult reports metadata gathered during preview initialisation.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service synchronises runtime storage profiles with the backing repository and emits audit events.
func NewService ¶
func NewService(repo storageconfig.Repository, recorder jobs.AuditRecorder, opts ...Option) *Service
NewService constructs a storage admin service.
func (*Service) ApplyConfig ¶
func (s *Service) ApplyConfig(ctx context.Context, cfg runtimeconfig.StorageConfig) error
ApplyConfig maps the supplied runtime storage configuration to repository writes.
func (*Service) GetProfile ¶
GetProfile returns a single profile by name.
func (*Service) ListProfiles ¶
ListProfiles returns the stored profiles ordered by name.
func (*Service) PreviewProfile ¶
func (s *Service) PreviewProfile(ctx context.Context, profile storage.Profile) (PreviewResult, error)
PreviewProfile initialises the supplied profile using the configured previewer.
func (*Service) ResolveAlias ¶
ResolveAlias resolves an alias to its target profile name.
func (*Service) ValidateConfig ¶
func (s *Service) ValidateConfig(cfg runtimeconfig.StorageConfig) error
ValidateConfig ensures profile collections and aliases are well formed.
type Validator ¶
type Validator func(runtimeconfig.StorageConfig) error
Validator validates runtime configuration payloads before they are persisted.