Documentation
¶
Overview ¶
Package profilesvc holds the live editing-profile set: the shipped defaults overlaid with a deployment's blob-persisted overrides, editable at runtime. Every override is run through profiles.Parse (the "framework test") before it is stored, so a structurally-bad profile is rejected at the API and can never reach the set the editor and op-builder read from. Overrides live in the blob store (durable across restarts, like vocabulary snapshots), keyed by profile id under Prefix.
Index ¶
- Variables
- type ListEntry
- type Service
- func (s *Service) DeleteOverride(ctx context.Context, id string) error
- func (s *Service) Get(id string) (p *profiles.Profile, etag string, overridden bool, err error)
- func (s *Service) List() []ListEntry
- func (s *Service) Load(ctx context.Context) error
- func (s *Service) Mapper() *editor.Mapper
- func (s *Service) Overridden(id string) bool
- func (s *Service) Put(ctx context.Context, id string, data []byte, ifMatch string) (string, error)
- func (s *Service) Reload(ctx context.Context) error
- func (s *Service) Set() profiles.Set
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound reports that no profile (or no override) exists for an id. ErrNotFound = errors.New("profilesvc: not found") // ErrInvalid wraps a profiles.Parse failure on a save. ErrInvalid = errors.New("profilesvc: invalid profile") // ErrIDMismatch reports that a saved profile's id differs from its path id. ErrIDMismatch = errors.New("profilesvc: profile id does not match path") // ErrConflict reports a lost optimistic-lock race on save. ErrConflict = errors.New("profilesvc: version conflict") // ErrReadOnly reports a mutation attempted without a blob store. ErrReadOnly = errors.New("profilesvc: no blob store; profiles are read-only") )
Functions ¶
This section is empty.
Types ¶
type ListEntry ¶
ListEntry pairs a profile with whether an override currently shadows it, read from one snapshot so the pair is always coherent.
type Service ¶
type Service struct {
Blob blob.Store
Prefix string
Logger *slog.Logger
// contains filtered or unexported fields
}
Service owns the active profile set. The zero value is unusable; construct with New. A nil Blob yields a defaults-only, read-only service.
func (*Service) DeleteOverride ¶
DeleteOverride removes id's blob override and reloads, reverting to the shipped default (or dropping the profile if it had none). ErrNotFound when no override exists.
func (*Service) Get ¶
Get returns the active profile for id, its override etag ("" when the profile is the shipped default), and whether it is overridden.
func (*Service) List ¶
List returns every profile with its override state, from one coherent snapshot (so the overridden flag always matches the returned profile).
func (*Service) Load ¶
Load builds the initial set: the embedded defaults overlaid with the blob overrides. It is Reload, exposed under a boot-friendly name.
func (*Service) Mapper ¶
Mapper builds the read/op mapper from the live set, so record rendering and batch ops follow runtime edits to the work and instance profiles.
func (*Service) Overridden ¶
Overridden reports whether id currently has a blob override.
func (*Service) Put ¶
Put validates data, persists it as id's override under optimistic locking, then reloads the set. An empty ifMatch means create-only (the first override of a default, or a brand-new profile); a non-empty ifMatch requires the stored override to still carry that etag. Returns the new etag.