LoadComplete loads complete information on the sources of the repo *and* their packages
(repo *PublishedRepo, collectionFactory *CollectionFactory)
| 1406 | |
| 1407 | // LoadComplete loads complete information on the sources of the repo *and* their packages |
| 1408 | func (collection *PublishedRepoCollection) LoadComplete(repo *PublishedRepo, collectionFactory *CollectionFactory) (err error) { |
| 1409 | _ = collection.LoadShallow(repo, collectionFactory) |
| 1410 | |
| 1411 | if repo.SourceKind == SourceSnapshot { |
| 1412 | for _, item := range repo.sourceItems { |
| 1413 | err = collectionFactory.SnapshotCollection().LoadComplete(item.snapshot) |
| 1414 | if err != nil { |
| 1415 | return |
| 1416 | } |
| 1417 | } |
| 1418 | } else if repo.SourceKind == SourceLocalRepo { |
| 1419 | for component, item := range repo.sourceItems { |
| 1420 | err = collectionFactory.LocalRepoCollection().LoadComplete(item.localRepo) |
| 1421 | if err != nil { |
| 1422 | return |
| 1423 | } |
| 1424 | |
| 1425 | var encoded []byte |
| 1426 | encoded, err = collection.db.Get(repo.RefKey(component)) |
| 1427 | if err != nil { |
| 1428 | // < 0.6 saving w/o component name |
| 1429 | if err == database.ErrNotFound && len(repo.Sources) == 1 { |
| 1430 | encoded, err = collection.db.Get(repo.RefKey("")) |
| 1431 | } |
| 1432 | |
| 1433 | if err != nil { |
| 1434 | return |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | err = item.packageRefs.Decode(encoded) |
| 1439 | if err != nil { |
| 1440 | return |
| 1441 | } |
| 1442 | } |
| 1443 | } else { |
| 1444 | panic("unknown SourceKind") |
| 1445 | } |
| 1446 | |
| 1447 | return |
| 1448 | } |
| 1449 | |
| 1450 | // ByStoragePrefixDistribution looks up repository by storage, prefix & distribution |
| 1451 | func (collection *PublishedRepoCollection) ByStoragePrefixDistribution(storage, prefix, distribution string) (*PublishedRepo, error) { |