Documentation ¶
Index ¶
- func Restore(r io.Reader, dir string) error
- func SinceFilterTarFile(since time.Time) func(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error
- func Stream(w io.Writer, dir, relativePath string, ...) error
- func StreamFile(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error
- func StreamRenameFile(f os.FileInfo, tarHeaderFileName, relativePath, fullPath string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Restore ¶
Restore reads a tar archive from r and extracts all of its files into dir, using only the base name of each file.
func SinceFilterTarFile ¶
func SinceFilterTarFile(since time.Time) func(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error
Generates a filtering function for Stream that checks an incoming file, and only writes the file to the stream if its mod time is later than since. Example: to tar only files newer than a certain datetime, use tar.Stream(w, dir, relativePath, SinceFilterTarFile(datetime))
func Stream ¶
func Stream(w io.Writer, dir, relativePath string, writeFunc func(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error) error
Stream is a convenience function for creating a tar of a shard dir. It walks over the directory and subdirs, possibly writing each file to a tar writer stream. By default StreamFile is used, which will result in all files being written. A custom writeFunc can be passed so that each file may be written, modified+written, or skipped depending on the custom logic.
func StreamFile ¶
stream a single file to tw, extending the header name using the shardRelativePath
func StreamRenameFile ¶ added in v1.5.2
func StreamRenameFile(f os.FileInfo, tarHeaderFileName, relativePath, fullPath string, tw *tar.Writer) error
/ Stream a single file to tw, using tarHeaderFileName instead of the actual filename e.g., when we want to write a *.tmp file using the original file's non-tmp name.
Types ¶
This section is empty.