get

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2018 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFileNotFound = errors.New("File not found")

ErrFileNotFound signals that the requested file was not found

Functions

func ReadURL added in v0.1.5

func ReadURL(url string) (r io.ReadCloser, err error)

ReadURL returns a Reader for bytes from an http URL

Types

type FileStorage

type FileStorage struct {
	// contains filtered or unexported fields
}

FileStorage allows to store data in a local directory

func (*FileStorage) Commit

func (s *FileStorage) Commit() (err error)

Commit moves any temporary file accumulated so far to the permanent location

func (*FileStorage) NewReader added in v0.1.5

func (s *FileStorage) NewReader(filename string) (reader io.ReadCloser, err error)

NewReader returns a Reader for a file in the permanent location, returns ErrFileNotFound if the requested path was not found at all

func (*FileStorage) Recycle

func (s *FileStorage) Recycle(filename string) (err error)

Recycle will copy a file from the permanent to the temporary location

func (*FileStorage) StoringMapper

func (s *FileStorage) StoringMapper(filename string, checksum string, hash crypto.Hash) util.ReaderMapper

StoringMapper returns a mapper that will store read data to a temporary location specified by filename

type S3Storage

type S3Storage struct {
	// contains filtered or unexported fields
}

S3Storage allows to store data in an Amazon S3 bucket

func (*S3Storage) Commit

func (s *S3Storage) Commit() (err error)

Commit moves any temporary file accumulated so far to the permanent location

func (*S3Storage) NewReader added in v0.1.5

func (s *S3Storage) NewReader(filename string) (reader io.ReadCloser, err error)

NewReader returns a Reader for a file in the permanent location, returns ErrFileNotFound if the requested path was not found at all

func (*S3Storage) Recycle

func (s *S3Storage) Recycle(filename string) (err error)

Recycle will copy a file from the permanent to the temporary location

func (*S3Storage) StoringMapper

func (s *S3Storage) StoringMapper(filename string, checksum string, hash crypto.Hash) (mapper util.ReaderMapper)

StoringMapper returns a mapper that will store read data to a temporary location specified by filename

type Storage

type Storage interface {
	// StoringMapper returns a mapper that will store read data to a temporary location specified by filename
	StoringMapper(filename string, checksum string, hash crypto.Hash) util.ReaderMapper
	// Commit moves any temporary file accumulated so far to the permanent location
	Commit() (err error)
	// NewReader returns a Reader for a file in the permanent location, returns ErrFileNotFound
	// if the requested path was not found at all
	NewReader(filename string) (reader io.ReadCloser, err error)
	// Recycle will copy a file from the permanent to the temporary location
	Recycle(filename string) (err error)
}

Storage allows to store data in the form of files. Files are accumulated in a "temporary" location until Commit is called at that point any file in the temporary location is moved in the "permanent" location

func NewFileStorage

func NewFileStorage(directory string) Storage

NewFileStorage returns a new Storage given a local directory

func NewS3Storage

func NewS3Storage(accessKeyID string, secretAccessKey string, region string, bucket string) (storage Storage, err error)

NewS3Storage returns a new Storage backed by an S3 bucket

type Syncer

type Syncer struct {
	// URL of the repo this syncer syncs
	Url string
	// contains filtered or unexported fields
}

Syncer syncs repos from an HTTP source to a Storage

func NewSyncer

func NewSyncer(url string, archs map[string]bool, storage Storage) *Syncer

NewSyncer creates a new Syncer

func (*Syncer) StoreRepo

func (r *Syncer) StoreRepo() (err error)

StoreRepo stores an HTTP repo in a Storage, automatically retrying in case of recoverable errors

type UnexpectedStatusCodeError added in v0.1.5

type UnexpectedStatusCodeError struct {
	URL        string
	StatusCode int
}

UnexpectedStatusCodeError signals a successful request that resulted in an unexpected status code

func (UnexpectedStatusCodeError) Error added in v0.1.5

type XMLChecksum

type XMLChecksum struct {
	Type     string `xml:"type,attr"`
	Checksum string `xml:",cdata"`
}

XMLChecksum maps a <checksum> tag in repodata/<ID>-primary.xml.gz

type XMLData

type XMLData struct {
	Type     string      `xml:"type,attr"`
	Location XMLLocation `xml:"location"`
}

XMLData maps a <data> tag in repodata/repomd.xml

type XMLLocation

type XMLLocation struct {
	Href string `xml:"href,attr"`
}

XMLLocation maps a <location> tag in repodata/repomd.xml or repodata/<ID>-primary.xml.gz

type XMLMetaData

type XMLMetaData struct {
	Packages []XMLPackage `xml:"package"`
}

XMLMetaData maps a <metadata> tag in repodata/<ID>-primary.xml.gz

type XMLPackage

type XMLPackage struct {
	Arch     string      `xml:"arch"`
	Location XMLLocation `xml:"location"`
	Checksum XMLChecksum `xml:"checksum"`
}

XMLPackage maps a <package> tag in repodata/<ID>-primary.xml.gz

type XMLRepomd

type XMLRepomd struct {
	Data []XMLData `xml:"data"`
}

XMLRepomd maps a <repomd> tag in repodata/repomd.xml

Jump to

Keyboard shortcuts

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