source

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package source maintains local copies of (remote) repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sources

type Sources struct {
	// RootPath is the root of "workspace" and "repo" directories.
	// Workspaces have paths like "<RootPath>/workspace/namespace/name/_infra_" "work/namespace/name/clustername"
	// Repo directory are in "<RootPath>/repo/"
	RootPath string

	Log logr.Logger
	// contains filtered or unexported fields
}

Sources keeps a list of workspaces and associated the source repositories. Sources are added with Register().

func (*Sources) FetchAll

func (ss *Sources) FetchAll() error

FetchAll fetches all remote repo's or filesystems into a local repo directory. The fetch rate is limited to at most once per N minutes.

func (*Sources) Get

func (ss *Sources) Get(nsn types.NamespacedName, name string) (bool, error)

Get copies the source content to a workspace and returns true if the workspace has changed.

func (*Sources) Register

func (ss *Sources) Register(nsn types.NamespacedName, name string, spec v1.SourceSpec) error

Register nsn + name as requiring a workspace with spec content.

func (*Sources) Workspace

func (ss *Sources) Workspace(nsn types.NamespacedName, name string) (Workspace, bool)

Workspace returns the Workspace for a nsn + name. Returns false if workspace is not found.

type Workspace

type Workspace struct {
	// Path of the work directory.
	Path string
	// Spec of the required repo.
	Spec v1.SourceSpec
	// Hash of the content (limited to area).
	Hash string
	// Synced is true if the repo content is copied to the workspace.
	// Synced is false as long as a repo hasn't been fetched or Get() isn't called or Get() has been called but new repo
	// content is fetched.
	Synced bool
}

Workspace is a copy of a repo dedicated to a consumer.

Jump to

Keyboard shortcuts

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