Documentation ¶
Overview ¶
Package cacheitem is an abstraction over the creation and restoration of a cache
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clean ¶
Clean is extracted from stdlib and removes `FromSlash` processing of the stdlib version.
Clean returns the shortest path name equivalent to path by purely lexical processing. It applies the following rules iteratively until no further processing can be done:
- Replace multiple Separator elements with a single one.
- Eliminate each . path name element (the current directory).
- Eliminate each inner .. path name element (the parent directory) along with the non-.. element that precedes it.
- Eliminate .. elements that begin a rooted path: that is, replace "/.." by "/" at the beginning of a path, assuming Separator is '/'.
The returned path ends in a slash only if it represents a root directory, such as "/" on Unix or `C:\` on Windows.
Finally, any occurrences of slash are replaced by Separator.
If the result of this process is an empty string, Clean returns the string ".".
See also Rob Pike, “Lexical File Names in Plan 9 or Getting Dot-Dot Right,” https://9p.io/sys/doc/lexnames.html
Types ¶
type CacheItem ¶
type CacheItem struct { // Path is the location on disk for the CacheItem. Path titanpath.AbsoluteSystemPath // Anchor is the position on disk at which the CacheItem will be restored. Anchor titanpath.AbsoluteSystemPath // contains filtered or unexported fields }
CacheItem is a `tar` utility with a little bit extra.
func Create ¶
func Create(path titanpath.AbsoluteSystemPath) (*CacheItem, error)
Create makes a new CacheItem at the specified path.
func Open ¶
func Open(path titanpath.AbsoluteSystemPath) (*CacheItem, error)
Open returns an existing CacheItem at the specified path.
func (*CacheItem) AddFile ¶
func (ci *CacheItem) AddFile(fsAnchor titanpath.AbsoluteSystemPath, filePath titanpath.AnchoredSystemPath) error
AddFile adds a user-cached item to the tar.
func (*CacheItem) Restore ¶
func (ci *CacheItem) Restore(anchor titanpath.AbsoluteSystemPath) ([]titanpath.AnchoredSystemPath, error)
Restore extracts a cache to a specified disk location.