Documentation
¶
Overview ¶
Package publishing keeps the rules publishing follows for the repositories under each prefix, and the presets — named sets of rules — those settings take: gitd's own, those of the configuration file, shown and never changed through the API, and those a platform sets through it, kept under the state directory and applied at once.
Index ¶
- Constants
- Variables
- type Effective
- type File
- type Group
- type Store
- func (store *Store) All() []*gitdv1.PublishSettings
- func (store *Store) For(repository repo.Repo) Effective
- func (store *Store) Presets() []*gitdv1.Preset
- func (store *Store) Remove(prefix string) error
- func (store *Store) RemovePreset(name string) error
- func (store *Store) Set(settings *gitdv1.PublishSettings) (*gitdv1.PublishSettings, error)
- func (store *Store) SetPreset(preset *gitdv1.Preset) (*gitdv1.Preset, error)
Constants ¶
const RecommendedName = "recommended"
RecommendedName is the name of gitd's own preset.
Variables ¶
var ( ErrFromFile = errors.New("these settings are the configuration file's: change them there") ErrNotFound = errors.New("no settings have that prefix") )
Errors a change to the settings is refused with.
var ErrInUse = errors.New("settings take this preset: change them first")
ErrInUse is a preset settings still take, which cannot be removed.
var ErrInvalid = errors.New("invalid publishing settings")
ErrInvalid is settings that cannot be kept, saying why.
Functions ¶
This section is empty.
Types ¶
type Effective ¶
type Effective struct {
Groups []Group
MaxFiles int32
BranchPrefix string
PullRequests *gitdv1.PullRequestSettings
Applied []string
}
Effective is what publishing a repository must follow, from every setting whose prefix opens it: each setting's rules as a group, checked on their own, so the paths one setting allows never free what another protects or keeps; the smallest file limit; the branch prefix and pull request choices of the most specific setting that has them. Applied names the settings it came from, broadest first.
type File ¶
type File struct {
Presets []*gitdv1.Preset
Settings []*gitdv1.PublishSettings
}
File is the presets and settings of the configuration file.
type Group ¶
Group is the rules one setting brings, its preset's and its own: paths a publish may not change, paths it may not delete, and the paths those rules leave free. From names the setting.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is every setting and preset: the configuration file's, then those set through the API.
func Open ¶
Open reads the settings and presets kept in directory, making it if it is not there, beside those of the configuration file (FromFile).
func (*Store) All ¶
func (store *Store) All() []*gitdv1.PublishSettings
All is every setting, the file's first, as copies.
func (*Store) Presets ¶
Presets is every preset as it applies: gitd's own unless replaced, then the file's, then those set through the API, each name once.
func (*Store) RemovePreset ¶
RemovePreset forgets a preset set through the API. One settings still take is refused, unless gitd has its own of that name, which then applies again.
func (*Store) Set ¶
func (store *Store) Set(settings *gitdv1.PublishSettings) (*gitdv1.PublishSettings, error)
Set keeps the settings of a prefix, replacing those it had, once checked alone and against every other, and returns them as kept.