LoadShallow loads basic information on the repo's sources This does not *fully* load in the sources themselves and their packages. It's useful if you just want to use JSON serialization without loading in unnecessary things.
(repo *PublishedRepo, collectionFactory *CollectionFactory)
| 1372 | // This does not *fully* load in the sources themselves and their packages. |
| 1373 | // It's useful if you just want to use JSON serialization without loading in unnecessary things. |
| 1374 | func (collection *PublishedRepoCollection) LoadShallow(repo *PublishedRepo, collectionFactory *CollectionFactory) (err error) { |
| 1375 | repo.sourceItems = make(map[string]repoSourceItem) |
| 1376 | |
| 1377 | if repo.SourceKind == SourceSnapshot { |
| 1378 | for component, sourceUUID := range repo.Sources { |
| 1379 | item := repoSourceItem{} |
| 1380 | |
| 1381 | item.snapshot, err = collectionFactory.SnapshotCollection().ByUUID(sourceUUID) |
| 1382 | if err != nil { |
| 1383 | return |
| 1384 | } |
| 1385 | |
| 1386 | repo.sourceItems[component] = item |
| 1387 | } |
| 1388 | } else if repo.SourceKind == SourceLocalRepo { |
| 1389 | for component, sourceUUID := range repo.Sources { |
| 1390 | item := repoSourceItem{} |
| 1391 | |
| 1392 | item.localRepo, err = collectionFactory.LocalRepoCollection().ByUUID(sourceUUID) |
| 1393 | if err != nil { |
| 1394 | return |
| 1395 | } |
| 1396 | |
| 1397 | item.packageRefs = &PackageRefList{} |
| 1398 | repo.sourceItems[component] = item |
| 1399 | } |
| 1400 | } else { |
| 1401 | panic("unknown SourceKind") |
| 1402 | } |
| 1403 | |
| 1404 | return |
| 1405 | } |
| 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) { |
no test coverage detected