Documentation ¶
Overview ¶
Package files handles operation on filesystem for both public pool and published files
Index ¶
- Constants
- func NewMockChecksumStorage() aptly.ChecksumStorage
- type PackagePool
- func (pool *PackagePool) FilepathList(progress aptly.Progress) ([]string, error)
- func (pool *PackagePool) FullPath(path string) string
- func (pool *PackagePool) GenerateTempPath(filename string) (string, error)
- func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.ChecksumInfo, move bool, ...) (string, error)
- func (pool *PackagePool) LegacyPath(filename string, checksums *utils.ChecksumInfo) (string, error)
- func (pool *PackagePool) Link(path, dstPath string) error
- func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error)
- func (pool *PackagePool) Remove(path string) (size int64, err error)
- func (pool *PackagePool) Stat(path string) (os.FileInfo, error)
- func (pool *PackagePool) Symlink(path, dstPath string) error
- func (pool *PackagePool) Verify(poolPath, basename string, checksums *utils.ChecksumInfo, ...) (string, bool, error)
- type PublishedStorage
- func (storage *PublishedStorage) FileExists(path string) (bool, error)
- func (storage *PublishedStorage) Filelist(prefix string) ([]string, error)
- func (storage *PublishedStorage) HardLink(src string, dst string) error
- func (storage *PublishedStorage) LinkFromPool(publishedDirectory, baseName string, sourcePool aptly.PackagePool, ...) error
- func (storage *PublishedStorage) MkDir(path string) error
- func (storage *PublishedStorage) PublicPath() string
- func (storage *PublishedStorage) PutFile(path string, sourceFilename string) error
- func (storage *PublishedStorage) ReadLink(path string) (string, error)
- func (storage *PublishedStorage) Remove(path string) error
- func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error
- func (storage *PublishedStorage) RenameFile(oldName, newName string) error
- func (storage *PublishedStorage) SymLink(src string, dst string) error
Constants ¶
const ( LinkMethodHardLink uint = iota LinkMethodSymLink LinkMethodCopy )
Constants defining the type of creating links
const ( VerificationMethodChecksum uint = iota VerificationMethodFileSize )
Constants defining the type of file verification for LinkMethodCopy
Variables ¶
This section is empty.
Functions ¶
func NewMockChecksumStorage ¶ added in v1.1.0
func NewMockChecksumStorage() aptly.ChecksumStorage
NewMockChecksumStorage creates aptly.ChecksumStorage for tests
Types ¶
type PackagePool ¶
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 (*PackagePool) Link ¶ added in v1.1.0
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 (*PackagePool) Symlink ¶ added in v1.1.0
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) FileExists ¶ added in v1.2.0
func (storage *PublishedStorage) FileExists(path string) (bool, error)
FileExists returns true if path exists
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) HardLink ¶ added in v1.2.0
func (storage *PublishedStorage) HardLink(src string, dst string) error
HardLink creates a hardlink of a file
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) ReadLink ¶ added in v1.2.0
func (storage *PublishedStorage) ReadLink(path string) (string, error)
ReadLink returns the symbolic link pointed to by path (relative to storage root)
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