Version: v1.1.1 Latest Latest

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

Go to latest
Published: Aug 11, 2017 License: MIT Imports: 11 Imported by: 0



Package files handles operation on filesystem for both public pool and published files



View Source
const (
	LinkMethodHardLink uint = iota

Constants defining the type of creating links

View Source
const (
	VerificationMethodChecksum uint = iota

Constants defining the type of file verification for LinkMethodCopy


This section is empty.


func NewMockChecksumStorage added in v1.1.0

func NewMockChecksumStorage() aptly.ChecksumStorage

NewMockChecksumStorage creates aptly.ChecksumStorage for tests


type PackagePool

type PackagePool struct {
	// contains filtered or unexported fields

PackagePool is deduplicated storage of package files on filesystem

func NewPackagePool

func NewPackagePool(root string, supportLegacyPaths bool) *PackagePool

NewPackagePool creates new instance of PackagePool which specified root

func (*PackagePool) FilepathList

func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error)

FilepathList returns file paths of all the files in the pool

func (*PackagePool) FullPath added in v1.1.0

func (pool *PackagePool) FullPath(path string) string

FullPath generates full path to the file in pool

Please use with care: it's not supposed to be used to access files

func (*PackagePool) GenerateTempPath added in v1.1.0

func (pool *PackagePool) GenerateTempPath(filename string) (string, error)

GenerateTempPath generates temporary path for download (which is fast to import into package pool later on)

func (*PackagePool) Import

func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.ChecksumInfo, move bool, checksumStorage aptly.ChecksumStorage) (string, error)

Import copies file into package pool

- srcPath is full path to source file as it is now - basename is desired human-readable name (canonical filename) - checksums are used to calculate file placement - move indicates whether srcPath can be removed

func (*PackagePool) LegacyPath added in v1.1.0

func (pool *PackagePool) LegacyPath(filename string, checksums *utils.ChecksumInfo) (string, error)

LegacyPath returns path relative to pool's root for pre-1.1 aptly (based on MD5)

func (pool *PackagePool) Link(path, dstPath string) error

Link generates hardlink to destination path

func (*PackagePool) Open added in v1.1.0

func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error)

Open returns io.ReadCloser to access the file

func (*PackagePool) Remove

func (pool *PackagePool) Remove(path string) (size int64, err error)

Remove deletes file in package pool returns its size

func (*PackagePool) Stat added in v1.1.0

func (pool *PackagePool) Stat(path string) (os.FileInfo, error)

Stat returns Unix stat(2) info

func (pool *PackagePool) Symlink(path, dstPath string) error

Symlink generates symlink to destination path

func (*PackagePool) Verify added in v1.1.0

func (pool *PackagePool) Verify(poolPath, basename string, checksums *utils.ChecksumInfo, checksumStorage aptly.ChecksumStorage) (string, bool, error)

Verify checks whether file exists in the pool and fills back checksum info

if poolPath is empty, poolPath is generated automatically based on checksum info (if available) in any case, if function returns true, it also fills back checksums with complete information about the file in the pool

type PublishedStorage

type PublishedStorage struct {
	// contains filtered or unexported fields

PublishedStorage abstract file system with public dirs (published repos)

func NewPublishedStorage

func NewPublishedStorage(root string, linkMethod string, verifyMethod string) *PublishedStorage

NewPublishedStorage creates new instance of PublishedStorage which specified root

func (*PublishedStorage) Filelist added in v0.5.1

func (storage *PublishedStorage) Filelist(prefix string) ([]string, error)

Filelist returns list of files under prefix

func (*PublishedStorage) LinkFromPool

func (storage *PublishedStorage) LinkFromPool(publishedDirectory, baseName string, sourcePool aptly.PackagePool,
	sourcePath string, sourceChecksums utils.ChecksumInfo, force bool) error

LinkFromPool links package file from pool to dist's pool location

publishedDirectory is desired location in pool (like prefix/pool/component/liba/libav/) sourcePool is instance of aptly.PackagePool sourcePath is a relative path to package file in package pool

LinkFromPool returns relative path for the published file to be included in package index

func (*PublishedStorage) MkDir

func (storage *PublishedStorage) MkDir(path string) error

MkDir creates directory recursively under public path

func (*PublishedStorage) PublicPath

func (storage *PublishedStorage) PublicPath() string

PublicPath returns root of public part

func (*PublishedStorage) PutFile added in v0.7.1

func (storage *PublishedStorage) PutFile(path string, sourceFilename string) error

PutFile puts file into published storage at specified path

func (*PublishedStorage) Remove added in v0.5.1

func (storage *PublishedStorage) Remove(path string) error

Remove removes single file under public path

func (*PublishedStorage) RemoveDirs

func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error

RemoveDirs removes directory structure under public path

func (*PublishedStorage) RenameFile added in v0.5.1

func (storage *PublishedStorage) RenameFile(oldName, newName string) error

RenameFile renames (moves) file

Jump to

Keyboard shortcuts

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