publishing

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const RecommendedName = "recommended"

RecommendedName is the name of gitd's own preset.

Variables

View Source
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.

View Source
var ErrInUse = errors.New("settings take this preset: change them first")

ErrInUse is a preset settings still take, which cannot be removed.

View Source
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.

func (Effective) HasRules

func (effective Effective) HasRules() bool

HasRules says whether a publish has paths or a file limit to be checked against.

type File

type File struct {
	Presets  []*gitdv1.Preset
	Settings []*gitdv1.PublishSettings
}

File is the presets and settings of the configuration file.

func FromFile

func FromFile(publish config.Publish) (File, error)

FromFile reads the presets and settings of the configuration file, checked as the API checks its own. `[publish] branch_prefix` is the branch prefix of every repository.

type Group

type Group struct {
	From      string
	Protected []string
	Kept      []string
	Allowed   []string
}

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

func Open(directory string, fromFile File) (*Store, error)

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

func (store *Store) For(repository repo.Repo) Effective

For is what publishing a repository must follow now.

func (*Store) Presets

func (store *Store) Presets() []*gitdv1.Preset

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

func (store *Store) Remove(prefix string) error

Remove forgets the settings of a prefix set through the API.

func (*Store) RemovePreset

func (store *Store) RemovePreset(name string) error

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.

func (*Store) SetPreset

func (store *Store) SetPreset(preset *gitdv1.Preset) (*gitdv1.Preset, error)

SetPreset keeps a preset, replacing one of its name set through the API, and returns it as kept. A name the file uses is the file's.

Jump to

Keyboard shortcuts

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