repository

package
v0.27.0-geaaru Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright © 2022 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2022 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2022 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2022 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Index

Constants

View Source
const (
	REPOSITORY_METAFILE  = "repository.meta.yaml"
	REPOSITORY_SPECFILE  = "repository.yaml"
	TREE_TARBALL         = "tree.tar"
	COMPILERTREE_TARBALL = "compilertree.tar"

	REPOFILE_TREE_KEY          = "tree"
	REPOFILE_COMPILER_TREE_KEY = "compilertree"
	REPOFILE_META_KEY          = "meta"

	// TODO: To move on a specific package
	DiskRepositoryType   = "disk"
	HttpRepositoryType   = "http"
	DockerRepositoryType = "docker"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	DownloadArtifact(*artifact.PackageArtifact) (*artifact.PackageArtifact, error)
	DownloadFile(string) (string, error)
}

type Stone

type Stone struct {
	Name        string                 `json:"name" yaml:"name"`
	Category    string                 `json:"category" yaml:"category"`
	Version     string                 `json:"version" yaml:"version"`
	License     string                 `json:"license,omitempty" yaml:"license,omitempty"`
	Repository  string                 `json:"repository" yaml:"repository"`
	Hidden      bool                   `json:"hidden,omitempty" yaml:"hidden,omitempty"`
	Files       []string               `json:"files,omitempty" yaml:"files,omitempty"`
	Annotations map[string]interface{} `json:"annotations,omitempty" yaml:"annotations,omitempty"`
	Labels      map[string]string      `json:"labels,omitempty" yaml:"labels,omitempty"`
}

func NewStone

func NewStone(p *artifact.PackageArtifact, repo string, withFiles bool) *Stone

type StonesCatalog

type StonesCatalog struct {
	Index compiler.ArtifactIndex `json:"index" yaml:"index"`
}

type StonesPack

type StonesPack struct {
	Stones []*Stone `json:"stones" yaml:"stones"`
}

type StonesSearchOpts

type StonesSearchOpts struct {
	Packages      pkg.Packages
	Categories    []string
	Labels        []string
	LabelsMatches []string
	Matches       []string
	FilesOwner    []string
	Annotations   []string
	Hidden        bool
	AndCondition  bool
	WithFiles     bool
}

type WagonDocument

type WagonDocument struct {
	FileName        string                     `json:"filename" yaml:"filename"`
	CompressionType compression.Implementation `json:"compressiontype,omitempty" yaml:"compressiontype,omitempty"`
	Checksums       artifact.Checksums         `json:"checksums,omitempty" yaml:"checksums,omitempty"`
}

func (*WagonDocument) GetChecksums

func (f *WagonDocument) GetChecksums() artifact.Checksums

GetChecksums gets the checksum of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this gets the checksums that the client will use to verify the artifact

func (*WagonDocument) GetCompressionType

func (f *WagonDocument) GetCompressionType() compression.Implementation

GetCompressionType gets the compression type of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this gets the compression type that the client will use to uncompress the artifact

func (*WagonDocument) GetFileName

func (f *WagonDocument) GetFileName() string

GetFileName returns the name of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this gets the filename that the client will pull

func (*WagonDocument) SetChecksums

func (f *WagonDocument) SetChecksums(c artifact.Checksums)

SetChecksums sets the checksum of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this sets the checksums that the client will use to verify the artifact

func (*WagonDocument) SetCompressionType

func (f *WagonDocument) SetCompressionType(c compression.Implementation)

SetCompressionType sets the compression type of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this sets the compression type that the client will use to uncompress the artifact

func (*WagonDocument) SetFileName

func (f *WagonDocument) SetFileName(n string)

SetFileName sets the name of the repository file. Each repository can ship arbitrary file that will be downloaded by the client in case of need, this set the filename that the client will pull

type WagonIdentity

type WagonIdentity struct {
	*config.LuetRepository `yaml:",inline" json:",inline"`

	IdentityFile    string                    `yaml:-" json:"-"`
	RepositoryFiles map[string]*WagonDocument `yaml:"repo_files,omitempty" json:"repo_files,omitempty"`
}

