Documentation
¶
Overview ¶
Package repository contains utilities abstracting git repositories configuration and source code pulling
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClientNotAllowed = errors.New("client is not allowed to access the requested resource")
ErrClientNotAllowed is returned whenever a client tries to access a repository it has not been whitelisted for
var ErrRepositoryNotFound = errors.New("the requested repository does not exist")
ErrRepositoryNotFound is returned whenever a client requests a repository which is not existing
Functions ¶
This section is empty.
Types ¶
type Beholder ¶
type Beholder struct { Active bool // true if the repository is actively monitored and can be used // contains filtered or unexported fields }
Beholder are responsible for maintaining local copies of git repositories up to date based on the provided configuration As they are running in background they make use of a heartbeat channel towards their initiator to communicate about repositories update event
func NewBeholder ¶
func NewBeholder(checkoutLocation string, configuration *configuration.Repository, heartbeat chan UpdateEvent) *Beholder
NewBeholder initiates a new beholder for the provided configuration a call to Watch() is mandatory to start the beholder process
type Manager ¶
type Manager struct { Configuration *config.Repositories // git configuration Repositories map[string]*Repository // list of configured repository Heartbeat chan UpdateEvent // uplink channel used by beholders to communicate }
Manager is one-stop shop for managing multiple repositories configured via yaml files
func NewManager ¶
func NewManager(configuration *config.Repositories) (*Manager, error)
NewManager creates a new repository manager by parsing the provided target repository configuration location
func (*Manager) Start ¶
func (mgr *Manager) Start()
Start will generate a repository beholder for each found configuration and will attempt to create a local copy
func (*Manager) Statistics ¶
func (mgr *Manager) Statistics() map[string]*Statistics
Statistics returns underlying git repository access statistics
type Repository ¶
type Repository struct { Configuration *configuration.Repository // repository configuration Statistics *Statistics // repository access statistics Beholder *Beholder // beholder process managing the repository }
Repository is a handle on a git repository
func (*Repository) IsClientAllowed ¶
func (repo *Repository) IsClientAllowed(ClientID string) bool
IsClientAllowed verifies if the provided ClientID is allowed to access the repository based on its configuration