MCPcopy
hub / github.com/perkeep/perkeep / existingFileSchemas

Method existingFileSchemas

pkg/index/index.go:1338–1352  ·  view source on GitHub ↗
(wholeRef blob.Ref)

Source from the content-addressed store, hash-verified

1336}
1337
1338func (x *Index) existingFileSchemas(wholeRef blob.Ref) (schemaRefs []blob.Ref, err error) {
1339 it := x.queryPrefix(keyWholeToFileRef, wholeRef)
1340 defer closeIterator(it, &err)
1341 for it.Next() {
1342 keyPart := strings.Split(it.Key(), "|")[1:]
1343 if len(keyPart) < 2 {
1344 continue
1345 }
1346 ref, ok := blob.Parse(keyPart[1])
1347 if ok {
1348 schemaRefs = append(schemaRefs, ref)
1349 }
1350 }
1351 return schemaRefs, nil
1352}
1353
1354// WholeRefToFile maps a file contents blobRef (a "wholeRef"), to the file schemas with those contents.
1355type WholeRefToFile map[string][]blob.Ref

Callers 1

ExistingFileSchemasMethod · 0.95

Calls 5

queryPrefixMethod · 0.95
ParseFunction · 0.92
closeIteratorFunction · 0.85
NextMethod · 0.65
KeyMethod · 0.65

Tested by

no test coverage detected