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
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.
Types ¶
This section is empty.