diff --git a/cmd/mirror_list.go b/cmd/mirror_list.go index 2def29a5..0748d5e3 100644 --- a/cmd/mirror_list.go +++ b/cmd/mirror_list.go @@ -68,9 +68,9 @@ func aptlyMirrorListTxt(cmd *commander.Command, args []string) error { func aptlyMirrorListJson(cmd *commander.Command, args []string) error { var err error - repos := make([]*deb.RemoteRepo, context.CollectionFactory().RemoteRepoCollection().Len()) + repos := make([]*deb.RemoteRepo, context.NewCollectionFactory().RemoteRepoCollection().Len()) i := 0 - context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *deb.RemoteRepo) error { + context.NewCollectionFactory().RemoteRepoCollection().ForEach(func(repo *deb.RemoteRepo) error { repos[i] = repo i++ return nil diff --git a/cmd/mirror_show.go b/cmd/mirror_show.go index 44a0bdbc..97830cd4 100644 --- a/cmd/mirror_show.go +++ b/cmd/mirror_show.go @@ -98,12 +98,12 @@ func aptlyMirrorShowJson(cmd *commander.Command, args []string) error { name := args[0] - repo, err := context.CollectionFactory().RemoteRepoCollection().ByName(name) + repo, err := context.NewCollectionFactory().RemoteRepoCollection().ByName(name) if err != nil { return fmt.Errorf("unable to show: %s", err) } - err = context.CollectionFactory().RemoteRepoCollection().LoadComplete(repo) + err = context.NewCollectionFactory().RemoteRepoCollection().LoadComplete(repo) if err != nil { return fmt.Errorf("unable to show: %s", err) } @@ -113,7 +113,7 @@ func aptlyMirrorShowJson(cmd *commander.Command, args []string) error { if withPackages { if repo.RefList() != nil { var list *deb.PackageList - list, err = deb.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) + list, err = deb.NewPackageListFromRefList(repo.RefList(), context.NewCollectionFactory().PackageCollection(), context.Progress()) list.PrepareIndex() list.ForEachIndexed(func(p *deb.Package) error { diff --git a/cmd/publish_list.go b/cmd/publish_list.go index 26c7e9f1..c6e7be7a 100644 --- a/cmd/publish_list.go +++ b/cmd/publish_list.go @@ -77,10 +77,10 @@ func aptlyPublishListTxt(cmd *commander.Command, args []string) error { func aptlyPublishListJson(cmd *commander.Command, args []string) error { var err error - repos := make([]*deb.PublishedRepo, 0, context.CollectionFactory().PublishedRepoCollection().Len()) + repos := make([]*deb.PublishedRepo, 0, context.NewCollectionFactory().PublishedRepoCollection().Len()) - err = context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error { - e := context.CollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.CollectionFactory()) + err = context.NewCollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error { + e := context.NewCollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.NewCollectionFactory()) if e != nil { return e } diff --git a/cmd/publish_show.go b/cmd/publish_show.go index af4b9873..ff2c810b 100644 --- a/cmd/publish_show.go +++ b/cmd/publish_show.go @@ -88,12 +88,12 @@ func aptlyPublishShowJson(cmd *commander.Command, args []string) error { storage, prefix := deb.ParsePrefix(param) - repo, err := context.CollectionFactory().PublishedRepoCollection().ByStoragePrefixDistribution(storage, prefix, distribution) + repo, err := context.NewCollectionFactory().PublishedRepoCollection().ByStoragePrefixDistribution(storage, prefix, distribution) if err != nil { return fmt.Errorf("unable to show: %s", err) } - err = context.CollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.CollectionFactory()) + err = context.NewCollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.NewCollectionFactory()) if err != nil { return err } diff --git a/cmd/repo_list.go b/cmd/repo_list.go index 022663a9..f03d904a 100644 --- a/cmd/repo_list.go +++ b/cmd/repo_list.go @@ -74,10 +74,10 @@ func aptlyRepoListTxt(cmd *commander.Command, args []string) error { func aptlyRepoListJson(cmd *commander.Command, args []string) error { var err error - repos := make([]*deb.LocalRepo, context.CollectionFactory().LocalRepoCollection().Len()) + repos := make([]*deb.LocalRepo, context.NewCollectionFactory().LocalRepoCollection().Len()) i := 0 - context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *deb.LocalRepo) error { - e := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo) + context.NewCollectionFactory().LocalRepoCollection().ForEach(func(repo *deb.LocalRepo) error { + e := context.NewCollectionFactory().LocalRepoCollection().LoadComplete(repo) if e != nil { return e } diff --git a/cmd/repo_show.go b/cmd/repo_show.go index a79d8458..6344d323 100644 --- a/cmd/repo_show.go +++ b/cmd/repo_show.go @@ -63,12 +63,12 @@ func aptlyRepoShowJson(cmd *commander.Command, args []string) error { name := args[0] - repo, err := context.CollectionFactory().LocalRepoCollection().ByName(name) + repo, err := context.NewCollectionFactory().LocalRepoCollection().ByName(name) if err != nil { return fmt.Errorf("unable to show: %s", err) } - err = context.CollectionFactory().LocalRepoCollection().LoadComplete(repo) + err = context.NewCollectionFactory().LocalRepoCollection().LoadComplete(repo) if err != nil { return fmt.Errorf("unable to show: %s", err) } @@ -79,7 +79,7 @@ func aptlyRepoShowJson(cmd *commander.Command, args []string) error { if withPackages { if repo.RefList() != nil { var list *deb.PackageList - list, err = deb.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) + list, err = deb.NewPackageListFromRefList(repo.RefList(), context.NewCollectionFactory().PackageCollection(), context.Progress()) if err == nil { packageList = list.FullNames() } diff --git a/cmd/snapshot_list.go b/cmd/snapshot_list.go index 6588a970..71da1214 100644 --- a/cmd/snapshot_list.go +++ b/cmd/snapshot_list.go @@ -64,7 +64,7 @@ func aptlySnapshotListJson(cmd *commander.Command, args []string) error { sortMethodString := cmd.Flag.Lookup("sort").Value.Get().(string) - collection := context.CollectionFactory().SnapshotCollection() + collection := context.NewCollectionFactory().SnapshotCollection() jsonSnapshots := make([]*deb.Snapshot, collection.Len()) i := 0 diff --git a/cmd/snapshot_show.go b/cmd/snapshot_show.go index a2bd0b8f..5d5d9e7b 100644 --- a/cmd/snapshot_show.go +++ b/cmd/snapshot_show.go @@ -90,12 +90,12 @@ func aptlySnapshotShowJson(cmd *commander.Command, args []string) error { name := args[0] - snapshot, err := context.CollectionFactory().SnapshotCollection().ByName(name) + snapshot, err := context.NewCollectionFactory().SnapshotCollection().ByName(name) if err != nil { return fmt.Errorf("unable to show: %s", err) } - err = context.CollectionFactory().SnapshotCollection().LoadComplete(snapshot) + err = context.NewCollectionFactory().SnapshotCollection().LoadComplete(snapshot) if err != nil { return fmt.Errorf("unable to show: %s", err) } @@ -105,21 +105,21 @@ func aptlySnapshotShowJson(cmd *commander.Command, args []string) error { for _, sourceID := range snapshot.SourceIDs { if snapshot.SourceKind == deb.SourceSnapshot { var source *deb.Snapshot - source, err = context.CollectionFactory().SnapshotCollection().ByUUID(sourceID) + source, err = context.NewCollectionFactory().SnapshotCollection().ByUUID(sourceID) if err != nil { continue } snapshot.Snapshots = append(snapshot.Snapshots, source) } else if snapshot.SourceKind == deb.SourceLocalRepo { var source *deb.LocalRepo - source, err = context.CollectionFactory().LocalRepoCollection().ByUUID(sourceID) + source, err = context.NewCollectionFactory().LocalRepoCollection().ByUUID(sourceID) if err != nil { continue } snapshot.LocalRepos = append(snapshot.LocalRepos, source) } else if snapshot.SourceKind == deb.SourceRemoteRepo { var source *deb.RemoteRepo - source, err = context.CollectionFactory().RemoteRepoCollection().ByUUID(sourceID) + source, err = context.NewCollectionFactory().RemoteRepoCollection().ByUUID(sourceID) if err != nil { continue } @@ -133,7 +133,7 @@ func aptlySnapshotShowJson(cmd *commander.Command, args []string) error { if withPackages { if snapshot.RefList() != nil { var list *deb.PackageList - list, err = deb.NewPackageListFromRefList(snapshot.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) + list, err = deb.NewPackageListFromRefList(snapshot.RefList(), context.NewCollectionFactory().PackageCollection(), context.Progress()) list.PrepareIndex() list.ForEachIndexed(func(p *deb.Package) error {