| 711 | var populateSchemaStat []func(schemaMap map[string]interface{}, fi os.FileInfo) |
| 712 | |
| 713 | func NewCommonFileMap(fileName string, fi os.FileInfo) *Builder { |
| 714 | bb := newCommonFilenameMap(fileName) |
| 715 | // Common elements (from file-common.txt) |
| 716 | if fi.Mode()&os.ModeSymlink == 0 { |
| 717 | bb.m["unixPermission"] = fmt.Sprintf("0%o", fi.Mode().Perm()) |
| 718 | } |
| 719 | |
| 720 | // OS-specific population; defined in schema_posix.go, etc. (not on App Engine) |
| 721 | for _, f := range populateSchemaStat { |
| 722 | f(bb.m, fi) |
| 723 | } |
| 724 | |
| 725 | if mtime := fi.ModTime(); !mtime.IsZero() { |
| 726 | bb.m["unixMtime"] = RFC3339FromTime(mtime) |
| 727 | } |
| 728 | return bb |
| 729 | } |
| 730 | |
| 731 | // PopulateParts sets the "parts" field of the blob with the provided |
| 732 | // parts. The sum of the sizes of parts must match the provided size |