func NewWagonIdentify

func NewWagonIdentify(l *config.LuetRepository) *WagonIdentity

func (*WagonIdentity) DownloadDocument

func (w *WagonIdentity) DownloadDocument(c Client, key string) (*artifact.PackageArtifact, error)

func (*WagonIdentity) GetAuthentication

func (w *WagonIdentity) GetAuthentication() map[string]string

func (*WagonIdentity) GetLastUpdate

func (w *WagonIdentity) GetLastUpdate() string

func (*WagonIdentity) GetMetaPath

func (w *WagonIdentity) GetMetaPath() string

func (*WagonIdentity) GetName

func (w *WagonIdentity) GetName() string

func (*WagonIdentity) GetRevision

func (w *WagonIdentity) GetRevision() int

func (*WagonIdentity) GetTreePath

func (w *WagonIdentity) GetTreePath() string

func (*WagonIdentity) GetType

func (w *WagonIdentity) GetType() string

func (*WagonIdentity) GetUrls

func (w *WagonIdentity) GetUrls() []string

func (*WagonIdentity) GetVerify

func (w *WagonIdentity) GetVerify() bool

func (*WagonIdentity) IncrementRevision

func (w *WagonIdentity) IncrementRevision()

func (*WagonIdentity) Is2Update

func (w *WagonIdentity) Is2Update(newIdentity *WagonIdentity) bool

func (*WagonIdentity) Load

func (w *WagonIdentity) Load(f string) error

func (*WagonIdentity) SetLastUpdate

func (w *WagonIdentity) SetLastUpdate(u string)

func (*WagonIdentity) SetType

func (w *WagonIdentity) SetType(p string)

func (*WagonIdentity) SetVerify

func (w *WagonIdentity) SetVerify(p bool)

func (*WagonIdentity) Valid

func (w *WagonIdentity) Valid() bool

type WagonRepository

type WagonRepository struct {
	Identity *WagonIdentity
	Stones   *WagonStones
}

func NewWagonRepository

func NewWagonRepository(l *config.LuetRepository) *WagonRepository

func (*WagonRepository) ClearCatalog

func (w *WagonRepository) ClearCatalog()

func (*WagonRepository) Client

func (w *WagonRepository) Client() Client

func (*WagonRepository) GetLastUpdate

func (w *WagonRepository) GetLastUpdate() string

func (*WagonRepository) GetRevision

func (w *WagonRepository) GetRevision() int

func (*WagonRepository) HasLocalWagonIdentity

func (w *WagonRepository) HasLocalWagonIdentity(wdir string) bool

func (*WagonRepository) IncrementRevision

func (w *WagonRepository) IncrementRevision()

func (*WagonRepository) ReadWagonIdentify

func (w *WagonRepository) ReadWagonIdentify(wdir string) error

func (*WagonRepository) SearchStones

func (w *WagonRepository) SearchStones(opts *StonesSearchOpts) (*[]*Stone, error)

func (*WagonRepository) SetLastUpdate

func (w *WagonRepository) SetLastUpdate(u string)

func (*WagonRepository) Sync

func (w *WagonRepository) Sync(force bool) error

The Sync method update the repository.

In particular, follow these steps:

  • download the main repository.yaml file to a temporary directory
  • load the new repository.yaml as WagonIdentity and compare revision and last update date with the current status.
  • if there is a new revision download the meta and tree file and unpack them to the local cache.

If force is true the download of the meta and tree files are done always.

type WagonStones

type WagonStones struct {
	Catalog *StonesCatalog
}

func NewWagonStones

func NewWagonStones() *WagonStones

func (*WagonStones) LoadCatalog

func (s *WagonStones) LoadCatalog(identity *WagonIdentity) (*StonesCatalog, error)

func (*WagonStones) Search

func (s *WagonStones) Search(opts *StonesSearchOpts, repoName string) (*[]*Stone, error)

Jump to

Keyboard shortcuts

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