1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

archive: adding comment to exported functions

Signed-off-by: Vincent Batts <vbatts@redhat.com>
This commit is contained in:
Vincent Batts 2014-09-19 14:02:12 -04:00
parent e91de29e08
commit 0fe56ce1b9

View file

@ -58,6 +58,8 @@ func sameFsTimeSpec(a, b syscall.Timespec) bool {
(a.Nsec == b.Nsec || a.Nsec == 0 || b.Nsec == 0) (a.Nsec == b.Nsec || a.Nsec == 0 || b.Nsec == 0)
} }
// Changes walks the path rw and determines changes for the files in the path,
// with respect to the parent layers
func Changes(layers []string, rw string) ([]Change, error) { func Changes(layers []string, rw string) ([]Change, error) {
var changes []Change var changes []Change
err := filepath.Walk(rw, func(path string, f os.FileInfo, err error) error { err := filepath.Walk(rw, func(path string, f os.FileInfo, err error) error {
@ -340,6 +342,7 @@ func ChangesDirs(newDir, oldDir string) ([]Change, error) {
return newRoot.Changes(oldRoot), nil return newRoot.Changes(oldRoot), nil
} }
// ChangesSize calculates the size in bytes of the provided changes, based on newDir.
func ChangesSize(newDir string, changes []Change) int64 { func ChangesSize(newDir string, changes []Change) int64 {
var size int64 var size int64
for _, change := range changes { for _, change := range changes {
@ -362,6 +365,7 @@ func minor(device uint64) uint64 {
return (device & 0xff) | ((device >> 12) & 0xfff00) return (device & 0xff) | ((device >> 12) & 0xfff00)
} }
// ExportChanges produces an Archive from the provided changes, relative to dir.
func ExportChanges(dir string, changes []Change) (Archive, error) { func ExportChanges(dir string, changes []Change) (Archive, error) {
reader, writer := io.Pipe() reader, writer := io.Pipe()
tw := tar.NewWriter(writer) tw := tar.NewWriter(writer)