MCPcopy
hub / github.com/perkeep/perkeep / NewCommonFileMap

Function NewCommonFileMap

pkg/schema/schema.go:713–729  ·  view source on GitHub ↗
(fileName string, fi os.FileInfo)

Source from the content-addressed store, hash-verified

711var populateSchemaStat []func(schemaMap map[string]interface{}, fi os.FileInfo)
712
713func 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

Callers 9

UploadFileMethod · 0.92
uploadNodeMethod · 0.92
uploadNodeRegularFileMethod · 0.92
TestJSONFunction · 0.85
TestRegularFileFunction · 0.85
TestSymlinkFunction · 0.85
TestStaticFIFOFunction · 0.85
TestStaticSocketFunction · 0.85

Calls 5

newCommonFilenameMapFunction · 0.85
RFC3339FromTimeFunction · 0.85
ModeMethod · 0.80
fFunction · 0.50
ModTimeMethod · 0.45

Tested by 6

TestJSONFunction · 0.68
TestRegularFileFunction · 0.68
TestSymlinkFunction · 0.68
TestStaticFIFOFunction · 0.68
TestStaticSocketFunction · 0.68