Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoMigrate ¶
Types ¶
type MirrorzRepo ¶ added in v0.7.0
type MirrorzRepo struct {
Name string `json:"name" validate:"required"`
Cache bool `json:"cache,omitempty"`
}
MirrorzRepo describes a logical repository to which a sync task contributes. Runtime state remains attached to RepoMeta; consumers are responsible for aggregating multiple tasks that reference the same logical repository.
type Repo ¶
type Repo struct {
Name string `gorm:"primaryKey" json:"name" validate:"required,repo-name"`
// NOTE: the cron validator does not support */number syntax
Cron string `json:"cron" validate:"required"`
Image string `json:"image" validate:"required"`
StorageDir string `json:"storageDir" validate:"required,dir"`
User string `json:"user"`
BindIP string `json:"bindIP" validate:"omitempty,ip"`
Network string `json:"network"`
LogRotCycle int `json:"logRotCycle" validate:"min=0"`
Retry int `json:"retry" validate:"min=0"`
Envs StringMap `gorm:"type:text;serializer:json" json:"envs"`
Volumes StringMap `gorm:"type:text;serializer:json" json:"volumes"`
Mirrorz []MirrorzRepo `gorm:"type:text;serializer:json" json:"mirrorz" validate:"dive"`
Disable bool `json:"disable"`
// sqlite3 does not have builtin datetime type
CreatedAt int64 `gorm:"autoCreateTime" json:"-"`
UpdatedAt int64 `gorm:"autoUpdateTime" json:"-"`
}
Repo represents a Repository.
func (Repo) EffectiveMirrorz ¶ added in v0.7.0
func (r Repo) EffectiveMirrorz() []MirrorzRepo
EffectiveMirrorz returns the persisted mapping, applying the default for databases created before the MirrorZ field was introduced.
func (*Repo) NormalizeMirrorz ¶ added in v0.7.0
NormalizeMirrorz applies the default one-task-to-one-repository mapping. A non-nil empty slice explicitly opts the task out of MirrorZ integration.
type RepoMeta ¶
type RepoMeta struct {
Name string `gorm:"primaryKey"`
Upstream string
Size int64
ExitCode int
CreatedAt int64 `gorm:"autoCreateTime"`
UpdatedAt int64 `gorm:"autoUpdateTime"`
LastSuccess int64
PrevRun int64
NextRun int64
Syncing bool
}
RepoMeta represents the metadata of a Repository.
Click to show internal directories.
Click to hide internal directories.